任何方式Facebook机器人按钮模板限制?

nic*_*ona 15 facebook chat bots button messenger

看来(未记录)对于Facebook Bots聊天系统中的按钮消息类型,最多有3个按钮.这似乎是武断和限制的.有谁知道有没有办法超过3个按钮?

要清楚,我指的是以下消息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"
          }
        ]
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

Muk*_*lid 24

没有办法绕过这个限制.Facebook已经清楚地记录一个通用模板的界限在这里:

标题:80个字符

副标题:80个字符

号召性用语标题:20个字符

号召性用语:3个按钮

每条消息的气泡(水平滚动):10个元素

一个气泡中最多可以有3个按钮.你可以用另外3个按钮添加另一个气泡.例如:

{
  "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"
              }
            ]
          }
        ]
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

您可以在一个通用模板中添加最多10个气泡.

要么

您可以使用快速回复.


小智 6

您还可以使用"快速回复":https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies

快速回复允许您在一行按钮中最多显示11个选项:

facebook快速回复


小智 5

您可以使用botframework方法。它使用通用模板发送选项。 选项第1部分选项第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",
            }],
        }]
    }
}
Run Code Online (Sandbox Code Playgroud)