Facebook Messenger "Get Started" 按钮未发送用户定义的负载

Facebook Messenger "Get Started" button not sending the user defined payload

我在我的页面上设置了一个 "get started" 按钮:

curl -X POST -H "Content-Type: application/json" -d '{ 
  "get_started":{
    "payload":"GET_STARTED_PAYLOAD"
  }
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=token"

这工作正常并响应 {"result":"success"}

如果我检查数据:

curl -X GET "https://graph.facebook.com/v2.6/me/messenger_profile?fields=get_started&access_token=token

我有一个很好的答案:{"data":[{"get_started":{"payload":"GET_STARTED_PAYLOAD"}}]}

但是当我收到回发 webhook 时,我得到了这个有效负载:

{
  "object": "page",
  "entry": [
    {
      "id": "id1",
      "time": 1501688073860,
      "standby": [
        {
          "recipient": {
            "id": "id1"
          },
          "timestamp": 1501688073860,
          "sender": {
            "id": "id2"
          },
          "postback": {
            "title": "Get Started"
          }
        }
      ]
    }
  ]
}

现在我可以获取我在 webhook 中定义的负载 (GET_STARTED_PAYLOAD)。

this page 上,文档说

payload parameter that was defined with the button. This is only visible to the app that send the original template message.

这条消息有点令人困惑。有什么想法吗?

把这个答案放在这里以备不时之需。

standby 属性表示您正在使用切换协议,并且应用程序没有线程控制。这会导致您收不到预期的回发事件,因为接收应用与发送回发的应用不同。