The Persistent Menu

New feature

On December 04, 2019 we made improvements to the persistent menu to support dynamic changes at the user level to further personalize the conversational experience.

During F8 2019, we announced our plans to launch a lighter, better and simpler Messenger designed to build closer connections between people and businesses.

Starting August 15, 2019, updated versions of the Messenger app will no longer support Nested menu. To create a more seamless experience for people on Messenger, we are transitioning from nested persistent menu to a single layer menu format, For Pages set with nested menu items they will render as a flat list. We believe this will create an even better experience for people on Messenger. Refer to June 10, 2019 Announcement

The persistent menu allows you to have an always-on user interface element inside Messenger conversations. This is an easy way to help people discover and access the core functionality of your Messenger bot at any point in the conversation.

Contents

Requirements

For the persistent menu to appear, the following must be true:

  • The person must be running Messenger v106 or above on iOS or Android.
  • The Facebook Page the Messenger bot is subscribe to must be published.
  • The Messenger bot must be set to "public" in the app settings.
  • The Messenger bot must have the pages_messaging permission.
  • The Messenger bot must have a get started button set.

Supported Buttons

The persistent menu is composed of an array of buttons. The following button types are supported in the persistent menu:

Setting the Persistent Menu

To set the persistent menu, send a POST request to the Messenger Profile API to set the persistent_menu property of your bot's Messenger profile.

The property should include an array of objects with a set of up to 3 buttons to include in the menu in a call_to_actions array.

{
    "persistent_menu": [
        {
            "locale": "default",
            "composer_input_disabled": false,
            "call_to_actions": [
                {
                    "type": "postback",
                    "title": "Talk to an agent",
                    "payload": "CARE_HELP"
                },
                {
                    "type": "postback",
                    "title": "Outfit suggestions",
                    "payload": "CURATION"
                },
                {
                    "type": "web_url",
                    "title": "Shop now",
                    "url": "https://www.originalcoastclothing.com/",
                    "webview_height_ratio": "full"
                }
            ]
        }
    ]
}

Disabling the Composer

You may disable the composer to make the persistent menu the only way for a person to interact with your Messenger bot. This is useful if your bot has a very specific purpose or set of options.

To do this, set "composer_input_disabled":true when you create the persistent menu.

Localization

You may provide default and localized button text for the persistent menu that will be displayed based on a person's locale.

To do this, specify a separate object in the persistent_menu array for each locale. To specify the locale for each object, set the locale property to a supported locale:

{
  "locale":"default",
  "call_to_actions":[...]
},
{
  "locale: "zh_CN",
  "call_to_actions":[...]
}

User level menu

New feature

On December 04, 2019 we made improvements to the persistent menu to support dynamic changes to further personalize the conversational experience.

You can override the Page level persistent menu with a user level setting. This allows your app to dynamically control:

  • The click to action buttons on the menu for the user.
  • The visibility of the composer for the user.

To enable or disable the user level setting a different endpoint called custom_user_settings is used. This endpoint supports POST, GET and DELETE calls.

The same configurations available for the Page level persistent menu apply at user level. The main difference is that a psid param is needed to indicate the user that this override applies to.

The user level settings are rate limited to 10 calls per user per 10 min.

Example of POST Request

This will override the current page level settings for this user.

curl -X POST -H "Content-Type: application/json" -d '{
  "psid": "<PSID>",
  "persistent_menu": [
        {
            "locale": "default",
            "composer_input_disabled": false,
            "call_to_actions": [
                {
                    "type": "postback",
                    "title": "Talk to an agent",
                    "payload": "CARE_HELP"
                },
                {
                    "type": "postback",
                    "title": "Outfit suggestions",
                    "payload": "CURATION"
                },
                {
                    "type": "web_url",
                    "title": "Shop now",
                    "url": "https://www.originalcoastclothing.com/",
                    "webview_height_ratio": "full"
                }
            ]
        }
    ]
}' "https://graph.facebook.com/v5.0/me/custom_user_settings?access_token=<PAGE_ACCESS_TOKEN>"

Example of GET Request

This will retrieve the current user and page level settings. If there are no user level settings only the page level ones will return.

curl -X GET "https://graph.facebook.com/v5.0/me/custom_user_settings?psid=<PSID>&access_token=<PAGE_ACCESS_TOKEN>"

Result

{
    "data": [
      {
        "user_level_persistent_menu": [
            {
              "locale": "default",
              "composer_input_disabled": false,
              "call_to_actions": [
                  {
                      "type": "postback",
                      "title": "Talk to an agent",
                      "payload": "CARE_HELP"
                  },
                  {
                      "type": "postback",
                      "title": "Outfit suggestions",
                      "payload": "CURATION"
                  },
                  {
                      "type": "web_url",
                      "title": "Shop now",
                      "url": "https://www.originalcoastclothing.com/",
                      "webview_height_ratio": "full"
                  }
              ]
            }
        ],
        "page_level_persistent_menu": [
          Original Page Menu...
        ]  
      }
  ]
}

Example of DELETE Request

This will remove the user level settings, leaving the Page level menu if set.

curl -X DELETE 'https://graph.facebook.com/v5.0/me/custom_user_settings?psid=<PSID>&params=[%22persistent_menu%22]&access_token=<PAGE_ACCESS_TOKEN>'

Best Practices

Like buttons, menu items can produce a webview or postback. They can also drill down to a second-level menu. Your menu is the same for all users of your bot: you can't make per-user changes or change it in real time.

Use the menu for entry points into your bot's functionality.

Be descriptive: your menu lets people know what your bot can do. It instantly lets users know what they can reach for your bot for in the future.

Use sub-menus and hierarchy that match your user's mental model of your functionality.

Don't expect the menu to contain user-specific data: it's the same for everyone who uses your bot, though it can be localized.

Don't put a "Menu" button in the menu that sends the user a message containing a menu. Just put that content directly in the menu — that's what it's for!

Don't put generic actions like "Restart" in the menu.

Don't use prime menu real estate for secondary, "colophon" style info like about, terms of service, privacy policy, or "powered by", neglecting to expose your bot's main functionality. If you want to include these items, consider placing them in a sub-menu.