Reputation: 175
I have a very interesting and annoying issue. I build a Facebook messenger bot ... everything worked fine. I have a webhook connected to my NodeJS server. Again everything is fie till I got to the "final touch" of the project, the Persistent Menu.
I added a Persistent Menu with the following command
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type" : "call_to_actions",
"thread_state" : "existing_thread",
"call_to_actions":[
{
"type":"postback",
"title":"Estimate an app cost",
"payload":"startEstimation"
},
{
"type":"postback",
"title":"Get in touch",
"payload":"getInTouch"
},
{
"type":"web_url",
"title":"View Website",
"url":"http://whatever.com"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=BLA"
Again here everything worked fine I even got the {"result":"Successfully added structured menu CTAs"}
answer and now I HAVE MY MENU. The only problem is that when I click one of the postback buttons .. nothing happens.
Facts:
I made my sever to print some logs on the first line of the post api:
app.post('/webhook', (req, res) => { console.log("Smth came frm the hook =>", req.body);
-> It works if I post with Postman. It works for the buttons inside the conversation when I have a button with a postback I get the answer BUT FOR THE MENU IT DOES NOTHING. I don't get any logs at all. Like Facebook never triggers my hook.
In the Page Subscription Fields I added all of them .. that's how desperate the situation is lol.
Everything else with the bot works fine. Any other button/text messages/postbacks work just fine.
My code is forked from here: https://github.com/api-ai/api-ai-facebook and this is the webhook https://github.com/api-ai/api-ai-facebook/blob/master/src/app.js#L431
What on Earth could I miss ?
Upvotes: 1
Views: 1971
Reputation: 1738
Checkout new Persistent menu requirements.
https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu
It has changed a little bit (especially POST request), so probably that's the problem.
Upvotes: 2