RFC822 Message-Id in GmailApi send - gmail

while reading mail using GmailApi, there is unique "Message-Id" (RFC822 Message-Id) field with each mail.
When I send mail using GmailApi there is no "Message-Id", if there is I couldn't find. Response message include "data" filed witch have this.
{ id: '163924a3ddf18bd5',
threadId: '163924a3ddf18bd5',
labelIds: [ 'UNREAD', 'SENT', 'INBOX' ] }
and bunch of other details.
My question is, is there any "Message-Id" in case of send mail too, and if it is how can i get it. And I am using nodeJs library

Don't know what kind of ID you're looking for but the response id from the docs states that:
id string The immutable ID of the message.

Related

Microsoft Teams bot finding message sender id

We have built a teams app that can be used in the group chat. So, basically any user can do
#
At the server side, we want to get the sending user and respond to the sent text based on who sent it. The code to get users in the conversation looks like below:
const connector = context.adapter.createConnectorClient(context.activity.serviceUrl);
const response = await connector.conversations.getConversationMembers(context.activity.conversation.id);
functions.logger.log("conversation members are:", response)
The response returns an array of all the users in the conversation with below structure
[
{
"id": "29:1a-Xb7uPrMwC2XqjMEHCC7ytV2xb2VUCqTA-n_s-k5ZyMCTKIL-ku2XkgbE167D_5ZbmVaqQxJGIQ13vypSqu-A",
"name": "Neeti Sharma",
"objectId": "718ab805-860c-43ec-8d4e-4af0c543df75",
"givenName": "Neeti",
"surname": "Sharma",
"email": "xxx#xxxx.xxx",
"userPrincipalName": "xxxx#xxxx.xxx",
"tenantId": "xxx-xx-xx-xxxxxx-x",
"userRole": "user"
},
{
...
}
]
The above response does not indicate who is the sender of the message in the group chat. How do we find that?
I'm not sure the exact syntax for Node (I work mostly in C#), but basically on the context.activity object there is a from property (i.e. context.activity.from), which is of type ChannelAccount (DotNet reference here, but it's very similar for Node). That will give you, at least, Name and AadObjectId. What you're using right now is getConversationMembers, which gives you everyone in the entire Channel, not just that particular message/thread.
turnContext.Activity.From.Id is also unique to each user. You can use that property too. Email is tough to get in any other events than the MembersAdded event.

Discord.js Embed Timestamp not able to parse a UNIX timestamp

When trying to edit a discord message into a RichEmbedded message using discord.js, I get the error
(node:10860) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.timestamp: Could not parse 1581492006141. Should be ISO8601.
at item.request.gen.end (/rbd/pnpm-volume/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
I am hosting the bot on glitch.com. I am sending a message to a channel, then later editing it into an embedded message that contains the requested data.
msg.channel.send("Recieving Data").then(response => {
//Get data
response.edit({
embed: {
description: "Example Data",
timestamp: msg.createdTimestamp
}
})
}).catch(//handle error);
It does not error if I send the embed message instead of editing a previous message. I've tried parsing the timestamp yet it does not accept it. Is it because the previous message's timestamp cannot be changed after being sent?
You have to create a new Date with your timestamp, Discord don't accept timestamp in this field, only ISO8601 date
You can do it like this :
...
msg.channel.send("Recieving Data").then(response => {
//Get data
response.edit({
embed: {
description: "Example Data",
timestamp: msg.createdAt
}
})
}).catch(//handle error);
...
How ever, if you want a quick and easy way of designing an embed, try out this tool by leovoel, the Embed Visualizer shows you exactly how your embed will look, and will generate the code for you at the press of a button. With that you will see that the timestamp field doesn't accept timestamp.
You can edit embed timeStamp, but in your sulution you try edit msg with only timestamp field. So you got an error. msg.edit() don`t change the part of content, this method change full message content.
So like if you have embed with description, footer, fields. And you will edit him with only description field of data, other fields of embed will be removed.
embed: {
//Data
description: "someText"
}
Right way will be get message content, embeds and change reciving data embed timeStamp and then edit message with new data.

Is it possible to remove title in Dialogflow Facebook quick replies and print only the quick replies?

Is it possible to configure the response in DialogFlow in such way that
when I enter the Facebook quick reply I will leave the title blank?
I want the user to get only the options without a title.
For example if I have:
Title: Choose an item
Quick reply 1: A
Quick reply 2: B
Quick reply 3: C
Can I somehow remove the title from displaying on FB?
Please advise.
If you see quick reply payload docs ,
The properties are,
text String
Non-empty message text to send with the quick replies. text or
attachment must be set.
attachment Object
An attachment to send with the quick replies. text or attachment must
be set.
quick_replies Array
An array of objects the describe the quick reply buttons to send. A
maximum of 13 quick replies are supported.
Format must be like,
{
"text": "Pick a color:", // non-empty string
"quick_replies":[
{
"content_type":"text",
"title":"Red",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/red.png"
},{
"content_type":"text",
"title":"Green",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/green.png"
}
]
}
I little late but this is when I saw the post. If case you strill need a solution I accomplished the aforementioned by using a custom payload like this:
{
"facebook": {
"attachment":{
"type":"template",
"payload":{
"template_type":"generic"
}
},
"quick_replies":[
{
"content_type":"user_email",
"title":"Red",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/red.png"
},{
"content_type":"text",
"title":"Green",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/green.png"
}
]
}
In the attachment payload you can create any rich content you like, card, carousel, etc. and then attach some quick reply buttons without a title. Also in the quickReply section you can change the text for any other like user_email or user_phone_number.
Hope this help

Change Nick Name of Email while sending the email from netsuite script 2.0

Suppose we have the code
email.send({
author: 17874,
recipients: "sam172#gmail.com",
subject: "mail from netsuite",
body: "test body email order id: " + newOrder
});
Can we modify the sender name only not the email.
I have to implement like if we have the email "test#gmail.com" and nick name as "Test". While sending the email it will show like from Test in recevire side. Can we change the name from test to test123.
This isn't possible as far as I know. You really have two options to modify the name of the sender only:
Either change the name of the user (the one you set in the options.author field).
Or have the correct name from the beginning and then modify the reploy-to instead by setting the options.replyTo
This isn't exactly what you want but I think it's the only workaround.

Get facebook userID with sender.id

So here is the change event webhook sends me when my page receives a msg :
{
"object":"page",
"entry":
[{"id":"718511138248476","time":1470310180982,
"messaging":
[{"sender":{"id":"845775748857562"},
"recipient":{"id":"718511138248476"},
"timestamp":1470310180901,
"message":
{"mid":"mid.1470310180891:612cfb6aead5fca278",
"seq":468,
"text":"hello"}
}]
}]}
But then how should I know which user is actually sending this message ? Is there some way to get the user facebook ID with sender.id ?
And for the second question : is sender.id always the same or it will be changed ? I mean is it wise to save the sender.id in database for when I'm intending to send a msg to the user later on ?
You can read document here https://developers.facebook.com/docs/messenger-platform/user-profile . But response fields do not have "id".

Resources