default_action object that sets a URL that is opened in the Messenger webview when the template is tapped.elements array of the payload.https://graph.facebook.com/v25.0/me/messages?access_token={PAGE_ACCESS_TOKEN}| Property | Type | Description |
|---|---|---|
template_type | String | Must be generic. |
elements | Array | An array of element objects that describe each item. Maximum of 10 elements. |
sharable | Boolean | Optional. Set to true to enable the native share button in Messenger for the template message. Defaults to false. |
element propertiestitle.| Property | Type | Description |
|---|---|---|
title | String | The title to display in the template. 80 character limit. |
subtitle | String | Optional. The subtitle to display in the template. 80 character limit. |
image_url | String | Optional. The URL of the image to display in the template. |
default_action | Object | Optional. The default action executed when the template is tapped. Accepts the same properties as URL button, except title. |
buttons | Array | Optional. An array of buttons to append to the template. Maximum of 3 buttons per element. |
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Welcome!",
"image_url":"https://raw.githubusercontent.com/fbsamples/original-coast-clothing/main/public/styles/male-work.jpg",
"subtitle":"We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://www.originalcoastclothing.com/",
"webview_height_ratio": "tall"
},
"buttons":[
{
"type":"web_url",
"url":"https://www.originalcoastclothing.com/",
"title":"View Website"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
}
}
}' "https://graph.facebook.com/v25.0/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
{
"recipient_id": "1254477777772919",
"message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}