Sending a Template Message with image/video
Post Data Attribute | Post Data Attribute Value Type | Description |
channel_id | String | Channel ID by which the message template would be sent. |
contact_details | JSON | All the values would be put into contact details when creating contacts e.g. { city : "xxx", country: "yyy", tags : ["tag1", "tag2"] } |
phone_number | String | Phone number with country code example 852967XXYYY (Country code 852 Stands for HongKong) 91897889XXXX (Country code 91 stands for India) |
template | JSON | Entire Template JSON. Various Template JSON types are described below. |
dontShowInChatList (optional) | boolean default - false | true -> These msg would not change the contact order in chat screen false -> These msg will change the contact order in chat screen |
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>",
"dontShowInChatList": false,
"phone_number": "<Phone Number with Country Code>",
"template": {
"namespace":"<WABA Namespace>",
"name":"<template Name>",
"language":{
"policy":"deterministic",
"code":"<template language>"
},
"components":[
{
"type":"header",
"parameters":[
{
"type":"image/video",
"image/video":{
"link":"<file absolute public url>"
}
}
]
},
{
"type":"body",
"parameters":[
{
"type":"text",
"text":"placeholder1 data"
},
{
"type":"text",
"text":"placeholder2 data"
},
{
"type":"text",
"text":"placeholder3 data"
}
]
}
]
}
}'
Sending a Template Message with document
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>",
"phone_number": "<Phone Number with Country Code>",
"template": {
"namespace":"<WABA Namespace>",
"name":"<template Name>",
"language":{
"policy":"deterministic",
"code":"<template language>"
},
"components":[
{
"type":"header",
"parameters":[
{
"type":"document",
"document":{
"filename":"<file Name with extension>",
"link":"<file absolute public url>"
}
}
]
},
{
"type":"body",
"parameters":[
{
"type":"text",
"text":"placeholder1 data"
},
{
"type":"text",
"text":"placeholder2 data"
},
{
"type":"text",
"text":"placeholder3 data"
}
]
}
]
}
}'
Sending Custom Payload in Template Quick Reply Buttons
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>",
"phone_number": "<Phone Number with Country Code>",
"template": {
"namespace":"<WABA Namespace>",
"name":"<template Name>",
"language":{
"policy":"deterministic",
"code":"<template language>"
},
"components":[
{
"type":"header",
"parameters":[
{
"type":"image/video",
"image/video":{
"link":"<file absolute public url>"
}
}
]
},
{
"type":"body",
"parameters":[
{
"type":"text",
"text":"placeholder1 data"
},
{
"type":"text",
"text":"placeholder2 data"
},
{
"type":"text",
"text":"placeholder3 data"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "0",
"parameters": [
{
"type": "payload",
"payload": "<Developer Defined payload for quick reply>"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "1",
"parameters": [
{
"type": "payload",
"payload": "<Developer Defined payload for quick reply>"
}
]
}
]
}
}'