有没有绕过Facebook机器人按钮模板限制的方法?

18

在Facebook机器人聊天系统中,似乎(未经记录)对于按钮消息类型,最多只有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"
          }
        ]
      }
    }
  }
}

2
没有任何方法可以规避这个限制。 - WizKid
我不会称其为武断。Facebook 对其产品进行了大量的用户体验研究,如果他们对功能设置限制,那通常都是经过深思熟虑的,而不是随意的。他们可能只是不想让你用一堆按钮来困扰用户。 - CBroe
4个回答

29

无法绕过此限制。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"
              }
            ]
          }
        ]
      }
    }
  }
}

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

或者

您可以使用快捷回复


Facebook现在已经从他们的网站上删除了这些信息,所以你在这里复制它是很有用的。谢谢。 - user6269864
@Mukarram Khalid,对于列表也是一样的吗?我遇到了一个问题,就是在以下情况下列表不显示: 假设有10个元素,在每个元素中都有1个按钮,但最终列表没有显示。 - crispy

7

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",
            }],
        }]
    }
}

0
你可以尝试这个:
 "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"

        }
    ]

    }
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接