My facebook Chatbot's persistent menu was working fine until a few days ago, once in every few tries when I click on a persistent menu item it would raise a popup error : Action Unsuccessful There was an error delivering your message to the bot. Please try again later.
This happens sporadically, and I checked that when this happens my PHP code's side didn't receive any postback from facebook. When there's no error the postback works fine. Is anyone else getting this error?
My Persistent menu is setup as such:
//-----------Persistent Menu
$url = 'https://graph.facebook.com/v2.6/me/messenger_profile?access_token='.$access_token;
$ch = curl_init($url);
$jsonData = '{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled": false,
"call_to_actions":[
{
"title":"View in Chinese",
"type":"postback",
"payload":"mainMenu"
},
{
"title":"View in English",
"type":"postback",
"payload":"mainMenuEN"
}
]
},
{
"locale":"zh_TW",
"composer_input_disabled": false,
"call_to_actions":[
{
"title":"View in Chinese",
"type":"postback",
"payload":"mainMenu"
},
{
"title":"View in English",
"type":"postback",
"payload":"mainMenuEN"
}
]
},
{
"locale":"en_US",
"composer_input_disabled": false,
"call_to_actions":[
{
"title":"View in Chinese",
"type":"postback",
"payload":"mainMenu"
},
{
"title":"View in English",
"type":"postback",
"payload":"mainMenuEN"
}
]
}
]
}';
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
I had the same problem. It was fixed by the following changes:
App settings -> [Products] Messenger -> Settings -> Webhooks -> Edit events -> Add messaging_postbacks
You may have forgotten to add the event and FB is not allowed to send any buttons' postback / payload to the server.
Check thoroughly if the type of the buttons is correctly specified as one of the following: web_url
or postback
in lower case.
Have in mind also that the persistent menu requires pages_messaging permission
according to FB Developers Doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With