Facebook Messenger API - 持续菜单无法在手机上工作 [英] Facebook Messenger API - Persistent Menu not working on mobile

查看:167
本文介绍了Facebook Messenger API - 持续菜单无法在手机上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对API端点进行php curl调用,以根据

但它根本没有出现在移动Messenger应用程序。我已经在别处阅读过它被缓存并花时间刷新,但是我已经等了24小时了。另外,在Android手机和iPhone上进行测试,仍然看不到菜单。

解决方案

您必须重新启动Facebook Messenger应用程序在您的手机上,因为移动应用程序缓存菜单开始。


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:

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.

解决方案

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

这篇关于Facebook Messenger API - 持续菜单无法在手机上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆