Facebook Messenger API - Persistent Menu not working on mobile
Asked Answered
B

1

6

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.

Bloodworth answered 1/10, 2016 at 0:1 Comment(6)
Doh, never mind, it seems that shortly after I made the post, the cache somehow cleared, and it's working on mobile. This is the correct code, after all. It just took a little over 24 hours for the cache to clear.Bloodworth
So it was just an issue with the mobile app not updating? I've experienced this before but only for short amounts of time. Do you know what caused it to refresh? Might just need to restart the app, but I'm not sureParsaye
hey byl83, I'm facing simillar issue. I do not even see it on facebook on computer. It has been > 24 hours. Any ideas how to debug ? Do I need to test it with a new user or will it appear even with an existing conversation. (I restarted my phone & browser - in case, some caching might be affecting it)Pearlinepearlman
Hi rajkiran, just saw your comment. On facebook on pc, it should appear immediately or very soon after. You do not need to test it with a new user. It appears in existing conversations too.Bloodworth
on PC's browsers, I usually delete the conversation, refresh the page, then start again to get the latest menu. it always works.Chinkapin
Same, happening here. Noted, let me wait and see if the phone cache clears.Auricle
M
2

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

Mirthless answered 15/5, 2017 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.