http://portal.thundersms.com/api/v2/
Note: Few elements in the endpoint may change from service to service.
{endpoint}whatsapp/message/send
Name | Description | Limits | Required |
---|---|---|---|
name | Template Alias Name |
N/A | yes |
language | Language to send the template in. Default en |
N/A | No |
header_params | Only one header replace variable value. | N/A | Yes incase template contain having the header variable |
header_params.type | Replacing the header media type : text , image , video or document . |
If image , video or document type value then payload inside required the url parameter, else text parameter |
Yes incase template contain having the header variable |
body_params | Up to 1024 characters for all parameters that are predefined template text, if authentication template has only one replace variable value. |
Up to 1024 characters for all parameters and predefined template text | Yes incase only template contain having the body variables |
meta | This block contains all additional information | N/A | No |
tags | opt-out the message based on the tags. | N/A | No |
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": "{receiver}"
},
"message": {
"type": "template",
"payload": {
"name": "template_alias_name",
"language": "en"
}
}
}'
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": [
"{receiver}"
]
},
"message": {
"type": "template",
"payload": {
"name": "template_alias_name",
"language": "en",
"header_params": {
"type": "text",
"payload": {
"text": "replace-header-variable-value"
}
},
"body_params": ["variable-1", "variable-2"]
}
}
}'
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": [
"{receiver}"
]
},
"message": {
"type": "template",
"payload": {
"name": "template_alias_name",
"language": "en",
"header_params": {
"type": "image",
"payload": {
"url": "https://picsum.photos/id/237/200/300"
}
},
"body_params": []
}
}
}'
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": [
"{receiver}"
]
},
"message": {
"type": "template",
"payload": {
"name": "template_alias_name",
"language": "en",
"header_params": {
"type": "document",
"payload": {
"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
"filename": "Sample PDF file"
}
},
"body_params": []
}
}
}'
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": [
"{receiver}"
]
},
"message": {
"type": "template",
"payload": {
"name": "template_alias_name",
"language": "en",
"header_params": {
"type": "video",
"payload": {
"url": "https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4"
}
},
"body_params": []
}
}
}'
curl --location --globoff '{endpoint}/api/v2/whatsapp/message/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channels": [
{
"name": "whatsapp",
"from": "{from}",
"meta": {
"tags": [
"tag1",
"tag2"
]
}
}
],
"recipient": {
"to": [
"{receiver}"
]
},
"message": {
"type": "template",
"payload": {
"name": "auth_template_alias_name",
"language": "en",
"body_params" : ["replace-variable-code"]
}
}
}'