Send a template message
curl --request POST \
--url https://your-domain.com/api/v1/api/send/template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
"<unknown>"
]
},
"first_name": "<string>",
"last_name": "<string>",
"email": "[email protected]"
}
'import requests
url = "https://your-domain.com/api/v1/api/send/template"
payload = {
"phone": "<string>",
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": ["<unknown>"]
},
"first_name": "<string>",
"last_name": "<string>",
"email": "[email protected]"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
template: {name: '<string>', language: {code: '<string>'}, components: ['<unknown>']},
first_name: '<string>',
last_name: '<string>',
email: '[email protected]'
})
};
fetch('https://your-domain.com/api/v1/api/send/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-domain.com/api/v1/api/send/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '<string>',
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
'<unknown>'
]
],
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '[email protected]'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-domain.com/api/v1/api/send/template"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-domain.com/api/v1/api/send/template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-domain.com/api/v1/api/send/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {},
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}Messaging
Send a template message
Sends a WhatsApp template. Use GET /templates/{uuid}/payload to build the template object.
POST
/
send
/
template
Send a template message
curl --request POST \
--url https://your-domain.com/api/v1/api/send/template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"template": {
"name": "<string>",
"language": {
"code": "<string>"
},
"components": [
"<unknown>"
]
},
"first_name": "<string>",
"last_name": "<string>",
"email": "[email protected]"
}
'import requests
url = "https://your-domain.com/api/v1/api/send/template"
payload = {
"phone": "<string>",
"template": {
"name": "<string>",
"language": { "code": "<string>" },
"components": ["<unknown>"]
},
"first_name": "<string>",
"last_name": "<string>",
"email": "[email protected]"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '<string>',
template: {name: '<string>', language: {code: '<string>'}, components: ['<unknown>']},
first_name: '<string>',
last_name: '<string>',
email: '[email protected]'
})
};
fetch('https://your-domain.com/api/v1/api/send/template', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-domain.com/api/v1/api/send/template",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '<string>',
'template' => [
'name' => '<string>',
'language' => [
'code' => '<string>'
],
'components' => [
'<unknown>'
]
],
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '[email protected]'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-domain.com/api/v1/api/send/template"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-domain.com/api/v1/api/send/template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-domain.com/api/v1/api/send/template")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"template\": {\n \"name\": \"<string>\",\n \"language\": {\n \"code\": \"<string>\"\n },\n \"components\": [\n \"<unknown>\"\n ]\n },\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"[email protected]\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {},
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}{
"status": 123,
"success": false,
"message": "<string>",
"data": null,
"errors": [
{}
]
}Authorizations
API key from Developer Tools. Use Authorization: Bearer <api_key>. Do not send a user JWT; it will be rejected with 401.
Body
application/json
⌘I