Facebook Messenger API错误:对于回发类型按钮,有效负载不能为空

时间:2016-08-03 12:26:23

标签: facebook facebook-messenger

我成功设置了问候语文本,现在我尝试通过此guide为“入门”按钮设置有效负载:

我发送的确是:

 curl -X POST -H "Content-Type: application/json" -d '{
  "setting_type":"call_to_actions",
  "thread_state":"new_thread",
  "call_to_actions":[
    {
      "payload":"START"
    }
  ]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN" 

但收到错误:

{"error":{"message":"(#100) Payload cannot be empty for postback type button","type":"OAuthException","code":100,"fbtrace_id":"GWv5XughbUQ"}}

我做错了什么?

1 个答案:

答案 0 :(得分:1)

最后,我发现了自己的错误。 CBroe说我的请求结构错了。

我使用PHP并发送:

$requset = [
    'call_to_actions' =>  [
       'payload' =>  'START'
    ],
    'setting_type' => 'call_to_actions',
    'thread_state' => 'new_thread'
];

但正确的形式是:

$requset = [
        'call_to_actions' =>  [
           ['payload' =>  'START']
        ],
        'setting_type' => 'call_to_actions',
        'thread_state' => 'new_thread'
    ];