Send Template Messages
While sending a template message, the template contents are not sent. To send a template message, its media link [public link] & variable values [if any] are sent along with the template name and language
Broadcast with caution - Do not spam. Spamming will lead to the degradation of service and WhatsApp number getting blocked
Sending Message
The template has no parameter
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
"purpose": "sendtemplate",
"to": <recepient phone number>,
"template": <template name>,
"code": <language code>
}'
sample data
--data '{
"purpose": "sendtemplate",
"to": "919999900000",
"template": "conv_start_hi",
"code": "en_US"
}'
The template has image media
The image typically does not look like a regular parameter while creating the template. However, is a parameter
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
"purpose": "sendtemplate",
"to": <recepient>,
"template": "schedule",
"code": "en",
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://cdn.anuhealthyfood.in/images/missyourorders.png"
}
}
]
}
]
}'
The link has to be publically accessible, or else the template won't be delivered to the user
The template has body parameters
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
"purpose": "sendtemplate",
"to": <recepient>,
"template": "schedule",
"code": "en",
"components": [
{
"type": "body",
"parameters": [
{
"type": "TEXT",
"text": "Hemant Suryavanshi"
},
{
"type": "TEXT",
"text": "Blue USB Microphone"
},
{
"type": "TEXT",
"text": "12/12/2024"
}
]
}
]
}'
In the above example, the template has three body variables. As depicted, only parameters are passed and not the entire body
The template has body parameters and image media
curl --location 'https://api.versal.one/<client-id>' \
--header 'Authorization: Bearer <client-token>' \
--header 'Content-Type: application/json' \
--data '{
"purpose": "sendtemplate",
"to": <recepient>,
"template": "schedule",
"code": "en",
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://cdn.anuhealthyfood.in/images/missyourorders.png"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "TEXT",
"text": "Hemant Suryavanshi"
},
{
"type": "TEXT",
"text": "Blue USB Microphone"
},
{
"type": "TEXT",
"text": "12/12/2024"
}
]
}
]
}'
In the above example, there is an image and three body parameters in the template
Response
{
"message": "Message sent successfully",
"response_text": "{"messaging_product":"whatsapp","contacts":[{"input":"+16312924377","wa_id":"16312924377"}],"messages":[{"id":"wamid.HBgLMTYzMTI5MjQzNzcVAgARGBIxNEExODY3MjhGMDNGNDRBNjgA","message_status":"accepted"}]}",
"status": "200"
}
No Comments