【问题标题】:Any Way Around Facebook Bots Button Template Limit?Facebook Bots 按钮模板限制有什么办法吗?
【发布时间】:2016-10-17 08:03:57
【问题描述】:

似乎(未记录)对于 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"
          }
        ]
      }
    }
  }
}

【问题讨论】:

  • 不,没有办法绕过限制
  • 我不会称其为任意。 Facebook 对他们的产品进行了大量的用户体验研究,如果他们对功能进行限制,那通常是经过深思熟虑的,而不仅仅是随意的。他们可能只是不想让你用一堆按钮混淆用户。

标签: facebook button chat bots messenger


【解决方案1】:

没有办法绕过这个限制。 Facebook 已经清楚地记录了通用模板 here 的限制:

标题: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 个气泡。

您可以使用quick replies

【讨论】:

  • Facebook 现已从他们的网站上删除了此信息,因此您将其复制到此处很有用。谢谢。
  • @Mukarram Khalid,list 也一样吗?我在以下情况下遇到问题列表不显示:假设元素中有 10 个项目,每个元素有 1 个按钮,但最终列表不显示
【解决方案2】:

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

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

【讨论】:

    【解决方案3】:

    您可以使用 botframework 方法。它使用通用模板发送选项。 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",
                }],
            }]
        }
    }
    

    【讨论】:

      【解决方案4】:

      你可以试试这个:

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

      【讨论】:

        猜你喜欢
        • 2016-08-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-05
        • 1970-01-01
        • 2021-07-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多