Outlook - get message id with javascript? - javascript

I made a question yesterday, asking to get the "id" from the outlook mail URL, like this:
https://outlook.live.com/mail/0/inbox/id/AQQkADAwATM0MDAAMS0xZGUwLTNjMTAtMDACLTAwCgAQAB%2FnQ1lgT6dDlqIakp3j4qk%3D
But it turns out that that is not the message id, for some reason.
Is there any way to get the actual message id with javascript?
Im using this to interact with the microsoft graph api. Have a look here to see what i'm trying to do.

Message id is the id of any message you get using List Messages. The Graph API follows REST API design. I suggest you do the resource navigation through Graph. Don't copy id from outlook client and use on Graph.
List messages:
GET https://graph.microsoft.com/v1.0/me/messages
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('bb8775a4-4d8c-42cf-a1d4-4d58c2bb668f')/messages(sender,subject)",
"value": [
{
"#odata.etag": "W/\"CQAAABYAAADHcgC8Hl9tRZ/hc1wEUs1TAAAwR4Hg\"",
"id": "AAMkAGUAAAwTW09AAA=",
"subject": "Welcome to our group!",
...
}
]
}
Then get one message:
GET https://graph.microsoft.com/v1.0/me/messages/AAMkAGUAAAwTW09AAA=
{
"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('cd209b0b-3f83-4c35-82d2-d88a61820480')/messages(subject,body,bodyPreview,uniqueBody)/$entity",
"#odata.etag":"W/\"CQAAABYAAABmWdbhEgBXTophjCWt81m9AAAoZYj4\"",
"id":"AAMkAGUAAAwTW09AAA=",
"subject":"Welcome to our group!",
"bodyPreview":"Welcome to our group, Dana!",
...
}

Fixed it!
GET https://graph.microsoft.com/v1.0/me/messages
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('bb8775a4-4d8c-42cf-a1d4-4d58c2bb668f')/messages(sender,subject)",
"value": [
{
"#odata.etag": "W/\"CQAAABYAAADHcgC8Hl9tRZ/hc1wEUs1TAAAwR4Hg\"",
"id": "AAMkAGUAAAwTW09AAA=",
"subject": "Welcome to our group!",
...
}
]
}
Get a list of messages, and for every message, if the conversationID matches the outlook ID (with / replaced with -) then that is the email

Related

Correct format of JSON key for Qualtrics Web Service Query

I'm trying to use the Web Service component of a Qualtrics survey to get data from a mailing list based on an answer provided by the person completing. So they would select "Bob Jones" and then the Web Service would look at the mailing list to then populate the email address for Bob Jones.
I'm able to call the mailing list and see results successfully with the API token, however, any time I try to add a query, I get a return of "Unexpected json key provided"
How can I access a specific entry? The format of the returned list follows:
{
"result": {
"elements": [
{
"id": "abcdefghijk",
"firstName": "Bob",
"lastName": "Jones",
"email": "bobjones#stackoverflow.com",
"externalDataReference": "Jones, Bob",
"embeddedData": {
"PrimaryEmail": "bobjones#stackoverflow.com",
"DisplayName": "Jones, Bob"
},
"language": "null",
"unsubscribed": false,
"responseHistory": [],
"emailHistory": []
},
I'm attempting to add the query where it says Parameter to Web Service...:
I greatly apologize if this has been discussed already. I searched through as many questions as I could, and didn't find an answer to this. Hope someone will help!
The API you are trying to use doesn't accept query parameters and you can't use it to get data for a specific contact.
Whether you can do it at all depends on whether your account has XM Directory or Research Core Contacts. If you have Research Core Contacts, the only way to get data for a specific contact is by contact id. If you have XM Directory you can use the search API. See: https://api.qualtrics.com/api-reference/reference/contacts.json/paths/~1directories~1{directoryId}~1contacts~1search/post

Detect in dialogflow a cardclick event from Hangouts chat and call a intent

I have a problem with hangouts.
I'll explain the scenario to you so that you can better understand
I have hangouts for user chat (Channel)
I have a bot implemented with Dialogflow
I have the fulfillment connected to the bot, to create customized answers for the user.
I would like to create a list of buttons or a card so that when the user clicks, the option he has clicked is sent to the fulfillment and there it is processed.
Would anyone know any way to do this?
The flow
1) The user writes "hello" in the hangout chat
2) This message ("hello") is sent to dialogflow, which then processes the message and sends it to the fullfillment.
3) In the fulfillment a response is elaborated in json format (you will see it later). In this answer is included an object called onClick, inside it has another object called action and that contains another object called actionMethodName where you define where you want to go (In this case it would be ideal to redirect the user to another INTENT)
The problem is that when you click on that button you get a message saying "Your bot cannot be contacted. Try again later."
What I would like is that once the user clicks on it, the bot will recognize the event (CARD_CLICKED) and take him to another INTENT
CustomPayload: function () {
return {
"actionResponse": {
"type": 'CARD_CLICKED'
},
"payload": {
"hangouts": {
"sections": [
{
"widgets": [
{
"textParagraph": {
"text": "<b>Roses</b> are <font color=\"#ff0000\">red</font>,<br><i>Violets</i> are <font color=\"#0000ff\">blue</font>"
}
},
{
"buttons": [
{
"textButton": {
"text": "NEXT INTENT",
"onClick": {
"action": {
"actionMethodName": "intent",
"parameters": []
}
}
}
}
]
}
]
}
],
"header": {}
}
},
"platform": "GOOGLE_HANGOUTS"
}
}
I tried something similar but at the end I am changing a little bit the design.
Configure Hangouts API to go to your backend instead of DialogFlow (and eliminate Fulfillment)
In your backend, check whether the type of the message is Message or Card_clicked (among others) and generate the card response.
Also in your backend you can use detectIntent function from dialogflow library to detect the intent and answer back to Hangouts.
I hope it helps.

How to pass a value from slack channel to `Options Load URL` in Slack App

I have a slack app implemented in node.js where I am dynamically displaying a drop-down menu from an Options Load URL to a channel on the Slack group.
The drop down is getting displayed correctly based on the options JSON that I am returning form the external URL,
but now the problem is that I need to have separate items in the drop-down menu based on what the user has entered on the slack channel.
For example:
If the user says: give me choices for option 1: then the value 1 should be passed to the Options Load URL and the code that I have implemented at that URL will reply with the appropriate JSON based on the input value 1.
Next, when the User says give me choices for option 2: then the value 2 should be passed to the Options Load URL and the code implemented there will reply the options based on the value 2 that it receives.
The code at the Options Load URL is already implemented. The code for extracting the number 1 or 2 from the user message is also implemented.
The values 1 or 2 ... etc. are not constant or fixed. These can by random and the API at Options Load URL will be able to correctly handle these values.
I just need to figure out a way to send these values to the Options Load URL somehow.
Is it possible to do this somehow in Slack?
Use the name property in your request to pass a custom value to the part of your app that handles the options requests from Slack ("Options Load URL"). I use it usually to select which predefined options list to return, but you can also use it to dynamically create a new option list based on the value.
For reference here is the example Slack request for creating a dynamic menu (from the offical documentation), where you can see the name property under action. In this example it has the value "bugs_list":
{
"text": "What's bugging you?",
"response_type": "in_channel",
"attachments": [
{
"fallback": "Upgrade your Slack client to use messages like these.",
"color": "3AA3E3",
"attachment_type": "default",
"callback_id": "select_remote_1234",
"actions": [
{
"name": "bugs_list",
"text": "Which random bug do you want to resolve?",
"type": "select",
"data_source": "external",
"min_query_length": 3,
}
]
}
]
}
And here is what your Options Load URL will receive. Notice the name parameter.
{
"name": "bugs_list",
"value": "bot",
"callback_id": "select_remote_1234",
"team": {
"id": "T012AB0A1",
"domain": "pocket-calculator"
},
"channel": {
"id": "C012AB3CD",
"name": "general"
},
"user": {
"id": "U012A1BCJ",
"name": "bugcatcher"
},
"action_ts": "1481670445.010908",
"message_ts": "1481670439.000007",
"attachment_id": "1",
"token": "verification_token_string"
}
The name parameter is a common parameter in a HTTP request, so you can put pretty much everything in there, even data structures, as long as they are encoded as strings. Also see my other answer that talks about the limits of passing data in Slack parameters.

How to get all google reviews using business api

I need all google reviews for particular location but I am unable to use business api from google. Here is url for get request
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
Now my question is what is the value for param account_name and location_name
How can I get that.
Please answer with sample location example
I think first of all you need to white list your google my business api for whatever project you are working on in your project as its private api. Google my business api will work on the locations associated with your account so make sure you verified the LOCATIONS from any account you know. Then you can try out the api call you mentioned in OAuthplayground.
Follow steps mentioned in below documentation URL to set it up:
https://developers.google.com/my-business/content/prereqs
After the setup and etc you will automatically understand the account id and location id.
Also few more urls you can go to understand it better.
https://console.developers.google.com (here you will setup your project)
https://business.google.com/manage (here you will add/can see the locations - for which you need reviews)
https://developers.google.com/my-business/content/basic-setup (Steps after completing the prereq)
https://developers.google.com/oauthplayground (You will test the my
business api here after approval)
When you make a request to https://mybusiness.googleapis.com/v3/accounts it gives you a list of accounts. On those accounts they have a field called name. That field is accounts/account_name.
{
"state": {
"status": "UNVERIFIED"
},
"type": "PERSONAL",
"name": "accounts/1337",
"accountName": "example"
}
When you make a request to https://mybusiness.googleapis.com/v3/accounts/account_name/locations it gives you a list of locations. On those locations they have a field called name. That field is accounts/account_name/locations/location_name.
{
"locations": [
{
"languageCode": "en",
"openInfo": {
"status": "OPEN",
"canReopen": true
},
"name": "accounts/1337/locations/13161337",
...
}

(#12) singular statuses API is deprecated for versions v2.4 and higher [duplicate]

I just tried through the Graph API Explorer with this path /v2.4/10153513872748291 and I've got this result:
{
"error": {
"message": "(#12) singular links API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12
}
}
But https://developers.facebook.com/docs/reference/api/post/ doesn't say anything about deprecation.
I'm not sure if I miss something, or there's another way to get info about an individual post.
Edit: v2.3 works, but v2.4 is the latest one.
Looks like you now need to the combination of the id of the user or page that made the post (or whose wall it is on), an underscore, and then the post id.
For your example post, 10153513872748291, that is made by a page Drama-addict, that has the id 141108613290 – so 141108613290_10153513872748291 will work.
And so does 788239567865981_10153513872748291, because 788239567865981 is the id of the user making the post.
Firstput userId underscore add postId /Likes to check Like status in facebook
userId_post_Id/Likes to fetch Likes Records
userId_post_Id/Comments to fetch Comments Records
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=303261006522998_751199848395776%2FLikes&version=v2.9
**In this link Right side Get Token indide GetAccessToken to select Permission**
303261006522998_751199848395776/Likes
303261006522998_751199848395776/Comments
{
"data": [
{
"id": "124778301449917",
"name": "Manisha Gera"
},
{
"id": "1680577265523548",
"name": "Rubi Sharma"
}
],
"paging": {
"cursors": {
"before": "MTI0Nzc4MzAxNDQ5OTE3",
"after": "MTY4MDU3NzI2NTUyMzU0OAZDZD"
}
}
}

Categories