Send WhatsApp template
Send one approved template to one person, filling in its variables, media header and button links. Charged from your wallet at the template category’s price.
Scope: whatsapp:send.
number says which number sent it: own or shared. On the shared number you can only send templates you created there.
Replies inside the 24-hour window are sent from the WhatsApp inbox. Delivery and read receipts arrive as whatsapp.status webhooks; replies as whatsapp.inbound.
POST
/
whatsapp
/
send
Send WhatsApp template
curl --request POST \
--url https://app.telaven.com/api/v1/whatsapp/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "0712345678",
"name": "Jane Wanjiku",
"template": {
"name": "order_ready",
"language": "en",
"params": {
"body": [
"Jane",
"A1042"
],
"header": {
"media": {
"type": "image",
"link": "https://example.com/order.jpg"
}
},
"buttons": [
{
"index": 0,
"text": "A1042"
}
]
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '0712345678',
name: 'Jane Wanjiku',
template: {
name: 'order_ready',
language: 'en',
params: {
body: JSON.stringify(['Jane', 'A1042']),
header: {media: {type: 'image', link: 'https://example.com/order.jpg'}},
buttons: [{index: 0, text: 'A1042'}]
}
}
})
};
fetch('https://app.telaven.com/api/v1/whatsapp/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/whatsapp/send"
payload = {
"to": "0712345678",
"name": "Jane Wanjiku",
"template": {
"name": "order_ready",
"language": "en",
"params": {
"body": ["Jane", "A1042"],
"header": { "media": {
"type": "image",
"link": "https://example.com/order.jpg"
} },
"buttons": [
{
"index": 0,
"text": "A1042"
}
]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/whatsapp/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([
'to' => '0712345678',
'name' => 'Jane Wanjiku',
'template' => [
'name' => 'order_ready',
'language' => 'en',
'params' => [
'body' => [
'Jane',
'A1042'
],
'header' => [
'media' => [
'type' => 'image',
'link' => 'https://example.com/order.jpg'
]
],
'buttons' => [
[
'index' => 0,
'text' => 'A1042'
]
]
]
]
]),
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;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/whatsapp/send");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"to\": \"0712345678\",\n \"name\": \"Jane Wanjiku\",\n \"template\": {\n \"name\": \"order_ready\",\n \"language\": \"en\",\n \"params\": {\n \"body\": [\n \"Jane\",\n \"A1042\"\n ],\n \"header\": {\n \"media\": {\n \"type\": \"image\",\n \"link\": \"https://example.com/order.jpg\"\n }\n },\n \"buttons\": [\n {\n \"index\": 0,\n \"text\": \"A1042\"\n }\n ]\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"id": "4b7e…",
"wamid": "wamid.HBgMMjU0NzEyMzQ1Njc4FQIAERgS…",
"status": "sent",
"number": "own",
"costCents": 80
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Headers
Body
application/json
Response
Success
⌘I
Send WhatsApp template
curl --request POST \
--url https://app.telaven.com/api/v1/whatsapp/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "0712345678",
"name": "Jane Wanjiku",
"template": {
"name": "order_ready",
"language": "en",
"params": {
"body": [
"Jane",
"A1042"
],
"header": {
"media": {
"type": "image",
"link": "https://example.com/order.jpg"
}
},
"buttons": [
{
"index": 0,
"text": "A1042"
}
]
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
to: '0712345678',
name: 'Jane Wanjiku',
template: {
name: 'order_ready',
language: 'en',
params: {
body: JSON.stringify(['Jane', 'A1042']),
header: {media: {type: 'image', link: 'https://example.com/order.jpg'}},
buttons: [{index: 0, text: 'A1042'}]
}
}
})
};
fetch('https://app.telaven.com/api/v1/whatsapp/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/whatsapp/send"
payload = {
"to": "0712345678",
"name": "Jane Wanjiku",
"template": {
"name": "order_ready",
"language": "en",
"params": {
"body": ["Jane", "A1042"],
"header": { "media": {
"type": "image",
"link": "https://example.com/order.jpg"
} },
"buttons": [
{
"index": 0,
"text": "A1042"
}
]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/whatsapp/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([
'to' => '0712345678',
'name' => 'Jane Wanjiku',
'template' => [
'name' => 'order_ready',
'language' => 'en',
'params' => [
'body' => [
'Jane',
'A1042'
],
'header' => [
'media' => [
'type' => 'image',
'link' => 'https://example.com/order.jpg'
]
],
'buttons' => [
[
'index' => 0,
'text' => 'A1042'
]
]
]
]
]),
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;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/whatsapp/send");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"to\": \"0712345678\",\n \"name\": \"Jane Wanjiku\",\n \"template\": {\n \"name\": \"order_ready\",\n \"language\": \"en\",\n \"params\": {\n \"body\": [\n \"Jane\",\n \"A1042\"\n ],\n \"header\": {\n \"media\": {\n \"type\": \"image\",\n \"link\": \"https://example.com/order.jpg\"\n }\n },\n \"buttons\": [\n {\n \"index\": 0,\n \"text\": \"A1042\"\n }\n ]\n }\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"id": "4b7e…",
"wamid": "wamid.HBgMMjU0NzEyMzQ1Njc4FQIAERgS…",
"status": "sent",
"number": "own",
"costCents": 80
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}