> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zexa.ao/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and Manage Approved WhatsApp Templates in Zexa

> Build and submit WhatsApp-approved message templates for outbound notifications, OTPs, and marketing messages outside active conversation windows.

Message templates are pre-approved message structures required by WhatsApp for any outbound message sent outside a 24-hour customer service window. Zexa lets you create, submit, and manage templates from the dashboard or API, and use them directly in campaigns and individual messages.

## Why templates are required

WhatsApp Business API policy distinguishes between two types of conversations:

* **Session messages** — replies sent within 24 hours of the customer's last inbound message. These do not require a template.
* **Outbound proactive messages** — notifications, alerts, OTPs, and marketing messages sent outside an active 24-hour session. These **must** use a pre-approved template.

Using templates ensures your messages meet WhatsApp's content policies before they reach recipients. Attempting to send a freeform outbound message outside a session window will result in an API error.

## Template components

A WhatsApp template is built from up to four components:

| Component   | Required | Description                                                                                         |
| ----------- | -------- | --------------------------------------------------------------------------------------------------- |
| **Header**  | No       | A title displayed above the body. Can be text, an image, or a document.                             |
| **Body**    | Yes      | The main message text. Supports dynamic variables using `{{1}}`, `{{2}}`, etc.                      |
| **Footer**  | No       | A short line of small text below the body, typically used for disclaimers or opt-out instructions.  |
| **Buttons** | No       | Up to two interactive buttons: **Call to Action** (e.g. visit URL, call number) or **Quick Reply**. |

## Create a template

<Steps>
  <Step title="Open New Template">
    In the [Zexa dashboard](https://app.zexa.ao), go to **Messaging** > **Templates** > **New Template**.
  </Step>

  <Step title="Name your template">
    Enter a template name using only **lowercase letters, digits, and underscores** — no spaces. For example: `order_confirmation` or `shipping_update_v2`.
  </Step>

  <Step title="Select a category">
    Choose the category that best describes your template:

    * **Marketing** — promotions, offers, product announcements
    * **Utility** — transactional notifications such as order confirmations and delivery updates
    * **Authentication** — OTP and verification codes
  </Step>

  <Step title="Write the body text">
    Type your message body. Insert dynamic variables using double curly braces and a sequential number: `{{1}}`, `{{2}}`, and so on. For example:

    > *Your order \{1} has been shipped and will arrive by \{2}. Track it here: \{3}*
  </Step>

  <Step title="Add optional components">
    Optionally add a **header** (text or media), a **footer** (short text), and up to two **buttons** (call-to-action or quick reply).
  </Step>

  <Step title="Submit for approval">
    Review your template and click **Submit for Approval**. WhatsApp will review the content against its policies.
  </Step>
</Steps>

## Using a template in a message

Once a template is approved, reference it by name when sending a message via the API. Pass runtime values for each variable in the `variables` array, in the same order as `{{1}}`, `{{2}}`, etc.

<CodeGroup>
  ```bash curl theme={null}
  curl --request POST \
    --url https://api.zexa.ao/v1/messages \
    --header "Authorization: Bearer <api_key>" \
    --header "Content-Type: application/json" \
    --data '{
      "channel": "whatsapp",
      "to": "+244912345678",
      "from": "MYSENDER",
      "template": {
        "name": "order_confirmation",
        "language": "pt",
        "variables": ["#1234", "24 June 2026"]
      }
    }'
  ```

  ```python python theme={null}
  import requests

  url = "https://api.zexa.ao/v1/messages"
  headers = {
      "Authorization": "Bearer <api_key>",
      "Content-Type": "application/json",
  }
  payload = {
      "channel": "whatsapp",
      "to": "+244912345678",
      "from": "MYSENDER",
      "template": {
          "name": "order_confirmation",
          "language": "pt",
          "variables": ["#1234", "24 June 2026"],
      },
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```
</CodeGroup>

The `language` field accepts an [IETF BCP 47](https://www.rfc-editor.org/info/bcp47) language tag (e.g. `pt` for Portuguese, `en` for English). Zexa will use the language variant of your template that matches the code you supply.

## Template approval times

After submission, WhatsApp reviews the template content against its messaging policies. The typical review time is **1–2 business days**. You can monitor the current status at any time under **Messaging** > **Templates** in the dashboard.

## Template statuses

| Status     | Description                                                                  |
| ---------- | ---------------------------------------------------------------------------- |
| `pending`  | Submitted and awaiting review by WhatsApp.                                   |
| `approved` | Approved and ready to use in messages and campaigns.                         |
| `rejected` | Not approved. The dashboard shows the rejection reason. Revise and resubmit. |

<Tip>
  Use **specific, concrete variable placeholders** and provide example values when submitting your template. Templates are frequently rejected when reviewers cannot determine what a variable like `{{1}}` will contain. For example, annotate your submission with examples: `{{1}} = "#1234"`, `{{2}} = "24 June 2026"`.
</Tip>

<Warning>
  Modifying an approved template — even minor wording changes — requires you to re-submit it for approval. The existing approved version remains active until the revised version is reviewed. Plan template updates ahead of any scheduled campaigns that depend on them.
</Warning>

***

<CardGroup cols={3}>
  <Card title="Campaigns" icon="bullhorn" href="/messaging/campaigns">
    Use approved templates to power WhatsApp broadcast campaigns.
  </Card>

  <Card title="Contacts" icon="address-book" href="/messaging/contacts">
    Manage the contact lists your template messages are sent to.
  </Card>

  <Card title="Sender IDs" icon="id-badge" href="/messaging/sender-ids">
    Register a WhatsApp Sender ID to pair with your approved templates.
  </Card>
</CardGroup>
