Facebook 持久菜单微软

Facebook persistent menu microsoft

我们正在尝试使用机器人框架在 Facebook 频道上使用持久菜单。

在此处查看文档...

我们发送的 JSON 与上面第二个 link 中的示例匹配,并且非常基础:

"persistent_menu": [
      {
        "locale": "default",
        "composer_input_disabled": true,
        "call_to_actions": [
          {
            "type": "postback",
            "title": "Help"
          },
          {
            "type": "postback",
            "title": "Home"
          }
        ]
      }
    ]

当我们将其发送到 Facebook 频道时,什么也没有发生。

有什么想法吗?提前致谢。

对于带有回调按钮的永久菜单,建议改用suggested actions。下面是一个例子:

    var reply = activity.CreateReply("I have colors in mind, but need your help to choose the best one.");
    reply.Type = ActivityTypes.Message;
    reply.TextFormat = TextFormatTypes.Plain;

    reply.SuggestedActions = new SuggestedActions()
    {
        Actions = new List<CardAction>()
        {
            new CardAction(){ Title = "Blue", Type=ActionTypes.ImBack, Value="Blue" },
            new CardAction(){ Title = "Red", Type=ActionTypes.ImBack, Value="Red" },
            new CardAction(){ Title = "Green", Type=ActionTypes.ImBack, Value="Green" }
        }
    };

试试这个

命令行:

curl -X POST -H "Content-Type: application/json" -d @persistent_menu.json "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=

{
   "persistent_menu": [
       "locale": "default",
       "composer_input_disabled": true,
       "call_to_actions": [
           {
              "title": "Title",
              "type": "postback",
              "payload "Title",
           },
           {
              "title": "Title 2",
              "type": "postback",
              "payload "Title 2",
           }
       ]
   ]
}