Search code examples
facebookfacebook-messenger

Facebook Messenger API Error: Payload cannot be empty for postback type button


I successfully set up Greeting Text, and now I trying to set up a payload for a Get Started button by this guide:

I send exactly:

 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" 

but receive an error:

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

What i do wrong?


Solution

  • Finally, I found my mistake. CBroe said I was wrong in request structure.

    I used PHP and sent:

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

    But right form is:

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