Sending a Video
Post Data Attribute | Post Data Attribute Value Type | Description | Required |
channel_id | String | Channel ID by which the message template would be sent. | Yes |
contact_id | String | Facebook and Instagram don't have phone number so you need to send the contact id. Contact id can be received from the webhooks or contacts api. | NO |
facebook_psid | String | Facebook and Instagram don't have phone number so you need to send the contact id. Contact id can be received from the webhooks or contacts api. | NO |
instagram_psid | String | Facebook and Instagram don't have phone number so you need to send the contact id. Contact id can be received from the webhooks or contacts api. Either of contact_id/facebook_psid/instagram_psid is mandatory | NO |
facebook_payload | JSON | A JSON compatible with facebook official API documentation https://developers.facebook.com/docs/messenger-platform/instagram/features/generic-template | Yes |
curl --location --request POST '<baseAPIURl>/api/messages/send' \
--header 'X-API-Key: <API KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"channel_id": "<Channel ID>",
"contact_id": "<contact id>",
"facebook_payload": {
"attachment": {
"type": "video/image/audio",
"payload": {
"url": "<public URL of file>"
}
}
}
}'
Sending a Image with Button cards
curl --location --request POST '<baseAPIURl>/api/messages/send' \
--header 'X-API-Key: <API KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"channel_id": "<Channel ID>",
"contact_id": "<contact id>",
"facebook_payload": {
"attachment": {
"type": "template",
"payload": {
"elements": [
{
"title":"Card Title 1 (Required)",
"image_url": "<Image URL> (Optional)",
"buttons": [
{
"type": "web_url",
"url": "<URL>",
"title": "View Website"
},
{
"type": "postback",
"title": "Start Chatting",
"payload": "DEVELOPER_DEFINED_PAYLOAD"
}
]
},
{
"title":"Card Title 2",
"image_url": "<Image URL>",
"buttons": [
{
"type": "web_url",
"url": "<URL>",
"title": "View Website"
}
]
}
],
"template_type": "generic"
}
}
}
}'
Sending a text with Quick replies
curl --location --request POST '<baseAPIURl>/api/messages/send' \
--header 'X-API-Key: <API KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"channel_id": "<Channel ID>",
"contact_id": "<contact id>",
"facebook_payload": {
"text": "<SOME_TEXT>",
"quick_replies": [
{
"content_type": "text",
"title": "<TITLE_1>",
"payload": "<POSTBACK_PAYLOAD_1>"
},
{
"content_type": "text",
"title": "<TITLE_2>",
"payload": "<POSTBACK_PAYLOAD_2>"
}
]
}
}'
Note: Either of Contact_id or facebook_psid or instagram_psid is mandatory