FB Messenger Message Template

2019-04-13 07:54发布

How can I achieve this template in fb messenger platform? enter image description here

It seems that the color of the shirt and the price are both subtitles of the message but there can only be 1 subtitle in a message. So how can achieve where there are two subtitles?

This is my current message tempalate

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

2条回答
何必那么认真
2楼-- · 2019-04-13 08:04

just add new element.

"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"
              }              
            ]
          }
        ]
      }
    }
  }
查看更多
仙女界的扛把子
3楼-- · 2019-04-13 08:19

You can only add new lines to the message itself, not to titles or buttons or quick replies for ex

    messageData = { 
                    recipient: {id: recipientId},
                    message: {
                     text: "Your First Line \n your second line",
                     metadata:"DEVELOPER_DEFINED_METADATA"
                   }};
查看更多
登录 后发表回答