【问题标题】:Facebook Messenger API - 400 Bad Request?Facebook Messenger API - 400 错误请求?
【发布时间】:2017-06-27 03:10:10
【问题描述】:

这是下面的完整 JSON,我使用 Facebook 的通用模板发送。

我已经逐行检查了这里的官方文档 -> https://developers.facebook.com/docs/messenger-platform/send-api-reference/generic-template

但我收到以下内容的 400 错误请求错误。我错过了什么?

{  
   "recipient":{  
      "id":"1347939335300515"
   },
   "message":{  
      "attachment":{  
         "type":"template",
         "payload":{  
            "template_type":"generic",
            "elements":[  
               {  
                  "title":"Welcome to Peters Hats",
                  "image_url":"https://cdn.pixabay.com/photo/2013/07/13/10/41/hat-157581_960_720.png",
                  "subtitle":"Weve got the right hat for everyone.",
                  "default_action":{  
                     "type":"web_url",
                     "url":"https://cdn.pixabay.com/photo/2013/07/13/10/41/hat-157581_960_720.png",
                     "messenger_extensions":true,
                     "webview_height_ratio":"tall",
                     "fallback_url":"https://cdn.pixabay.com/photo/2013/07/13/10/41/hat-157581_960_720.png"
                  },
                  "buttons":[  
                     {  
                        "type":"web_url",
                        "url":"https://cdn.pixabay.com/photo/2013/07/13/10/41/hat-157581_960_720.png",
                        "title":"View Website"
                     },
                     {  
                        "type":"postback",
                        "title":"Start Chatting",
                        "payload":"DEVELOPER_DEFINED_PAYLOAD"
                     }
                  ]
               }
            ]
         }
      }
   }
}

【问题讨论】:

  • “我错过了什么?” - 这样的 HTTP 状态代码通常伴随着包含错误消息的响应正文 ...

标签: facebook facebook-messenger facebook-messenger-bot


【解决方案1】:

default_action 是一个 URL 按钮,而不应该是问题中发布的 JSON 中的回发按钮。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-11
    • 1970-01-01
    • 2022-01-04
    • 2020-11-13
    相关资源
    最近更新 更多