Power Automate/Twilio:HTTP POST 错误

Power Automate / Twilio : HTTP POST Error

我不确定我搞砸了什么,但我在尝试从 Power Automate 向 Twilio Flow 发送 POST 请求时收到此错误。

能够从 PowerShell 触发 Twilio Flow,但无法在 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

这最终对我有用。

  • 将内容类型值更改为

  • application/x-www-form-urlencoded;字符集=utf-8

  • 将正文值更改为

    • 收件人=%2B12223334444&发件人=%2B15556667777

    • 12223334444 = 发送至#

    • 15556667777 = 发送自 #(Twilio Phone # 分配了流程)

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