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

# WhatsApp templates

> Create, sync and use the message templates WhatsApp requires to write first to a contact.

A template is a message model approved by Meta. It is the only kind of message a business can send to a contact outside the [24-hour window](https://docs.shortext.ny-corp.io/channels/whatsapp.md#the-24-hour-window), for example to send an order update or to start a conversation.

## Anatomy of a template

* **Name** and **language**: a template exists in one or more languages (`fr`, `en_US`...). You send it by name and language.
* **Category**: `UTILITY` (transactional updates), `MARKETING` (promotions) or `AUTHENTICATION` (one-time codes). Meta prices conversations by category.
* **Header** (optional): a text, or an image, a video or a document.
* **Body**: the text, with **variables** such as `{{name}}` and `{{order}}`.
* **Footer** (optional): a short text.
* **Buttons** (optional): quick replies, a URL, a phone number, a code to copy.

## Manage templates in the dashboard

Templates have their own page: **Communication > WhatsApp templates**. It lists the templates of all your WhatsApp Business accounts, with their category, language, status and the numbers that can send them.

* **Create** a template in the editor: choose the WhatsApp number, the name, the language and the category, then write the header, the body with its variables, the footer and the buttons. Give an example for each variable: Meta reviews the template with them.
* **Publish** submits it to Meta. The editor checks Meta's rules first (see [Rules](#rules-checked-before-publishing)), so you fix a template before it is rejected. It stays `PENDING` until Meta approves it (`APPROVED`) or rejects it (`REJECTED`, with a reason).
* **Sync with Meta** pulls the templates created directly in Meta Business Manager, and refreshes their status.
* **Use** shows the ready-to-copy code that sends the template, filled with its examples: API v2.0, PHP SDK and API v1.0.

> [!NOTE]
>
> Only `APPROVED` templates can be sent. Meta also tracks the quality of each template (green, yellow, red) from how contacts react to it.

## Three ways to create a template

| Way | For whom |
| - | - |
| The dashboard editor | Your team. |
| The API (`POST /templates`) | Your systems. See [Create WhatsApp templates](https://docs.shortext.ny-corp.io/api-reference/guides/create-templates.md). |
| A hosted link (hosted session with the `template` purpose) | Your own clients, from your product: they write their template in the Shortext editor, without a dashboard account. See [Hosted sessions](https://docs.shortext.ny-corp.io/api-reference/hosted-sessions.md). |

## Rules checked before publishing

Shortext checks Meta's main rules before submitting a template:

* a **utility** template needs at least one variable in its body; a marketing template does not;
* the body cannot **start or end with a variable**, and each variable is used once;
* a text **header** takes at most one variable; the **footer** takes none;
* at most **10 buttons**, with quick replies grouped together (before or after the other buttons), at most **2 link buttons**, **1 call button** and **1 copy-code button** (copy code only in marketing templates);
* a button text has at most **25 characters**; a dynamic link takes one variable, **at the very end** of the URL, and an example of the full link;
* an **authentication** template takes its settings instead: code expiration (1 to 90 minutes), copy-code or one-tap autofill (one-tap needs the Android package name and the signature hash of the app).

## Send a template

* From the dashboard: in a **campaign** to a segment of contacts, or from the Inbox when the window is closed.
* From the API: `POST /conversations` with `message.type` `template`. See [Send a template](https://docs.shortext.ny-corp.io/api-reference/guides/send-a-template.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.