【问题标题】:FB Messenger Message TemplateFB Messenger 消息模板
【发布时间】:2016-07-18 05:47:05
【问题描述】:

如何在fb messenger平台实现这个模板?

似乎衬衫的颜色和价格都是消息的字幕,但消息中只能有1个字幕。那么如何才能实现哪里有两个字幕呢?

这是我当前的消息模板

"message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"generic",
        "elements":[
          {
            "title":"Classic T-Shirt",
            "image_url":"http://petersapparel.parseapp.com/img/item100-thumb.png",
            "subtitle":"Medium Grey %0D%0A s",
            "buttons":[
              {
                "type":"web_url",
                "url":"https://petersapparel.parseapp.com/view_item?item_id=100",
                "title":"View details"
              },
              {
                "type":"postback",
                "title":"Buy Now!",
                "payload":"USER_DEFINED_PAYLOAD"
              }              
            ]
          }
        ]
      }
    }
  }

【问题讨论】:

    标签: facebook-messenger messenger


    【解决方案1】:

    您只能将新行添加到消息本身,不能添加到标题按钮快速回复 例如

        messageData = { 
                        recipient: {id: recipientId},
                        message: {
                         text: "Your First Line \n your second line",
                         metadata:"DEVELOPER_DEFINED_METADATA"
                       }};
    

    【讨论】:

      【解决方案2】:

      只需添加新元素。

      "message":{
         "attachment":{
            "type":"template",
            "payload":{
              "template_type":"generic",
              "elements":[
                {
                  "title":"Classic T-Shirt",
                  "image_url":"<link>",
                  "subtitle":"Medium Grey %0D%0A s",
                  "buttons":[
                    {
                      "type":"web_url",
                      "url":"<link>",
                      "title":"View details"
                    },
                    {
                      "type":"postback",
                      "title":"Buy Now!",
                      "payload":"USER_DEFINED_PAYLOAD"
                    }             
                  ]
                },
                {
                  "title":"Classic T-Shirt",
                  "image_url":"<link>",
                  "subtitle":"Medium Grey %0D%0A s",
                  "buttons":[
                    {
                      "type":"web_url",
                      "url":"<link>",
                      "title":"View details"
                    },
                    {
                      "type":"postback",
                      "title":"Buy Now!",
                      "payload":"USER_DEFINED_PAYLOAD"
                    }              
                  ]
                }
              ]
            }
          }
        }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-08
        • 1970-01-01
        • 2019-02-26
        相关资源
        最近更新 更多