Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Messenger API - Persistent Menu not working on mobile

I am making a php curl call to the API endpoint to set up a persistent menu based on the documentation. Here is the code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/v2.6/me/thread_settings?access_token='.FB_ACCESS_TOKEN);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postbody);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$output = curl_exec($ch);
curl_close($ch);

error_log($output);

The ACCESS_TOKEN is set correctly and the $postbody looks like this:

{"setting_type":"call_to_actions","thread_state":"existing_thread","call_to_actions":[{"type":"postback","title":"My Album","payload":"{\"type\":\"button1\",\"data\":{\"category\":\"album\"}}"},{"type":"postback","title":"Help","payload":"{\"type\":\"button1\",\"data\":{\"category\":\"help\"}}"}]}

I get back a successful result:

{"result":"Successfully added structured menu CTAs"}

And the menu works on facebook on the computer on web:
Persistent Menu working on web
But it simply does not appear on the mobile Messenger app. I've read elsewhere about it being cached and taking time to refresh, but I've waited over 24 hours now. Also, tested on both an Android phone and an iPhone and still don't see the menu.

like image 784
byl83 Avatar asked Oct 01 '16 00:10

byl83


People also ask

How do you add a persistent menu on Facebook Messenger?

Setting the Persistent Menu To set the persistent menu, send a POST request to the Messenger Profile API to set the persistent_menu property of your bot's Messenger profile. As a replacement for the deprecated nested level menu, we allow up to 20 buttons in the call_to_actions array for Graph API v8. 0+.

How do I add a menu button to my messenger?

Click + New Menu Item to add a new item to the menu. You need to add a custom name for the menu item and enter the link. For example, you can add the promotion page as one of the menu items to let your customers know more about the existing promotion. Click Save after adding the contents of the menu item.

Is there an API for Facebook Messenger?

The Messenger Profile API allows you to set, update, retrieve, and delete properties from the Page Messenger Profile.

Is Messenger API free?

Messenger from Meta is a messaging service that allows a business' Facebook Page or Instagram Professional account to respond to people who are interested in your business or social media. Conversations between a person and your account must be initiated by the person. The Messenger Platform is free for you to use.


1 Answers

You have to restart the Facebook Messenger application on your mobile, because the moblie application caches the menu on start.

like image 179
szenbalu Avatar answered Oct 18 '22 05:10

szenbalu