Facebook持久菜单微软

时间:2017-06-19 12:43:06

标签: botframework facebook-messenger-bot

我们正试图通过机器人框架在Facebook渠道上运行持久性菜单。

请参阅此处的文档...

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

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

当我们将此信息发送到Facebook频道时,根本没有任何反应。

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

2 个答案:

答案 0 :(得分:0)

对于带回调按钮的持久性菜单,建议使用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" }
        }
    };

答案 1 :(得分:0)

试试这个

命令行:

  

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",
           }
       ]
   ]
}