Submit template for approval
Submit a WhatsApp template to Meta for approval. The template must be in draft status and associated with a sender that has a WhatsApp Business Account configured.
curl --request POST \
--url https://api.zavu.dev/v1/templates/{templateId}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"senderId": "sender_abc123",
"category": "UTILITY",
"variableExamples": {
"var1": "Maria",
"var2": "ORD-12345"
}
}
'import requests
url = "https://api.zavu.dev/v1/templates/{templateId}/submit"
payload = {
"senderId": "sender_abc123",
"category": "UTILITY",
"variableExamples": {
"var1": "Maria",
"var2": "ORD-12345"
}
}
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({
senderId: 'sender_abc123',
category: 'UTILITY',
variableExamples: {var1: 'Maria', var2: 'ORD-12345'}
})
};
fetch('https://api.zavu.dev/v1/templates/{templateId}/submit', 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.zavu.dev/v1/templates/{templateId}/submit",
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([
'senderId' => 'sender_abc123',
'category' => 'UTILITY',
'variableExamples' => [
'var1' => 'Maria',
'var2' => 'ORD-12345'
]
]),
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://api.zavu.dev/v1/templates/{templateId}/submit"
payload := strings.NewReader("{\n \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\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://api.zavu.dev/v1/templates/{templateId}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v1/templates/{templateId}/submit")
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 \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "order_confirmation",
"language": "en",
"body": "Hi {{1}}, your order {{2}} has shipped.",
"category": "UTILITY",
"smsBody": "<string>",
"telegramBody": "<string>",
"instagramBody": "<string>",
"status": "draft",
"variables": [
"<string>"
],
"headerType": "<string>",
"headerContent": "<string>",
"footer": "<string>",
"buttons": [
{
"type": "quick_reply",
"text": "<string>",
"url": "<string>",
"example": "<string>",
"phoneNumber": "<string>",
"otpType": "COPY_CODE",
"packageName": "<string>",
"signatureHash": "<string>"
}
],
"addSecurityRecommendation": true,
"codeExpirationMinutes": 45,
"whatsapp": {
"templateName": "<string>",
"namespace": "<string>",
"status": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
The sender ID with the WhatsApp Business Account to submit the template to.
Template category. If not provided, uses the category set on the template.
UTILITY, MARKETING, AUTHENTICATION Sample value for each body variable, sent to Meta as the example it reviews the template with. Key a named variable ({{customer_name}}) by its name, and a positional one ({{1}}, {{2}}) as var1, var2.
Any variable left out gets a generic placeholder: a stock value for a few common names (name, order_id, code, ...) and Sample <variable> for the rest. Meta reviews those less favourably, so send a realistic value for every variable.
Show child attributes
Show child attributes
{ "var1": "Maria", "var2": "ORD-12345" }
Response
Template submitted for approval.
Template name. For WhatsApp, must match the approved template name in Meta.
"order_confirmation"
Language code.
"en"
Default template body with variables: positional ({{1}}, {{2}}) or named ({{customer_name}}, {{contact.first_name}}). Templates created in Zavu are submitted to Meta as positional; templates imported from a WhatsApp Business Account keep their original format (named or positional). Used when no channel-specific body is set.
"Hi {{1}}, your order {{2}} has shipped."
The category the template is billed under. For a template linked to WhatsApp this is the category Meta currently assigns, not the one it was submitted with: Meta can recategorize a template at approval or at any point afterwards, and that changes what the message costs.
A recategorization reaches this field through the template.status_changed webhook, which carries data.category, and through POST /v1/templates/sync, which reconciles it against Meta. Read one of those rather than assuming the category you sent is the one in force.
For a template that was never submitted to WhatsApp, this is the category stored locally, defaulting to UTILITY.
UTILITY, MARKETING, AUTHENTICATION Channel-specific body for SMS messages. Falls back to body if not set.
Channel-specific body for Telegram messages. Falls back to body if not set.
Channel-specific body for Instagram messages. Falls back to body if not set.
draft, pending, approved, rejected List of variable names for documentation.
Type of header (text, image, video, document).
Header content (text or media URL).
Footer text for the template.
Template buttons.
Show child attributes
Show child attributes
Add 'Do not share this code' disclaimer. Only for AUTHENTICATION templates.
Code expiration time in minutes. Only for AUTHENTICATION templates.
1 <= x <= 90WhatsApp-specific template information.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.zavu.dev/v1/templates/{templateId}/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"senderId": "sender_abc123",
"category": "UTILITY",
"variableExamples": {
"var1": "Maria",
"var2": "ORD-12345"
}
}
'import requests
url = "https://api.zavu.dev/v1/templates/{templateId}/submit"
payload = {
"senderId": "sender_abc123",
"category": "UTILITY",
"variableExamples": {
"var1": "Maria",
"var2": "ORD-12345"
}
}
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({
senderId: 'sender_abc123',
category: 'UTILITY',
variableExamples: {var1: 'Maria', var2: 'ORD-12345'}
})
};
fetch('https://api.zavu.dev/v1/templates/{templateId}/submit', 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.zavu.dev/v1/templates/{templateId}/submit",
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([
'senderId' => 'sender_abc123',
'category' => 'UTILITY',
'variableExamples' => [
'var1' => 'Maria',
'var2' => 'ORD-12345'
]
]),
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://api.zavu.dev/v1/templates/{templateId}/submit"
payload := strings.NewReader("{\n \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\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://api.zavu.dev/v1/templates/{templateId}/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zavu.dev/v1/templates/{templateId}/submit")
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 \"senderId\": \"sender_abc123\",\n \"category\": \"UTILITY\",\n \"variableExamples\": {\n \"var1\": \"Maria\",\n \"var2\": \"ORD-12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "order_confirmation",
"language": "en",
"body": "Hi {{1}}, your order {{2}} has shipped.",
"category": "UTILITY",
"smsBody": "<string>",
"telegramBody": "<string>",
"instagramBody": "<string>",
"status": "draft",
"variables": [
"<string>"
],
"headerType": "<string>",
"headerContent": "<string>",
"footer": "<string>",
"buttons": [
{
"type": "quick_reply",
"text": "<string>",
"url": "<string>",
"example": "<string>",
"phoneNumber": "<string>",
"otpType": "COPY_CODE",
"packageName": "<string>",
"signatureHash": "<string>"
}
],
"addSecurityRecommendation": true,
"codeExpirationMinutes": 45,
"whatsapp": {
"templateName": "<string>",
"namespace": "<string>",
"status": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}