Any Way Around Facebook Bots Button Template Limit?
Asked Answered
T

4

18

It appears (undocumented) that for a button message type in the Facebook Bots chat system, there is a max of 3 buttons. This seems arbitrary and limiting. Does anyone know if there is a way to have more than 3 buttons?

To be clear, I'm referring to the following message JSON:

{
  "recipient":{
    "id":"USER_ID"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"What do you want to do next?",
        "buttons":[
          {
            "type":"web_url",
            "url":"https://petersapparel.parseapp.com",
            "title":"Show Website"
          },
          {
            "type":"postback",
            "title":"Start Chatting",
            "payload":"USER_DEFINED_PAYLOAD"
          }
        ]
      }
    }
  }
}
Thibeault answered 16/6, 2016 at 1:28 Comment(2)
No there is no way around the limitCandelabra
I would not call it arbitrary. Facebook does a lot of UX research on their products, and if they place limits on functionality, that is usually well thought through, and not just willy-nilly. They probably simply don’t want you to confuse the user with a sh*tload of buttons.Trenton
U
29

There's no way to bypass this limit. Facebook has clearly documented the limits of a generic template here:

Title: 80 characters

Subtitle: 80 characters

Call-to-action title: 20 characters

Call-to-action items: 3 buttons

Bubbles per message (horizontal scroll): 10 elements

There can be maximum 3 buttons in one bubble. you can add another bubble with 3 more buttons. For example:

{
  "recipient": {
    "id": "RECIPIENT_ID"
  },
  "message": {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "elements": [
          {
            "title": "Swipe left/right for more options.",
            "buttons": [
              {
                "type": "postback",
                "title": "Button 1",
                "payload": "button1"
              },
              {
                "type": "postback",
                "title": "Button 2",
                "payload": "button2"
              },
              {
                "type": "postback",
                "title": "Button 3",
                "payload": "button3"
              }
            ]
          },
          {
            "title": "Swipe left/right for more options.",
            "buttons": [
              {
                "type": "postback",
                "title": "Button 4",
                "payload": "button4"
              },
              {
                "type": "postback",
                "title": "Button 5",
                "payload": "button5"
              },
              {
                "type": "postback",
                "title": "Button 6",
                "payload": "button6"
              }
            ]
          }
        ]
      }
    }
  }
}

You can add maximum 10 bubbles in one generic template.

OR

You can use quick replies.

Unattended answered 28/6, 2016 at 10:40 Comment(2)
Facebook has now deleted this info from their website, so that's useful that you copied it here. thanks.Goto
@Mukarram Khalid, is it same for list? I am having problem list not display under following condition: Let say there are 10 items in elements, and each element has 1 button, but end up the list not displayLitigable
S
7

You can also use the "Quick Replies" : https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies

Quick replies allows you to display up to 11 options in buttons in a single row :

facebook quick replies

Succulent answered 24/11, 2016 at 16:54 Comment(0)
I
5

You can use botframework approach. It sends options using generic template. options part 1, options part 2

"attachment": {
    "type": "template",
    "payload": {
        "template_type": "generic",
        "elements": [{
            "title": "group of options part 1",                    
            "buttons": [ {
                "type": "postback",
                "title": "option 1",
                "payload": "option 1",
            }, ...,
            {
                "type": "postback",
                "title": "option 3",
                "payload": "option 3",
            }],
        }, ..., 
        {
            "title": "group of options 10",
            "buttons": [{
                "type": "postback",
                "title": "option 28",
                "payload": "option 28",
            }, ...,
            {
                "type": "postback",
                "title": "option 30",
                "payload": "option 30",
            }],
        }]
    }
}
Indiscipline answered 5/12, 2016 at 22:37 Comment(0)
F
0

You can try this:

 "text": msg,
        "quick_replies": [
        {

            "content_type": "text",
            "title": "What happens to my healthcare benefits?",
            "payload": "HEALTHCARE_BENEFITS"

        },
        {
            "content_type": "text",
            "title": "What happens to my service credit purchases?",
            "payload": "SERVICE_CREDIT_PURCHASE"

        },
        {
            "content_type": "text",
            "title": "Am I eligible for enhanced contributions?",
            "payload": "ENHANCED_CONTRIBUTIONS"

        },
        {
            "content_type": "text",
            "title": "What is the New Hybrid Plan?",
            "payload": "NEW_HYBRID_PLAN"

        }
    ]

    }
}
Frum answered 14/3, 2018 at 13:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.