skip to Main Content

I want to use nested menus for a Facebook bot, but the new API to set the persistent menu does not work.

Even if I remove the nested menu, Facebook returns “success” but the Facebook page does not show the menu.

If I use the old API on thread_settings, then it works. But using the new API I get no menu at all. The new API works for the getting started button, but not the menu.

I have tried everything, and have no idea why it is not working. It returns success but no menu. I am setting the getting started button too.

curl -X POST -H "Content-Type: application/json" -d '{
  "persistent_menu":[
    {
    "locale":"default",
    "composer_input_disabled":false,
    "call_to_actions":[
        {
          "type":"web_url",
          "title":"Test",
          "url":"https://facebook.com"
        }
      ]
    }
  ]
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token={{token}}"

4

Answers


  1. I have tried it and it works.
    checkout the code here

    You can try the bot here: https://www.facebook.com/nautankibot/

    I will have to add you as tester if you want to use this bot as its not public.

    Screenshot of nested menu in the bot:

    screenshot of nested menuenter image description here

    It works on fb messenger app as well.

    In the above curl call you have not set the type as “nested” in call_to_actions

    The above example is taken from fb documentation for menus

    Login or Signup to reply.
  2. I found that the Graph API Explorer gave me alot more success than the curl commands.

    Just select the page you are posting to in the “Get Token” menu.
    Set to Post to me/messenger_profile,
    add field name as “persistent_menu”,
    and the value as your json array.

    It will tell you if anything is wrong with your post.

    your json should look something like this for nested.

    [
      {
        "locale":"default",
        "composer_input_disabled":false,
        "call_to_actions":
        [
    
          {
            "title":"Menu",
            "type":"nested",
            "call_to_actions":
            [
              {
                "title":"Home",
                "type":"postback",
                "payload":"PHome"
              },
              {
                "title":"Back",
                "type":"postback",
                "payload":"PBack"
              }
            ]
          },
          {
            "title":"Other",
            "type":"nested",
            "call_to_actions":
            [
              {
                "type":"web_url",
                "title":"View Website",
                "url":"https://www.facebook.co.za",
                "webview_height_ratio":"full"
              }
            ]
          }
        ]
      },
    ]
    
    Login or Signup to reply.
  3. Graph API Explorer also worked for me.

    I made a mess trying to delete the persistent menu via CURL. (I love terminal). It was easy to resolve using the Explorer.

    Just remembering:
    screenshot using Graph API Explorer

    Login or Signup to reply.
  4. you can use this format fb v8

    {
    "locale": "default",
    "composer_input_disabled": false,
    "call_to_actions": [
    {
    "type": "postback",
    "title": "🔰 عرض بالتصنيفات ",
    "payload": "Category"
    },

            {
              "type": "postback",
              "title": "🛒 عرض اخر اوردر",
              "payload": "PAYBILL_PAYLOAD"
            },
            {
              "type": "postback",
              "title": "💝 عرض المفضلة",
              "payload": "HISTORY_PAYLOAD"
            },
            {
              "type": "postback",
              "title": "📝 الفاتورة كام",
              "payload": "CONTACT_INFO_PAYLOAD"
            },
        
            {
              "type": "postback",
              "title": "💥 عرض الجديد",
              "payload": "WisNew"
            },
            {
              "type": "web_url",
              "title": "📺 فتح القناة",
              "url": "https://www.t.me/jmllaa",
              "webview_height_ratio": "full"
            },
            {
              "type": "postback",
              "title": "🎀 كوبون خصم",
              "payload": "CONTACT_INFO_PAYLOAD"
            }
          ]
       
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search