description |
---|
Send a template message |
URL | Method | Input Data Format |
---|---|---|
REST API URL can be found on Apps Page |
POST |
JSON |
{
"phoneNumbers": [
"+917785887264", "+551452001478"
],
"connectedWhatsAppNo": "+565412001234",
"targetAgent": "murtaza98",
"targetDepartment": "SalesDepartment",
"template": {
"namespace": "your-namespace",
"name": "your-template-name",
"language": {
"code": "your-language-and-locale-code",
"policy": "deterministic"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "text",
"text": "your-text-string"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "your-text-string"
},
{
"type": "text",
"text": "your-text-string"
}
]
},
{
"type": "footer",
"parameters": [
{
"type": "text",
"text": "your-text-string"
}
]
},
]
}
}
Param Name | Param Type | Description | Dependency | Example |
---|---|---|---|---|
phoneNumbers |
Array of String | Recipient WhatsApp Id(s) where you want to send the template message. Note you can validate a WhatsApp id from here | Required | "phoneNumbers": [ "+917785887264", "+551452001478" ] |
connectedWhatsAppNo |
String | The WhatsApp Number from which you want to send this template message | Required | "connectedWhatsAppNo": "+565412001234" |
targetAgent |
String | Username of the targetAgent you wish to transfer the chat to when the WhatsApp user replies back | Optional | "targetAgent": "murtaza98" |
targetDepartment |
String | Department Name or Id where you wish to transfer the chat to when the WhatsApp user replies back | Optional | "targetDepartment": "SalesDepartment" |
template |
Same as WhatsApp-template-object | Provide information about the template message you wish to send | Required | Please refer to the template property in above examp |
We strongly recommend including the '+' prefix for the all PhoneNumbers in the payload. While you can submit numbers without the leading '+' we have encountered cases where WhatsApp will return 'invalid' despite the number being in use. |
---|
Curl
curl --location --request POST 'http://localhost:3000/api/apps/public/085b7345-53e7-498c-adcb-d909e11f8100/templateMessage' \
--header 'Content-Type: application/json' \
--data-raw '{
"phoneNumbers": [
"+917738772967"
],
"connectedWhatsAppNo": "+565412001234",
"targetAgent": "murtaza98",
"targetDepartment": "SalesDepartment",
"template": {
"namespace": "aa498c38_6c0c_448d_a652_38f5d33b8c7f",
"name": "sales_welcome_template",
"language": {
"code": "en",
"policy": "deterministic"
}
}
}'
HTTP
POST /api/apps/public/085b7345-53e7-498c-adcb-d909e11f8100/templateMessage HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Content-Length: 312
{
"phoneNumbers": [
"+917738772967"
],
"connectedWhatsAppNo": "+565412001234",
"targetAgent": "murtaza98",
"targetDepartment": "SalesDepartment",
"template": {
"namespace": "aa498c38_6c0c_448d_a652_38f5d33b8c7f",
"name": "sales_welcome_template",
"language": {
"code": "en",
"policy": "deterministic"
}
}
}
Success Response | Error Response |
---|---|
Code: 200 |
Code: 400 BAD REQUEST |
Code: 200 |
Code: 400 BAD REQUEST |
Code: 400 BAD REQUEST |
|
Code: 400 BAD REQUEST |
|
Code: 400 BAD REQUEST |
|
Code: 400 BAD REQUEST |
|
Code: 500 Internal Server Error |