Send a WhatsApp Template
curl --request POST \
--url https://api.hilos.io/api/channels/whatsapp/template/{id}/send \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"variables": [
"<string>"
]
}
'import requests
url = "https://api.hilos.io/api/channels/whatsapp/template/{id}/send"
payload = {
"phone": "<string>",
"variables": ["<string>"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone: '<string>', variables: ['<string>']})
};
fetch('https://api.hilos.io/api/channels/whatsapp/template/{id}/send', 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://api.hilos.io/api/channels/whatsapp/template/{id}/send",
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>',
'variables' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.hilos.io/api/channels/whatsapp/template/{id}/send"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.hilos.io/api/channels/whatsapp/template/{id}/send")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hilos.io/api/channels/whatsapp/template/{id}/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "a513da3a-8b73-42aa-a938-0eb1e0141533",
"conversation": "ee49ab6c-dfd8-4cb6-a512-5880f4385622"
}WhatsApp Templates
Send a WhatsApp Template
Send a single WhatsApp message: select a template to use and call our endpoint with the recipient phone number and the variables the template needs. That’s it!
POST
/
api
/
channels
/
whatsapp
/
template
/
{id}
/
send
Send a WhatsApp Template
curl --request POST \
--url https://api.hilos.io/api/channels/whatsapp/template/{id}/send \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "<string>",
"variables": [
"<string>"
]
}
'import requests
url = "https://api.hilos.io/api/channels/whatsapp/template/{id}/send"
payload = {
"phone": "<string>",
"variables": ["<string>"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone: '<string>', variables: ['<string>']})
};
fetch('https://api.hilos.io/api/channels/whatsapp/template/{id}/send', 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://api.hilos.io/api/channels/whatsapp/template/{id}/send",
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>',
'variables' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.hilos.io/api/channels/whatsapp/template/{id}/send"
payload := strings.NewReader("{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.hilos.io/api/channels/whatsapp/template/{id}/send")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hilos.io/api/channels/whatsapp/template/{id}/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"<string>\",\n \"variables\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "a513da3a-8b73-42aa-a938-0eb1e0141533",
"conversation": "ee49ab6c-dfd8-4cb6-a512-5880f4385622"
}This endpoint is for sending templates only. If you want more functionality (like adding tags) use the Create a flow execution endpoint.
Authorizations
Token-based authentication with required prefix "Token"
Path Parameters
Template Id
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
The phone number to send the WhatsApp Template to.
Maximum string length:
20An array of variables to be used in the WhatsApp Template. Variables are taken in order HEADER, BODY and BUTTONs. (e.g. position 0 corresponds to the HEADER (if it exists) or variable {{1}}, position 1 to variable {{2}} and so on.
Was this page helpful?
⌘I

