facebook messenger bot应用 - 永久菜单不出现 [英] facebook messenger bot app - persistent menu not appearing

查看:798
本文介绍了facebook messenger bot应用 - 永久菜单不出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个Facebook chatbot应用程序。我使用HTTP POST和有效的页面访问令牌设置了一些JSON的持久性菜单。



为了检查我是否正确设置,我做了GET请求到 https://graph.facebook.com/v2.6/me/messenger_profile?fields=persistent_menu&access_token=TOKEN 带有工作令牌。



我得到的回复是:

  {u'data' :[{u'persistent_menu':[{u'composer_input_disabled':False,
u'locale':u'en_US'},
{u'call_to_actions':[{u'call_to_actions':[ {u'payload':u'whays',
u'title':u'action1',
u'type':u'postback'},
{u'payload': u'whatever 2',
u'title':u'action2',
u'type':u'postback'}],
u'title':你的标题' ,
u'type':u'nested'},
{u'title':你的标题URL',
u'type':u'web_url',
u'url':u'http://google.com/',
u'webview_height_ratio':u'full'}],
u'composer_input_disabled':False,
u 'locale':u'default'}]}}}

目前很好。



但是,当我在iOS上打开Messenger应用程序或者在Chrome桌面Mac OS X上访问 messenger.com 时,没有任何菜单!



< img src =https://i.stack.imgur.com/p2RIv.pngalt =在此输入图像说明>



好奇地,在我的服务器上的webhook端点我也没有收到开始按钮按回发。所以这是正常的工作。



我的webhook有权限:消息,messaging_postbacks,messaging_optins,message_deliveries,message_reads / p>

我尝试过:




  • 在网页上刷新

  • 在iOS上杀死应用并重新启动

  • 删除会话并重新加载机器人

  • 等待30分钟,再次尝试所有上述li>


,没有一个工作。我的Messenger iOS应用程序中仍然看到一个加载微调器 - 也许Facebook的服务器在更新我的应用程序时速度很慢? 30分钟似乎非常极端。



我的JSON有持久的菜单设置有问题吗?这似乎是唯一可能是错误的事情。



任何想法我在做错什么?



编辑:已经返回 - 已经超过24小时,仍然没有菜单出现。

解决方案

尝试使用Postman App进行操作,并使用POST这个参数:


https://graph.facebook.com/v2.6/me/thread_settings?access_token=xxx


并填写Body this:

  {
setting_type:call_to_actions ,
thread_state:existing_thread,
call_to_actions:[
{type:web_url,
title:test,
url:https://test.com
},
{
type:postback,
title:Help,
payload:help
},
{
type:postback,
title 网站,
有效载荷:web
}
]
}

有关presistet菜单的更多信息,您可以阅读文档: https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu


I'm building a Facebook chatbot app. I've set the persistent menu with some JSON using an HTTP POST and a valid page access token.

To check I set it correctly, I do a GET request to https://graph.facebook.com/v2.6/me/messenger_profile?fields=persistent_menu&access_token=TOKEN with a working token.

The response I get is:

{u'data': [{u'persistent_menu': [{u'composer_input_disabled': False,
 u'locale': u'en_US'},
{u'call_to_actions': [{u'call_to_actions': [{u'payload': u'whatever',
     u'title': u'action1',
     u'type': u'postback'},
    {u'payload': u'whatever 2',
     u'title': u'action2',
     u'type': u'postback'}],
   u'title': u'my title',
   u'type': u'nested'},
  {u'title': u'my title URL',
   u'type': u'web_url',
   u'url': u'http://google.com/',
   u'webview_height_ratio': u'full'}],
 u'composer_input_disabled': False,
 u'locale': u'default'}]}]}

which is what I put, so all good so far.

But when I open Messenger app on iOS or visit messenger.com on Chrome desktop Mac OS X, I don't see any menu!

Curiously, on my server webhook endpoint I also DO receive the "Get Started" button press postback. So that is working.

My webhook to has permissions: messages, messaging_postbacks, messaging_optins, message_deliveries, message_reads.

I have tried:

  • Refreshing on web
  • Killing app on iOS and restarting it
  • Deleting conversation and reloading bot
  • Waiting 30 minutes and trying all of the above again

and none of those worked. I do still see a loading spinner in my Messenger iOS app - maybe Facebook's servers are just slow at updating my app? 30 minutes seems pretty extreme though.

Is there something wrong with my JSON for the persistent menu setup? That seems like the only thing that could be wrong.

Any idea what I'm doing wrong?

EDIT: Checked back - been more than 24 hours and still no menu appearing.

解决方案

Try do it using Postman App and there use POST with this params:

https://graph.facebook.com/v2.6/me/thread_settings?access_token=xxx

and fill Body this:

{
  "setting_type" : "call_to_actions",
  "thread_state" : "existing_thread",
  "call_to_actions":[
     {"type":"web_url",
      "title":"test",
      "url":"https://test.com"
     },
    {
      "type":"postback",
      "title":"Help",
      "payload":"help"
    },
    {
      "type":"postback",
      "title":"Website",
      "payload":"web"
    }
  ]
}

More about presistet menu you can read in a documentation : https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu

这篇关于facebook messenger bot应用 - 永久菜单不出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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