Search code examples
facebook-messengermessenger

FB Messenger Message Template


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

Solution

  • 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"
                       }};