I'm not sure what I've messed up, but I'm receiving this error when attempting to send a POST request from Power Automate to a Twilio Flow.
Was able to trigger the Twilio Flow from PowerShell, but cannot replicate on Power Automate.
{
"code": 20001,
"message": "Missing required parameter To in the post body",
"more_info": "https://www.twilio.com/docs/errors/20001",
"status": 400
}
input
output
http request post
This ended up working for me.
Change Content-Type value to
application/x-www-form-urlencoded; charset=utf-8
Change Body value to
To=%2B12223334444&From=%2B15556667777
12223334444 = Send To #
15556667777 = Send From # (Twilio Phone # assigned the Flow)
Re: Using HTTP POST with Twilio
INPUT
{
"uri": "https://studio.twilio.com/v2/Flows/##################################/Executions",
"method": "POST",
"headers": {
"content-type": "application/x-www-form-urlencoded; charset=utf-8"
},
"authentication": {
"username": "**********************************",
"password": "*sanitized*",
"type": "Basic"
},
"body": "To=%2B12223334444&From=%2B15556667777"
}
OUTPUT
{
"statusCode": 201,
"headers": {
"Connection": "keep-alive",
"Twilio-Concurrent-Requests": "1",
"Twilio-Request-Id": "##################################",
"Twilio-Request-Duration": "0.055",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since",
"Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS",
"Access-Control-Expose-Headers": "ETag",
"Access-Control-Allow-Credentials": "true",
"X-Shenanigans": "none",
"X-Home-Region": "us1",
"X-API-Domain": "studio.twilio.com",
"Strict-Transport-Security": "max-age=31536000",
"Date": "Tue, 08 Jun 2021 14:04:24 GMT",
"X-Powered-By": "AT-5000",
"Content-Length": "707",
"Content-Type": "application/json"
},
"body": {
"status": "active",
"date_updated": null,
"contact_channel_address": "+12223334444",
"account_sid": ""**********************************",",
"url": "https://studio.twilio.com/v2/Flows/##################################/Executions/##################################",
"context": {},
"sid": "##################################",
"date_created": "2021-06-08T14:04:23Z",
"flow_sid": "##################################",
"links": {
"steps": "https://studio.twilio.com/v2/Flows/##################################/Executions/##################################/Steps",
"execution_context": "https://studio.twilio.com/v2/Flows/##################################/Executions/##################################/Context"
}
}
}
Related
The webhook for a subscription activation BILLING.SUBSCRIPTION.ACTIVATED in the Paypal's sandbox works very well.
Nevertheless, when I'm trying to cancel the subscription from a customer sandbox account, no webhook post is received.
It should be BILLING.SUBSCRIPTION.CANCELLED.
In fact, the status is "pending" from the sandbox admin account:
Does it wait until the subscription's end date in order to send the cancellation?
Or does it wait a few hours for safety reasons?
Here are the details from the paypal sandbox web site:
{
"id": "WH-3BV96304FY002321K-38Y64104YL460680C",
"create_time": "2022-07-04T17:51:34.874Z",
"resource_type": "subscription",
"event_type": "BILLING.SUBSCRIPTION.CANCELLED",
"summary": "Subscription cancelled",
"resource": {
"quantity": "1",
"subscriber": {
"email_address": "valid_adress#yahoo.fr",
"payer_id": "X3FWGFE2SAXUL",
"name": {
"given_name": "Anyname",
"surname": "Walker"
},
"shipping_address": {
"address": {
"address_line_1": "Great st 25",
"admin_area_2": "New York",
"admin_area_1": "NY",
"postal_code": "10002",
"country_code": "US"
}
}
},
"create_time": "2022-07-04T17:49:00Z",
"plan_overridden": false,
"shipping_amount": {
"currency_code": "USD",
"value": "0.0"
},
"start_time": "2022-07-04T17:46:51Z",
"update_time": "2022-07-04T17:51:25Z",
"billing_info": {
"outstanding_balance": {
"currency_code": "USD",
"value": "0.0"
},
"cycle_executions": [
{
"tenure_type": "REGULAR",
"sequence": 1,
"cycles_completed": 1,
"cycles_remaining": 0,
"current_pricing_scheme_version": 1,
"total_cycles": 0
}
],
"last_payment": {
"amount": {
"currency_code": "USD",
"value": "3.99"
},
"time": "2022-07-04T17:49:01Z"
},
"failed_payments_count": 0
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-6BR7NSX98KLF",
"rel": "self",
"method": "GET",
"encType": "application/json"
}
],
"id": "I-6BR7NSX98KLF",
"plan_id": "P-5XR3459593FMK2CYGA",
"status": "CANCELLED",
"status_update_time": "2022-07-04T17:51:25Z"
},
"status": "PENDING",
"transmissions": [
{
"webhook_url": "https://www.myapp.com/webhook",
"http_status": 440,
"reason_phrase": "HTTP/1.1 200 Connection established",
"response_headers": {
"Server": "gunicorn",
"Connection": "keep-alive",
"Content-Length": "5",
"Date": "Mon, 04 Jul 2022 18:15:52 GMT",
"Content-Type": "text/html; charset=utf-8",
"Via": "1.1 google"
},
"transmission_id": "02cba350-fbc2-9abc-d537a3be4540",
"status": "PENDING",
"timestamp": "2022-07-04T17:52:03Z"
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C",
"rel": "self",
"method": "GET",
"encType": "application/json"
},
{
"href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C/resend",
"rel": "resend",
"method": "POST",
"encType": "application/json"
}
],
"event_version": "1.0",
"resource_version": "2.0"
}
Pending means pending delivery to the subscribed webhook URL. The event ocurred, and delivery to the URL was attempted, but that URL did not respond with an HTTP 200 success message for the webhook to be marked as successfully delivered. In fact, according to the details logged in your question:
"webhook_url": "https://www.myapp.com/webhook",
"http_status": 440,
That URL instead responded with an HTTP 440 status
Assuming the URL is correct and that you changed it to "myapp" for this question, the issue is that you need to debug the endpoint/code at that URL so that it responds with a 200 success status when webhook deliveries are posted to it. Then their status will stop being Pending.
When I send batch request made of calendar appointment request to Graph API, I seldom encounter a improper response from the API: some XML are injected as is in the JSON response.
This is impossible to unserialize, so I cannot know which appointment had issues, and it leaves no choice but to reiterate the same calendar appointments batch, which poses performance issue.
The request to batch API looks as follow (I intentionally hide information with *** in the post data below and did not show with ... the 3 others requests to calendar Graph API)
POST https://graph.microsoft.com/v1.0/$batch
Accept: application/json
Content-Type: application/json
{
"requests": [
{
"id": "33",
"method": "PATCH",
"url": "/me/calendars/***/events/***",
"body": {
"subject": "***",
"location": {
"displayname": "***"
},
"body": {
"content": "***"
},
"categories": ["***"],
"start": {
"dateTime": "2021-05-12 06:00:00",
"timeZone": "UTC"
},
"end": {
"dateTime": "2021-05-12 07:00:00",
"timeZone": "UTC"
},
"showAs": "free",
"isReminderOn": false,
"reminderMinutesBeforeStart": 0,
"singleValueExtendedProperties": [{
"id": "String {***} Name ***",
"value": "***"
}
]
},
"headers": {
"Content-Type": "application/json"
}
}, {
"id": "34",
...
}
]
}
This is what I seldom get (before and later on, the same id worked just fine)
{
"responses": [
{
"id": "33",
"status": 503,
"headers": {
"Content-Type": "text/html; charset=us-ascii"
},
"body":<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Service Unavailable</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Service Unavailable</h2>
<hr><p>HTTP Error 503. The service is unavailable.</p>
</BODY></HTML>
}, {
"id": "34",
"status": 200
...
}
]
}
Could you please investigate this issue and render a proper JSON response in any case, even if it fails with a 503 response?
Note: I reported this bug at https://github.com/microsoftgraph/microsoft-graph-docs/issues/12951 but none of the solution provided by the automated closing message was relevant.
I rather reported the bug to the right github repo https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/93
We are trying the JSON batching of Microsoft Graph using this request:
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/me"
},
{
"id": "2",
"method": "GET",
"url": "/me/joinedTeams"
}
]
}
We are able to get a response from /me, but not for /me/joinedTeams:
{
"responses": [
{
"id": "1",
"status": 200,
"headers": {
"Cache-Control": "no-cache",
"OData-Version": "4.0",
"Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
},
"body": {
// valid response here
}
},
{
"id": "2",
"status": 400,
"body": {
"error": {
"code": "BadRequest",
"message": "Unsupported segment type. ODataQuery: users/35036c48-1e5a-4ca4-89f0-2d11c4cf8937/joinedTeams",
"innerError": {
"request-id": "a075c4f6-362a-469f-945b-5b46d96784a0",
"date": "2018-09-12T10:09:40"
}
}
}
}
]
}
Does batching not support the Teams APIs?
Teams Graph APIs are still in Beta but you're using the /1.0 endpoint. It should work fine on the /beta endpoint.
POST https://graph.microsoft.com/beta/$batch
Accept: application/json
Content-Type: application/json
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/me"
},
{
"id": "2",
"method": "GET",
"url": "/me/joinedTeams"
}
]
}
I'm trying to get OAuth access to Uber, using Cortana's Connected account.
All necessary for authentication data, a.k.a. auth url, token url, client secret, etc. was taken from Uber API description and passed to Cortana, so she must do all low-level job for me.
But when I'm trying to login in to uber, I receving such answer:
"error": "The token response status code was not 200.",
"serviceRequest": {
"Host": "login.uber.com",
"Headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic VXF6cGVzeWVwYXFPZDBrc0FsUTh3U0dTHFvb2k6TFg0TWFhVDRwU0NFNlM3ZDJVMGJSdlU0VnJhTnRncFJPVlo4UkNqQg=="
},
"Method": "POST",
"Path": "/oauth/v2/token",
"UrlParameters": {
"redirect_uri": "https://www.bing.com/agents/oauth",
"grant_type": "authorization_code",
"code": "some code private here :)"
},
"PostData": "redirect_uri=https%3a%2f%2fwww.bing.com%2fagents%2foauth&grant_type=authorization_code&code=SOME_AUTHORIZATION_CODE"
},
"serviceResponse": {
"Headers": {
"Connection": "keep-alive",
"Pragma": "no-cache",
"X-Uber-App": "login",
"Strict-Transport-Security": "max-age=604800",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Cache-Control": "no-store",
"Date": "Sat, 28 Oct 2017 10:30:57 GMT",
"Set-Cookie": "session=421370309da06baf_59f45c61.RKb0a7144yyiV9HlZgssA5ZvSqE; Domain=login.uber.com; Secure; HttpOnly; Path=/",
"Server": "nginx",
"Content-Length": "84",
"Content-Type": "application/json"
},
"StatusCode": 400,
"ResponseData": "{\"error_description\": \"Duplicate grant_type parameter.\", \"error\": \"invalid_request\"}"
},
As you can see, in property ResponseData I have an error: Duplicate grant_type parameter.
What could it be?
Do you need to repeat the auth parameters for the token request as URL params when they are included in the POST data. I am assuming that "some code private here :)" and SOME_AUTHORIZATION_CODE are the same.
Trying to send an email through Microsoft Graph where another email from user mailbox is to be used as an attachment.
What I am doing is something similar to:
POST https://graph.microsoft.com/v1.0/me/sendMail HTTP/1.1
authorization: bearer {access_token}
content-type: application/json
content-length: 96
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [{
"emailAddress": {
"address": "garthf#a830edad9050849NDA1.onmicrosoft.com"
}
}],
"attachments": [
"#odata.type": "#Microsoft.OutlookServices.ItemAttachment",
"name": "menu.txt",
"item": {
"id": "some_id"
<!--This is the id of an existing email in User's inbox -->
}
]
},
"saveToSentItems": "false"
}
This returns with
Cannot process input of abstract type Microsoft.OutlookServices.Item
Can anyone help with suggestions?