Create a WhatsApp template
create_whatsapp_templateCreate a WhatsApp template
Submits a new template on one of the agent's WhatsApp numbers for Meta's review, the same as
creating it in the dashboard. The answer is 201 with the template, usually pending:
only an approved template can be sent. Follow Meta's review with getWhatsAppTemplate; a
rejected template says why in rejected_reason.
category is marketing, utility or authentication; Meta may file it under another
one, and the answer shows where it went. A marketing or utility template has a body and
may have a header, a footer and buttons. Variables are {{1}}, {{2}}… in order, or
lower-case names such as {{first_name}}, one style for the whole template, and each needs
a sample (body_examples, header.example) for Meta's review. An image, video or document
header needs media_url: an https link to a sample file (JPEG or PNG, MP4, PDF) of up to
16 MB, which Mojeeb downloads once and hands to Meta. It must answer 200 with the file
itself, as redirects aren't followed, with the file's type as its Content-Type, and point
at a public address. An authentication template has only otp:
Meta writes its text, the code and a sentence around it, in the template's language.
Everything Mojeeb can check is checked before Meta sees the template, so a mistake is a
422 naming the field (param); what only Meta can judge comes back as
422 template_rejected with Meta's reason. A name already used in this language is
409 template_name_taken, which is also what a create retried after a lost response
meets: read the list and carry on. Location headers, carousels and limited-time offers are
made in WhatsApp Manager, as Mojeeb can't send them yet; catalog and Flow buttons are made
there too, as this endpoint can't create them, and a template approved with one is sent with
sendWhatsAppTemplate. Every call reaches Meta, so this endpoint shares the
templates' budget of 10 requests a minute per key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| otp | No | An authentication template's code button. A send passes the code as `otp_code` (and as the body's `{{1}}`). | |
| body | No | The text. Variables are `{{1}}`, `{{2}}`… in order, or lower-case names such as `{{first_name}}`: one style in the header and body together. | |
| name | Yes | Lower-case letters, digits and underscores. With `language`, it names one language version; a name can have several. | |
| footer | No | Plain text, no variables. | |
| header | No | ||
| buttons | No | Quick replies kept together, before or after the other buttons; at most 2 `url`, 1 `phone_number` and 1 `copy_code`. | |
| agent_id | Yes | The agent the resource belongs to. Another company's agent, or the nil UUID, is `404 agent_not_found`; an agent outside the key's agent list is `403 agent_not_authorized`. | |
| category | Yes | ||
| language | Yes | Meta's code for the language, such as `en`, `ar` or `en_US`. | |
| body_examples | No | A sample for each body variable, keyed by its number (`"1"`) or name, as a send's `template.parameters`; Meta reviews the template with them. | |
| connection_id | Yes | A connection of the agent. Another agent's connection is `404 not_found`. | |
| message_send_ttl_seconds | No | How long Meta keeps trying to deliver a send of this template: 30 to 900 for authentication, 30 to 43200 for utility, or -1 for 30 days. Not for marketing. |