Skip to main content

Create a WhatsApp template

POST 

/v1/agents/:agentId/connections/:connectionId/whatsapp-templates

x-scope: "whatsapp_templates:write"
x-rate-limit-per-minute: 10

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, limited-time offers, and catalog and Flow buttons are made in WhatsApp Manager, as Mojeeb can't send them yet. Every call reaches Meta, so this endpoint shares the templates' budget of 10 requests a minute per key.

Request​

Responses​

The template as Meta now holds it, usually pending.

Response Headers
    X-Correlation-ID

    Correlation id for this request — paste into support tickets.