A template is a text that was approved before you send it, with places for your own values. It is the way to write first, or to write again when the last message of the customer is more than 24 hours old: order updates, appointment reminders, invoices.
Set it up for the key
- Write the template in WizMessage under Templates and send it for approval. The template guide has the details.
- Open the key in API Management, go to Templates and pick it.
- Give each place a name that your software knows, for example
customer_namein place of the first number.
From then on your software sends names and values. If the order in the template changes, you change it there and not in your code.
Send with your own variable names
| Field | What it is |
|---|---|
tostring, required | The recipient in international format, with the plus sign.10 to 20 characters |
template_namestring, required | Name of the approved template.At most 255 characters |
languagestring, required | Language of the template, for example en.2 to 10 characters |
variablesobject, required | Your values by variable name. A text, a number, true or false, or a location with latitude and longitude. May be empty.At most 50 entries |
header_filenamestring | File name of a document header.At most 400 characters |
referencestring | Your own id for this send. It comes back in webhooks and in the status.At most 100 characters |
{
"to": "+447700900123",
"template_name": "appointment_reminder",
"language": "en",
"variables": {
"customer_name": "Riya",
"appointment_date": "14 December, 11:30"
},
"reference": "booking-2026-1214"
}bash wizmessage.sh template +447700900123 appointment_reminder \
'{"customer_name":"Riya","appointment_date":"14 December, 11:30"}'import { WizMessage } from './wizmessage.mjs'
const api = new WizMessage({
apiKey: process.env.WIZMESSAGE_API_KEY,
apiSecret: process.env.WIZMESSAGE_API_SECRET,
})
const sent = await api.sendTemplate({
to: '+447700900123',
template_name: 'appointment_reminder',
language: 'en',
variables: { customer_name: 'Riya', appointment_date: '14 December, 11:30' },
reference: 'booking-2026-1214',
})
console.log(sent.whatsapp_message_id, sent.status)import os
from wizmessage import WizMessage
api = WizMessage(os.environ["WIZMESSAGE_API_KEY"], os.environ["WIZMESSAGE_API_SECRET"])
sent = api.send_template(
to="+447700900123",
template_name="appointment_reminder",
language="en",
variables={"customer_name": "Riya", "appointment_date": "14 December, 11:30"},
reference="booking-2026-1214",
)
print(sent["whatsapp_message_id"], sent["status"])<?php
require __DIR__ . '/WizMessage.php';
$api = new WizMessage(getenv('WIZMESSAGE_API_KEY'), getenv('WIZMESSAGE_API_SECRET'));
$sent = $api->sendTemplate([
'to' => '+447700900123',
'template_name' => 'appointment_reminder',
'language' => 'en',
'variables' => ['customer_name' => 'Riya', 'appointment_date' => '14 December, 11:30'],
'reference' => 'booking-2026-1214',
]);
echo $sent['whatsapp_message_id'], ' ', $sent['status'], "\n";The client is on the authentication page. A value can also be a place, for a template with a map: an object with latitude and longitude, and if you like name and address.
What can go wrong
| What happened | Answer |
|---|---|
| The template is not set up for this key | 400, TEMPLATE_NOT_CONFIGURED |
| A variable is missing or does not fit | 400, INVALID_TEMPLATE_PARAMS |
| A date variable is not a date | 400, INVALID_DATE_FORMAT |
| A name that the template does not have | Ignored |
| WhatsApp refuses it, for example because the template is paused | 422, MESSAGE_SEND_FAILED |
Do not send a marketing template to people who did not ask for it or who unsubscribed. The API does not check that for you.
Read your templates
GET /templates lists the templates of the account with their status, and GET /templates/{name} returns one. Only a template with the status APPROVED can be sent. With several languages, the second call returns the first match, so use the list when the language matters. Both need view_templates.
| Field | What it is |
|---|---|
name | The name that template_name takes |
language | The language that language takes |
status | For example APPROVED, PENDING or REJECTED |
category | For example MARKETING or UTILITY |
components | The parts of the template, with its texts and places |
Send with raw components
POST /messages/template is for software that already builds the header, body and button values itself. The format of components is described in the documentation of the WhatsApp Business Platform. Names of your own do not work here.
| Field | What it is |
|---|---|
tostring, required | The recipient in international format, with the plus sign.10 to 20 characters |
template_namestring, required | Name of the approved template.At most 255 characters |
languagestring, required | Language of the template, for example en.2 to 10 characters |
header_filenamestring | Accepted, not used by this call.At most 400 characters |
componentsarray | Header, body and button values in the format of the WhatsApp Business Platform. See the link of this operation. |
referencestring | Your own id for this send. It comes back in webhooks and in the status.At most 100 characters |
{
"to": "+447700900123",
"template_name": "order_update",
"language": "en",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Riya"
}
]
}
],
"reference": "order-1042"
}