pimax/fb-messenger-php

Issue with Persistent Menu `postback` type

Closed this issue · 1 comments

As i reported earlier at #105, the Persistent Menu postback type is not working. I followed the following approaches and none of these worked. are these working for you and am i the only one who is facing this issue?

I can set the menu and TYPE_NESTED and TYPE_WEB are working perfectly.

$menuItems[] = new MenuItem('postback', 'title', 'data' );
$localizedMenu[] = new LocalizedMenu('default', false, $menuItems);
$bot->setPersistentMenu($localizedMenu);
$bot->setPersistentMenu([
    new LocalizedMenu('default', false, [
        new MenuItem(MenuItem::TYPE_NESTED, 'My Account', [
            new MenuItem(MenuItem::TYPE_NESTED, 'History', [
                new MenuItem(MenuItem::TYPE_POSTBACK, 'History Old', 'HISTORY_OLD_PAYLOAD'),
                new MenuItem(MenuItem::TYPE_POSTBACK, 'History New', 'HISTORY_NEW_PAYLOAD')
            ]),
            new MenuItem(MenuItem::TYPE_POSTBACK, 'Contact Info', 'CONTACT_INFO_PAYLOAD')
        ])
    ])
]);

i found the issue. I was filtering the messaging subscription event and some of the subscription was removed.
to receive the postback of the persistent menu messaging_postbacks needed to be subscribed.