Persistent Menu `postback` type not working
Closed this issue · 17 comments
Followed the example mentioned in the Example(https://github.com/pimax/fb-messenger-php-example). The menu was created successfully.
The problem is the postback
is not working, did not changed anything from the example though. The
web_url
and nested
types are ok.
When i press the button i do not receive anything from the webhook.
Do you use the index.php file as backend?
Thanks for your response.
Not using exactly but in a way using the index.php as backend. For the Persistent Menu i followed the example from Readme file (https://github.com/pimax/fb-messenger-php-example/blob/master/README.md)
How do you catch the postback?
index.php
if (!empty($message['postback'])) {
$command = trim($message['postback']['payload']);
}
In this case, the bot should answer with: "Sorry. I don’t understand you."
In addition, this is the wrong repository for the issue.
I was using http://ngrok.io on my local machine and i did not receive any response after pressing the button. but all the other responses are ok even for the Persistent Menu other response types.
the issue is with the menu and on some other menu related issues you asked to look into the example redepositor, this is why i quoted here.
Have you tried an example with a web url?
Or do you get any error messages?
web_url
and nested
type are ok and working perfectly. But i do not get any response for postback
any update? did you managed to look into this?
I can't currently set the menu, and I don't know why.
The example mentioned on the Readme
file worked but the index.php
did not on the example repository. which one are you using?
both
I hope I can check this tonight!
thanks a lot
$menuItems[] = new MenuItem('postback', 'title', 'data' );
$localizedMenu[] = new LocalizedMenu('default', false, $menuItems);
$bot->setPersistentMenu($localizedMenu);
Example in https://github.com/pimax/fb-messenger-php-example/blob/master/index.php should work now.
Solved?
thank you it is solved.