WhatsApp Business Templates
Outside WhatsApp’s 24-hour customer-service window Meta only delivers approved message templates, so these endpoints are what allow business-initiated messaging at all. Templates live at Meta on the connected WhatsApp Business Account (WABA), and Brainstormer keeps a local mirror so a send decision never needs a Graph API round trip. Every endpoint below resolves the agent’s connected channel to its WABA first; an agent with no active WhatsApp Business connection gets a404.
All API requests require a valid JWT token in the
Authorization: Bearer <token> header. The API Gateway decodes the JWT and forwards auth context (user-id, organization-id, user-email, x-platform-role, x-org-role) as headers to downstream services.Meta reviews templates asynchronously. A create returns immediately with
status: "PENDING" — never APPROVED — and the verdict arrives later on
Meta’s message_template_status_update webhook, which Brainstormer records
automatically. Only a template whose status is APPROVED can be sent.List Templates
Reconciles the local mirror from Meta and returns the result. This makes a Graph API call, so it is slower than a local read — don’t poll it.Response (200)
object[]
object | null
The template currently configured to carry operator replies outside the window, as
{ name, language }.object
A ready-made draft the UI offers as a starting point.
Errors
Create a Template
Files a new template with Meta. Answers201 with the stored template in its PENDING state.
Body
string
required
Lowercase letters, digits and underscores only, and unique on the WABA for this language.
string
required
Meta language code, e.g.
en_US.string
required
MARKETING, UTILITY or AUTHENTICATION.string
required
The message text. Use
{{1}}, {{2}} … for values supplied at send time. Meta rejects a body that is only a placeholder.string
Optional header text, which may also carry placeholders.
Optional footer text. Cannot contain placeholders.
object
Sample values per placeholder, as
{ header?: { "1": "…" }, body?: { "1": "…" } }. Meta requires an example for every placeholder before a reviewer will look at the template.Example
Errors
Delete a Template
Deletes at Meta first, then locally. If this template was the configured fallback, that selection is cleared in the same request. Returns204. A 404 with code whatsapp_business_template_not_found means the template is not on this account.
Set the Fallback Template
Chooses the approved template that carries an operator’s reply when the 24-hour customer-service window has closed. The operator’s own text is placed in the template’s single body placeholder.Body
string
Template name. Omit (or send an empty body) to clear the selection.
string
Template language. Required when
name is given.Response (200)
object | null
{ name, language }, or null when cleared.
