curl --request POST \
--url https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "text_template",
"language": "en",
"category": "ACCOUNT_UPDATE",
"structure": {
"body": "body {{1}} content",
"type": "TEXT"
}
}
'import requests
url = "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates"
payload = {
"name": "text_template",
"language": "en",
"category": "ACCOUNT_UPDATE",
"structure": {
"body": "body {{1}} content",
"type": "TEXT"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"name\": \"text_template\",\n \"language\": \"en\",\n \"category\": \"ACCOUNT_UPDATE\",\n \"structure\": {\n \"body\": \"body {{1}} content\",\n \"type\": \"TEXT\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"text_template\",\n \"language\": \"en\",\n \"category\": \"ACCOUNT_UPDATE\",\n \"structure\": {\n \"body\": \"body {{1}} content\",\n \"type\": \"TEXT\"\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates",
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([
'name' => 'text_template',
'language' => 'en',
'category' => 'ACCOUNT_UPDATE',
'structure' => [
'body' => 'body {{1}} content',
'type' => 'TEXT'
]
]),
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;
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'text_template',
language: 'en',
category: 'ACCOUNT_UPDATE',
structure: {body: JSON.stringify('body {{1}} content'), type: 'TEXT'}
})
};
fetch('https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "111",
"businessAccountId": 222,
"name": "media_template",
"language": "en",
"status": "APPROVED",
"category": "ACCOUNT_UPDATE",
"structure": {
"header": {
"format": "IMAGE"
},
"body": "example {{1}} body",
"footer": "exampleFooter",
"type": "MEDIA"
}
}Create WhatsApp Template
Create a WhatsApp template. Created template will be submitted for WhatsApp’s review and approval. Once approved, template can be sent to end-users. Refer to template guidelines for additional info. This version is deprecated as of June 29th 2022, meaning no fixes/updates will be provided and no new parameters will be added. This API will be deleted at the end of the year. Please use the latest version.
Required scope: Enable one of: whatsapp:manage.
curl --request POST \
--url https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "text_template",
"language": "en",
"category": "ACCOUNT_UPDATE",
"structure": {
"body": "body {{1}} content",
"type": "TEXT"
}
}
'import requests
url = "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates"
payload = {
"name": "text_template",
"language": "en",
"category": "ACCOUNT_UPDATE",
"structure": {
"body": "body {{1}} content",
"type": "TEXT"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"name\": \"text_template\",\n \"language\": \"en\",\n \"category\": \"ACCOUNT_UPDATE\",\n \"structure\": {\n \"body\": \"body {{1}} content\",\n \"type\": \"TEXT\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"text_template\",\n \"language\": \"en\",\n \"category\": \"ACCOUNT_UPDATE\",\n \"structure\": {\n \"body\": \"body {{1}} content\",\n \"type\": \"TEXT\"\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates",
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([
'name' => 'text_template',
'language' => 'en',
'category' => 'ACCOUNT_UPDATE',
'structure' => [
'body' => 'body {{1}} content',
'type' => 'TEXT'
]
]),
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;
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'text_template',
language: 'en',
category: 'ACCOUNT_UPDATE',
structure: {body: JSON.stringify('body {{1}} content'), type: 'TEXT'}
})
};
fetch('https://api.messaging.phonovation.com/whatsapp/1/senders/{sender}/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "111",
"businessAccountId": 222,
"name": "media_template",
"language": "en",
"status": "APPROVED",
"category": "ACCOUNT_UPDATE",
"structure": {
"header": {
"format": "IMAGE"
},
"body": "example {{1}} body",
"footer": "exampleFooter",
"type": "MEDIA"
}
}Authorizations
This is the most secure authorization type and the one with the most flexibility.
API keys can be generated by calling the dedicated API method. Furthermore, API keys can have a limited scope and cover only some API methods. Lastly, they can be revoked at any time. This range of possibilities makes API keys well suited for separating the API access rights across multiple applications or use cases. Finally, the loss of an API key is easily manageable.
You can manage your API keys from GUI, or programmatically with dedicated API.
API key Authorization header example:
Authorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9
Path Parameters
Registered WhatsApp sender number. Must be in international format.
Body
Template name. Must only contain lowercase alphanumeric characters and underscores.
1^[a-z0-9_]{1,512}$Template language, one template with same name can have multiple transliterations.
af, sq, ar, ar_EG, ar_AE, ar_LB, ar_MA, ar_QA, az, bn, bn_IN, bg, ca, zh_CN, zh_HK, zh_TW, hr, cs, da, nl, nl_BE, en, en_GB, en_US, en_AE, en_AU, en_CA, en_GH, en_IE, en_IN, en_JM, en_MY, en_NZ, en_QA, en_SG, en_UG, en_ZA, et, fil, fi, fr, fr_BE, fr_CA, fr_CH, fr_CI, fr_MA, ka, de, de_AT, de_CH, el, gu, ha, he, hi, hu, id, ga, it, ja, kn, kk, rw_RW, ko, ky_KG, lo, lv, lt, mk, ms, ml, mr, nb, fa, pl, pt_BR, pt_PT, pa, ro, ru, sr, si_LK, sk, sl, es, es_AR, es_CL, es_CO, es_CR, es_DO, es_EC, es_HN, es_MX, es_PA, es_PE, es_ES, es_UY, sw, sv, ta, te, th, tr, uk, ur, uz, vi, zu, unknown "en"
All listed categories will be available until May 1, 2023.
ACCOUNT_UPDATE, PAYMENT_UPDATE, PERSONAL_FINANCE_UPDATE, SHIPPING_UPDATE, RESERVATION_UPDATE, ISSUE_RESOLUTION, APPOINTMENT_UPDATE, TRANSPORTATION_UPDATE, TICKET_UPDATE, ALERT_UPDATE, AUTO_REPLY 1"ACCOUNT_UPDATE"
Template structure.
Show child attributes
Show child attributes
Response
Template created.
List of all templates for given sender.
Template ID.
"111"
Business account ID to which template belongs.
222
Name of the template.
"template_name"
Template language, one template with same name can have multiple transliterations.
af, sq, ar, ar_EG, ar_AE, ar_LB, ar_MA, ar_QA, az, bn, bn_IN, bg, ca, zh_CN, zh_HK, zh_TW, hr, cs, da, nl, nl_BE, en, en_GB, en_US, en_AE, en_AU, en_CA, en_GH, en_IE, en_IN, en_JM, en_MY, en_NZ, en_QA, en_SG, en_UG, en_ZA, et, fil, fi, fr, fr_BE, fr_CA, fr_CH, fr_CI, fr_MA, ka, de, de_AT, de_CH, el, gu, ha, he, hi, hu, id, ga, it, ja, kn, kk, rw_RW, ko, ky_KG, lo, lv, lt, mk, ms, ml, mr, nb, fa, pl, pt_BR, pt_PT, pa, ro, ru, sr, si_LK, sk, sl, es, es_AR, es_CL, es_CO, es_CR, es_DO, es_EC, es_HN, es_MX, es_PA, es_PE, es_ES, es_UY, sw, sv, ta, te, th, tr, uk, ur, uz, vi, zu, unknown "en"
Status of the template.
APPROVED, IN_APPEAL, PENDING, REJECTED, PENDING_DELETION, DELETED, REINSTATED, FLAGGED, FIRST_PAUSED, SECOND_PAUSED, DISABLED, ARCHIVED, UNKNOWN "APPROVED"
Category of the template.
ACCOUNT_UPDATE, PAYMENT_UPDATE, PERSONAL_FINANCE_UPDATE, SHIPPING_UPDATE, RESERVATION_UPDATE, ISSUE_RESOLUTION, APPOINTMENT_UPDATE, TRANSPORTATION_UPDATE, TICKET_UPDATE, ALERT_UPDATE, AUTO_REPLY, TRANSACTIONAL, OTP, MARKETING, AUTHENTICATION, UTILITY "ACCOUNT_UPDATE"
Template structure.
Show child attributes
Show child attributes