简体   繁体   中英

Persistent Menu and Get Started Button Microsoft Bot Framework

I'm getting to the end of the development process of my bot. I'm currently doing it in C# and the end goal of it is to be deployed on messenger. However I've run into a snag when trying to implement a "Get Started" button and a persistent menu.

The following code was from facebook's dev portal on how to add a persistent menu and I have found similar code for a Get Started button, however, starting my code up in VS Code and pasting this into a terminal, I get an error back complaining about compatibility.

Does Microsoft's bot framework automatically put this in when deploying to the messenger channel or is this code not compatible with C# ?

Thanks

  curl -X POST -H "Content-Type: application/json" -d '{
      "persistent_menu":[
        {
          "locale":"default",
          "composer_input_disabled":true,
          "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":"web_url",
              "title":"Latest News",
              "url":"http://petershats.parseapp.com/hat-news",
              "webview_height_ratio":"full"
            }
          ]
        },
        {
          "locale":"zh_CN",
          "composer_input_disabled":false
        }
      ]
    }' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=YOUR_ACCESS_TOKEN_HERE"

Creating "persistent menu" and "Get Started button" is specific to Facebook Messenger channel: it is not done through the Bot Framework but they are interesting tools to use in bot framework once they are set up.

This setup must be made with your Facebook development account. All you will have to do after is to handle in your bot code the specific payloads corresponding to your menu or your Get Started action.

So to create your menu and get started button, use your favorite API request tool (in your sample it's made for cURL) to call Facebook's API to setup those items. It has nothing to do with C# or Bot Framework, so nothing is made automatically by the framework.

If you got problems during those calls, please be more explicit about the errors you got.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM