Skip to content

Send WhatsApp templates

Start or reopen a WhatsApp conversation with an approved template. Use your own variable names, read what a template needs, and learn which errors to expect.

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

  1. Write the template in WizMessage under Templates and send it for approval. The template guide has the details.
  2. Open the key in API Management, go to Templates and pick it.
  3. Give each place a name that your software knows, for example customer_name in 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

FieldWhat it is
tostring, requiredThe recipient in international format, with the plus sign.10 to 20 characters
template_namestring, requiredName of the approved template.At most 255 characters
languagestring, requiredLanguage of the template, for example en.2 to 10 characters
variablesobject, requiredYour 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_filenamestringFile name of a document header.At most 400 characters
referencestringYour own id for this send. It comes back in webhooks and in the status.At most 100 characters
POST /messages/template/send
{
  "to": "+447700900123",
  "template_name": "appointment_reminder",
  "language": "en",
  "variables": {
    "customer_name": "Riya",
    "appointment_date": "14 December, 11:30"
  },
  "reference": "booking-2026-1214"
}
template.sh
bash wizmessage.sh template +447700900123 appointment_reminder \
  '{"customer_name":"Riya","appointment_date":"14 December, 11:30"}'

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 happenedAnswer
The template is not set up for this key400, TEMPLATE_NOT_CONFIGURED
A variable is missing or does not fit400, INVALID_TEMPLATE_PARAMS
A date variable is not a date400, INVALID_DATE_FORMAT
A name that the template does not haveIgnored
WhatsApp refuses it, for example because the template is paused422, 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.

FieldWhat it is
nameThe name that template_name takes
languageThe language that language takes
statusFor example APPROVED, PENDING or REJECTED
categoryFor example MARKETING or UTILITY
componentsThe 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.

FieldWhat it is
tostring, requiredThe recipient in international format, with the plus sign.10 to 20 characters
template_namestring, requiredName of the approved template.At most 255 characters
languagestring, requiredLanguage of the template, for example en.2 to 10 characters
header_filenamestringAccepted, not used by this call.At most 400 characters
componentsarrayHeader, body and button values in the format of the WhatsApp Business Platform. See the link of this operation.
referencestringYour own id for this send. It comes back in webhooks and in the status.At most 100 characters
POST /messages/template
{
  "to": "+447700900123",
  "template_name": "order_update",
  "language": "en",
  "components": [
    {
      "type": "body",
      "parameters": [
        {
          "type": "text",
          "text": "Riya"
        }
      ]
    }
  ],
  "reference": "order-1042"
}