RPE-PeterD
RPE-PeterD

Reputation: 46

Power Automate / Twilio : HTTP POST Error

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

Upvotes: 2

Views: 809

Answers (1)

RPE-PeterD
RPE-PeterD

Reputation: 46

This ended up working for me.

http_req_post_2

  • 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"
        }
    }
}

Upvotes: 1

Related Questions