Is there any way to pass response object values from first request to second request as input parameters in graph batch request - microsoft-graph-api

Is there any way to pass response object values from first request to second request as input parameters in graph batch request (2nd request is dependant on 1st request - graph/json-batching)
In the following request, the client is specifying that requests 1 should be run first, then request 2.
2nd Request need the id from the 1st Request's response as URL variable. What is the way to achieve it?
JSON
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/users/<upn>?$select=id"
},
{
"id": "2",
"dependsOn": [ "1" ],
"method": "GET",
"URL": "users/<id from the 1st request>/presence"
}
]
}

Yes, As #Tiny-wa said this is not possible as of now. There is already a feature request raised in the Microsoft Graph Feedback Forum, please upvote it so that the product team may implement it in future.
So, for now you need to make two separate requests, make first request and get response details and use it and make a second request.

Related

Is there a way to send custom parameters along with a redirect action using twilio autopilot?

I would like to send custom parameters along with my redirect request in addition to the ones provided by twilio (https://www.twilio.com/docs/autopilot/actions/autopilot-request) - I wasn't able to find anything in the docs. Does anyone know how I could achieve this? Or is passing through the URL the only way?
{
"actions": [
{
"redirect": {
"method": "POST",
"uri": "https://my-node-app/params/1"
}
}
]
}
URL query parameters as you stated.
https://my-node-app/params/1?param1=x&param2=y&param3=z

Issue passing in custom parameters to Twilio API

I am attempting to build out a process that will do the following:
New contact lands in my CRM (Podio)
The CRM is triggered to send a POST containing a custom parameter to Twilio which will then initiate a flow
The Twilio flow will call my cell and prompt me to connect to the new contact
Once I press 1, it will take the custom parameter (new contact's phone number) and connect
me to them.
So far, I have been able to get 1-3 with no problem.
However, according to the the API documentation from Twilio I should be able to pass a 3rd parameter in the JSON body of my HTTP request containing custom "Parameters". When I attempt this the parameters aren't showing in the Twilio studio logs and thus I am unable to connect the call to the new lead.
This is the JSON body I am sending over to my Twilio Flow's API
{
"To": "+1xxxxxxxxx1",
"From": "+1xxxxxxxxx2",
"Parameters": {
"name": "example name",
"prospectphone": "+1xxxxxxxxx3"
}
}
When I view the logs in Twilio this is what I received.
{
"contact": {
"channel": {
"address": "+1xxxxxxxxx2"
}
},
"trigger": {
"request": {
"from": "+1xxxxxxxxx2",
"to": "+1xxxxxxxxx1",
"parameters": {}
}
},
"widgets": {},
"flow": {
"flow_sid": "FW936f72c0eb8d3945d0d55c62465e37a8",
"data": {},
"channel": {
"address": "+1xxxxxxxxx2"
},
"sid": "FN955cdb12827f84c8af8fc9b5264e5a28"
}
}
I really can't figure out what I'm missing here? Has anyone run into this before? Is this something you can only do if you're using the SDK or does the additional parameter need to be passed in some other way?
It should be sent x-www-form-urlencoded.
From the documentation:
"Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string."
Trigger a Twilio Studio Flow Execution via the REST API

Not receiving response from slack on Request URL set in Interactive Component

From My application sending message in slack using chat.postmessage with a button inside json request. but when user clicks on button from slack it's not returning response on request URL.
https://api.slack.com/messaging/interactivity/enabling#responding_to_interactions
As mentioned here in above link, i have set the structure. set Request URL and also actions with callback id. in my app also set request URL method. i have checked that my application's request URL is working fine.
In attachment parameter passed json as below
[
{
"text": "Are you want to turn of this messages?",
"fallback": "You are unable to turn off",
"callback_id": "turn_off_message",
"attachment_type": "default",
"actions": [
{
"name": "turnoff",
"text": "Turn Off",
"type": "button",
"value": "turnoff"
}
]
}
]
Once user click on Turn Off button, need a response on Request URL which i have set in Interactive Component.

Given a groupId and authenticated user, how do I check the user's membership and role (owner vs member) in one network call?

As far as I know, Microsoft Graph lets me query for /groups/{groupid}/members or /groups/{groupid}//owners separately, but not both in one call. Is this possible?
In my context, I know the groupId and the authenticated calling userId. How do I check whether this user belongs to the group and if so, their owner/member role in one network call? Is this possible?
One option to assume would be to expand and include members and owners properties via $expand query option but unfortunately the following query is not supported:
https://graph.microsoft.com/v1.0/groups/{group-id}?$select=owners,members&$expand=owners,members
since max only 1 object is allowed to be expanded per Group resource
JSON batching comes to the rescue here, the following example demonstrates how to retrieve Group members and owners within a single request:
POST https://graph.microsoft.com/v1.0/$batch
Accept: application/json
Content-Type: application/json
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/groups/{group-id}/members"
},
{
"id": "2",
"method": "GET",
"url": "/groups/{group-id}/owners"
}
]
}

Impossible to get messages details in a list request with Gmail API

I am using a ruby on rails app which connects to the Gmail API. When I make a listrequest to get all the messages of one mailbox, I only get back an idand a threadId property for each message.
I tried to follow Gmail API Doc using the fields parameters to get other properties (title, date...). It doesn't work, whether I use the google-api-client gem in my app, or by doing a direct GET request.
Adding any other parameters to the request ends with a failure. Here is the url that works :
https://www.googleapis.com/gmail/v1/users/me/messages?fields=messages(id,threadId)
Am I forced to make one call per message or using batch requests to get relevant datas ? It seems a little heavy...
You first need to list messages like you've done, and then get each message in a separate request.
Request 1
GET https://www.googleapis.com/gmail/v1/users/me/messages?maxResults=1&access_token={ACCESS_TOKEN}
Response 1
{
"messages": [
{
"id": "15fd9f0fe242f975",
"threadId": "15fd9f0fe242f975"
}
],
"nextPageToken": "11889180580605610074",
"resultSizeEstimate": 2
}
Request 2
GET https://www.googleapis.com/gmail/v1/users/me/messages/15fd9f0fe242f975?access_token={ACCESS_TOKEN}
Response 2
{
"id": "15fd9f0fe242f975",
"threadId": "15fd9f0fe242f975",
"labelIds": [
"IMPORTANT",
"CATEGORY_UPDATES",
"INBOX"
],
"snippet": "Tasks tracked last week...",
"historyId": "966691",
...
}
It's also possible to get the total amount of request down from 1 + n of messages to 2 by using batch requests.

Resources