Persistent menu not showing in Facebook Messenger chat bot

孤街浪徒 提交于 2019-12-11 12:24:56

问题


As I don't know why suggested, using Postman.

Per docs, have succesfully POSTed the configuration to facebook APIs:

which is not supposed to be anyways locale specific. Even I don't see here

Localization: Developers can now provide text in multiple languages (or entirely different menus) for each local your bot's users may come from.

Like my brother, I have tried almost everything so far

This looks like some crazy bug. Is there some work around to add a simplest persistent menu?


回答1:


Wasted 2 hours on this issue. Until I realised you have to delete the conversation then refresh facebook with ignore cache (ctrl+shift+r in chrome) and then it will show.




回答2:


The FB API document states that the API link to hit for applying persistent menu to the page specific bot is:

https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>

Notice the me after version number i.e v2.6 in this specific case. However, this did not worked for a lot of people

There is small change in the API link to hit:

graph.facebook.com/v2.6/Page ID/messenger_profile?access_token=PAGE ACCESS TOKEN

Notice that me is replaced with the fb Page Id.

And the sample payload can still be the same:

{
  "get_started": {
    "payload": "Get started"
  },
  "persistent_menu": [
    {
      "locale": "default",
      "composer_input_disabled": false,
      "call_to_actions": [
        {
          "title": "Stop notifications",
          "type": "nested",
          "call_to_actions": [
            {
              "title": "For 1 week",
              "type": "postback",
              "payload": "For_1_week"
            },
            {
              "title": "For 1 month",
              "type": "postback",
              "payload": "For_1_month"
            },
            {
              "title": "For 1 year",
              "type": "postback",
              "payload": "For_1_year"
            }
          ]
        },
        {
          "title": "fresh jobs",
          "type": "postback",
          "payload": "fresh jobs"
        },
        {
          "title": "More",
          "type": "nested",
          "call_to_actions": [
            {
              "title": "like us",
              "type": "web_url",
              "url": "https://www.facebook.com/nordible/"
            },
            {
              "title": "blog",
              "type": "web_url",
              "url": "http://xameeramir.github.io/"
            }
          ]
        }
      ]
    }
  ]
}

Notice that it is mandatory to configure get_started button before setting up the persistent_menu.



来源:https://stackoverflow.com/questions/46749142/persistent-menu-not-showing-in-facebook-messenger-chat-bot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!