elements array will send a horizontally scrollable carousel of items, each composed of an image, text and buttons. For complete implementation details, see Generic Template.title and subtitle fields for all formats. You can add {{first_name}}, {{last_name}}, and {{full_name}} into your title and subtitle strings to enable personalized marketing messages. For example, the title field may read as "New sale for you, {{first_name}}!". For a user named John Doe, the rendered message title will be "New sale for you, John!".title and subtitle field of each element in the elements field.media_type to image (this is the default if not set). These links need to lead to an image file and don’t have to facebook URLs.{ "message_id": "<MESSAGE_ID>", "messenger_delivery_data": { "subscription_token": "<SUBSCRIPTION_TOKEN>" }, "message":{ "attachment":{ "type":"template", "payload":{ "template_type":"generic", "elements":[ { "title":"Welcome!", "image_url":"<IMAGE_URL>", "subtitle":"We have the right hat for everyone.", "buttons":[ { "type":"web_url", "url":"<BUTTON_URL>", "title":"View Website" },{ "type":"postback", "title":"Start Chatting", "payload":"<PAYLOAD_WEBHOOK>" } ] } ] } } } }
app and provide deeplink url for ios and android apps.{ "message_id": "<MESSAGE_ID>", "messenger_delivery_data": { "subscription_token": "<SUBSCRIPTION_TOKEN>" }, "message":{ "attachment":{ "type":"template", "payload":{ "template_type":"generic", "elements":[ { "title":"Welcome!", "image_url":"<IMAGE_URL>", "subtitle":"We have the right hat for everyone.", "buttons":[ { "type":"web_url", "url":"<BUTTON_URL>", "title":"View Website" },{ "type":"app", "android_url":"<ANDROID_APP_DEEPLINK_URL>", "ios_url":"<IOS_APP_DEEPLINK_URL>" } ] } ] } } } }
video_id field and setting media_type to video. This video id can be retrieved from the URI when clicking on a video on facebook.{ "message_id": "<MESSAGE_ID>", "messenger_delivery_data": { "subscription_token": "<SUBSCRIPTION_TOKEN>" }, "message":{ "attachment":{ "type":"template", "payload":{ "template_type":"generic", "elements":[ { "title":"Welcome!", "media_type": "video", "video_id":"<VIDEO_ID>", "subtitle":"We have the right hat for everyone.", "buttons":[ { "type":"web_url", "url":"<BUTTON_URL>", "title":"View Website" } ] } ] } } } }
{ "message_id": "<MESSAGE_ID>", "messenger_delivery_data": { "subscription_token": "<SUBSCRIPTION_TOKEN>" }, "message":{ "attachment":{ "type":"template", "payload":{ "template_type":"generic", "elements":[ { "title":"Welcome!", "image_urls":[ { "url":"<IMAGE_URL>", "is_hero_image":"true" }, { "url":"<IMAGE_URL>", }, ], "subtitle":"We have the right hat for everyone.", "buttons":[ { "type":"web_url", "url":"<BUTTON_URL>", "title":"View Website" },{ "type":"postback", "title":"Start Chatting", "payload":"<PAYLOAD_WEBHOOK>" } ] } ] } } } }
image_url or image_urls"is_hero_image":"true""payload": { "template_type":"generic", "elements":[ <GENERIC_TEMPLATE>, <GENERIC_TEMPLATE>, ... ] }
text field to your generic template payload:{
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"text": "Hello! Welcome to our store.", "elements": [...]
}
}
}
}
{{first_name}}, {{last_name}}, and {{full_name}} macros into your text string to enable personalized greetings for users.| Namespace | Name | Code | Description |
|---|---|---|---|
MARKETING_MESSAGES_DIRECT | VIDEO_MEDIA_TYPE_MISSING_VIDEO_ID | 2300021 | When media_type is ‘video’, a video_id must be provided. |
MARKETING_MESSAGES_DIRECT | IMAGE_MEDIA_TYPE_MISSING_IMAGE_URL | 2300022 | When media_type is ‘image’, an image_url must be provided. |
MARKETING_MESSAGES_DIRECT | INVALID_BUTTON_TYPE | 2300023 | The button type is invalid. Valid button types are: web_url. |
MARKETING_MESSAGES_DIRECT | EMPTY_BUTTON_URL | 2300024 | Button URL cannot be empty when provided. |
MARKETING_MESSAGES_DIRECT | EMPTY_BUTTON_TITLE | 2300025 | Button title cannot be empty. |
MARKETING_MESSAGES_DIRECT | TOO_MANY_BUTTONS | 2300026 | Too many buttons provided. Maximum of 3 buttons are allowed per message. |