0

我正在使用 botkit 来构建我的机器人。我第一次验证我的 webhook 时,存在的持久菜单是一个示例:

controller.api.thread_settings.menu([
        {
            "type":"postback",
            "title":"Hello",
            "payload":"hello"
        },
        {
            "type":"postback",
            "title":"Help",
            "payload":"help"
        },
        {
          "type":"web_url",
          "title":"Botkit Docs",
          "url":"https://github.com/howdyai/botkit/blob/master/readme-facebook.md"
        },
    ]);

我将持久菜单更改为:

controller.api.thread_settings.menu([
        {
            "type":"postback",
            "title":"Account",
            "payload":"account"
        },
        {
            "type":"postback",
            "title":"News",
            "payload":"news"
        },
        {
            "type": "postback",
            "title": "Contact",
            "payload": "contact"
        },
    ]);

但是已经3天没有改变我的设置了。我想了解什么是错误的,facebook messenger 何时更新菜单?我什至尝试使用 curl 删除和添加持久菜单,但没有任何效果。

4

2 回答 2

2

您必须删除对话线程并重新开始才能看到更改生效。

此外,FB 为此更改了有效负载结构,您需要设置语言环境,并将菜单项放入call_to_actions数组中。

 controller.api.thread_settings.menu([
       { "locale": "default",
         "compose_input_disabled": false,
         "call_to_actions": [
           {
          "title":"My Account",
          "type":"nested",
          "call_to_actions":[
            {
              "title":"Pay Bill",
              "type":"postback",
              "payload":"PAYBILL_PAYLOAD"
            },
            {
              "title":"History",
              "type":"postback",
              "payload":"HISTORY_PAYLOAD"
            },
            {
              "title":"Contact Info",
              "type":"postback",
              "payload":"CONTACT_INFO_PAYLOAD"
            }
          ]
        },
        {
            "type":"postback",
            "title":"Help",
            "payload":"help"
        },
        {
          "type":"web_url",
          "title":"Botkit Docs",
          "url":"https://github.com/howdyai/botkit/blob/master/readme-facebook.md"
        }
      ]
        }

    ]);
于 2017-04-28T00:25:37.637 回答
1

您需要这 2 个方法:removePersistentMenu 和 addPersistentMenu。

https://github.com/matthewericfisher/fb-robot/blob/master/app.js

请耐心等待,这可能需要一分钟,请检查您的控制台以获取响应。

您还需要在 facebook messenger 中删除您与机器人的对话。

于 2017-09-04T14:25:19.163 回答