Message Templates

Message templates offer a way for you to offer a richer in-conversation experience than standard text messages by integrating buttons, images, lists, and more alongside text a single message. Templates can be use for many purposes, such as displaying product information, asking the message recipient to choose from a pre-determined set of options, and showing search results.

Available Templates

The following templates are available for sending structured messages:

Send a Message Template

To send a message template, send a POST request to the /PAGE-ID/messages endpoint with the recipient Page-scoped ID and the message attachment containing the template type and payload containing details about the specific template, such as title, images, and more.

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"PSID"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"TEMPLATE-TYPE",
        "elements":[
          {
            "title":"TEMPLATE-TITLE",
            ...
          }
        ]
      }
    }
  }
}' "https://graph.facebook.com/v21.0/{PAGE-ID}/messages?access_token={PAGE-ACCESS-TOKEN}"

The body of the request follows a standard format for all template types, with the message.attachment.payload property containing the type and content details that are specific to each template type.

Using Buttons

Most message templates allow you to incorporate one or more buttons as part of the template. These buttons allow you to offer the message recipient actions they can take in response to the template.

The type of buttons that can be used vary by template. See the specific template reference documentation for more information.

For more on button types available in the Messenger Platform, see Buttons.