Skip to main content
Glama

Create a WhatsApp template

create_whatsapp_template

Create 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

NameRequiredDescriptionDefault
otpNoAn authentication template's code button. A send passes the code as `otp_code` (and as the body's `{{1}}`).
bodyNoThe text. Variables are `{{1}}`, `{{2}}`… in order, or lower-case names such as `{{first_name}}`: one style in the header and body together.
nameYesLower-case letters, digits and underscores. With `language`, it names one language version; a name can have several.
footerNoPlain text, no variables.
headerNo
buttonsNoQuick replies kept together, before or after the other buttons; at most 2 `url`, 1 `phone_number` and 1 `copy_code`.
agent_idYesThe 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`.
categoryYes
languageYesMeta's code for the language, such as `en`, `ar` or `en_US`.
body_examplesNoA 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_idYesA connection of the agent. Another agent's connection is `404 not_found`.
message_send_ttl_secondsNoHow 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / header / properties / media_url / description
      Previous value: -"An image, video or document header's sample: an https link to a JPEG or PNG, MP4 or PDF file of up to 16 MB that answers `200` itself (no redirects), with the file's type as its `Content-Type`, from a public address. Required to create; on an edit, leave it out to keep the current sample."New value: +"An image, video or document header's sample: an https link to a JPEG or PNG, MP4 or PDF file of up to 16 MB that answers `200` itself (no redirects), with the file's type as its `Content-Type`, from a public address, or the `url` of a Mojeeb upload of this agent (`createUpload`). Required to create; on an edit, leave it out to keep the current sample."
  2. Added

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations (readOnly=false, openWorld=true, idempotent=false, destructive=false): it discloses the 201 response with a usually-pending template, that only approved templates can be sent, the review lifecycle, the 422/409 error taxonomy with error codes, the specific trap that a retried create after a lost response meets 409 template_name_taken, and the 10 requests/minute per-key budget. The media_url fetch contract (no redirects, must answer 200 with Content-Type, public address, 16 MB cap, downloaded once) is behavioral detail an agent could not infer.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and outcome, then organized by category/body, media, and error/rate-limit concerns — a sensible order for a 12-parameter nested tool. It is long, and the media_url rules restate almost exactly what the schema description already says, which is the main waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description must carry return-value semantics, and it does: the 201 shape, the pending/approved/rejected states, rejected_reason, and field-level 422 vs. template_rejected 422 vs. 409 name collision. Combined with the variable, media and rate-limit rules, nothing an agent needs to call this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 83%, so the schema carries most parameter documentation; the description still adds meaning the schema does not, notably that Meta may re-file a category and the response shows where it went, the one-variable-style-for-the-whole-template rule, and the authentication-template shape (only `otp`, Meta writes the text). Much of the media_url explanation duplicates the schema verbatim, limiting it to a 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource and immediately scopes it: 'submits a new template on one of the agent's WhatsApp numbers for Meta's review,' with the explicit analogy to the dashboard. It routes the reader to the correct siblings by name (getWhatsAppTemplate for review status, sendWhatsAppTemplate for sending), so it is clearly distinguishable from list/get/update/send template tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete when-to-use context (creating in the dashboard vs. here) and explicit when-not guidance: location headers, carousels, limited-time offers, catalog and Flow buttons must be made in WhatsApp Manager because this endpoint cannot create them. It also tells the agent how to handle a retried create (read the list and carry on). It does not explicitly contrast against update_whatsapp_template, but the create-vs-edit boundary is implied by the media_url 'on an edit' note.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources