Facebook Messenger API - 400错误请求?

时间:2017-06-26 12:46:37

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

这是下面的完整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"
                     }
                  ]
               }
            ]
         }
      }
   }
}

1 个答案:

答案 0 :(得分:0)

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