Skip to main content
WA-Templates
API reference

Templates API

Author, clone, render, approve, and send message templates. This is the core loop: find or write a template, render it to check the payload and its SMS fallback, submit it for provider approval, then broadcast it.

GET/templatestemplates:read

Search the library

Discover templates by query, channel, and category. Sort by rating or by most-cloned.

Arguments

NameTypeInDescription
qstringqueryFree-text search over name + description.
categorystringqueryMarketplaceCategory key, e.g. EVENTS.
channelstringqueryRCS | WHATSAPP | SMS
sortstringqueryrating | useddefault: rating
pagenumberquery
pageSizenumberquery

Request

curl -X GET "https://your-server/api/agent/templates" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
search_templates

# CLI (planned)
$ wa search [query] [--channel WHATSAPP] [--category KEY]
GET/templates/:idtemplates:read

Fetch one template

Fetch one template — content, channel, ratings, clone count, and (where shared) its grounding knowledge doc.

Arguments

NameTypeInDescription
idrequiredstringpath

Request

curl -X GET "https://your-server/api/agent/templates/<id>" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
get_template

# CLI (planned)
$ wa get <id>
POST/templates/:id/rendertemplates:read

Render + validate

Try before you send: render with sample variables and inspect the validated rich payload plus the mandatory SMS fallback.

Arguments

NameTypeInDescription
idrequiredstringpath
variablesobjectbodyMerge fields ({{key}} -> value) to bind into the preview.

Request

curl -X POST "https://your-server/api/agent/templates/<id>/render" \
  -H "Authorization: Bearer $WA_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "variables": <object>
  }'

Same call, as a tool

# MCP tool name
render_template

# CLI (planned)
$ wa render <id> [--var key=value ...]
POST/templatestemplates:write

Create a draft

Author a new template from a content object. The shared validator rejects anything that breaks channel rules with machine-coded errors.

Arguments

NameTypeInDescription
namerequiredstringbody
descriptionstringbody
channelstringbodyRCS | WHATSAPP | SMS
categorystringbodyMARKETING | UTILITY | AUTHENTICATION
contentrequiredobjectbodyTemplateContent. Must include a non-empty smsFallback. One of text/card/carousel is the primary body.
tagsstring[]body

Request

curl -X POST "https://your-server/api/agent/templates" \
  -H "Authorization: Bearer $WA_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": <string>,
    "content": <object>
  }'

Same call, as a tool

# MCP tool name
create_template

# CLI (planned)
$ wa create --file <template.json>
PUT/templates/:idtemplates:write

Update a draft

Revise a draft in place, re-running the same validator that gates creation.

Arguments

NameTypeInDescription
idrequiredstringpath
namestringbody
descriptionstringbody
channelstringbodyMove the template to another channel. Requires the matching add-on brand; omit to leave it where it is.RCS | WHATSAPP
categorystringbodyMARKETING | UTILITY | AUTHENTICATION
contentobjectbodyFull replacement TemplateContent (not a deep merge). Must include a non-empty smsFallback.
tagsstring[]body
knowledgeDocstringbody

Request

curl -X PUT "https://your-server/api/agent/templates/<id>" \
  -H "Authorization: Bearer $WA_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": <string>,
    "description": <string>,
    "channel": <string>,
    "category": <string>,
    "content": <object>,
    "tags": <string[]>,
    "knowledgeDoc": <string>
  }'

Same call, as a tool

# MCP tool name
update_template

# No CLI command for this call yet —
# use the HTTP route or the MCP tool.
POST/templates/:id/duplicatetemplates:write

Fork your own template

Fork one of your own templates into a fresh draft — the in-org counterpart to cloning from the marketplace.

Arguments

NameTypeInDescription
idrequiredstringpath

Request

curl -X POST "https://your-server/api/agent/templates/<id>/duplicate" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
duplicate_template

# No CLI command for this call yet —
# use the HTTP route or the MCP tool.
DELETE/templates/:idtemplates:write

Delete a template

Remove a template you own from the org.

Arguments

NameTypeInDescription
idrequiredstringpath

Request

curl -X DELETE "https://your-server/api/agent/templates/<id>" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
delete_template

# No CLI command for this call yet —
# use the HTTP route or the MCP tool.
POST/marketplace/:id/clonemarketplace:clone

Clone into your org

Deep-copy a marketplace listing into your org as a clean private draft you fully own — no provenance carried over.

Arguments

NameTypeInDescription
idrequiredstringpath

Request

curl -X POST "https://your-server/api/agent/marketplace/<id>/clone" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
clone_template

# CLI (planned)
$ wa clone <id>
POST/templates/:id/submittemplates:submit

Submit for approval

Send a draft to the provider for brand approval and read back its approval status. Until it is approved, sends fall back to SMS.

Arguments

NameTypeInDescription
idrequiredstringpath

Request

curl -X POST "https://your-server/api/agent/templates/<id>/submit" \
  -H "Authorization: Bearer $WA_AGENT_KEY"

Same call, as a tool

# MCP tool name
submit_template

# CLI (planned)
$ wa submit <id>
POST/messages/sendmessages:send

Broadcast to recipients

Broadcast an org-owned template to an E.164 list — rich-first, with the always-on SMS/MMS fallback. Returns the delivery funnel, including how many recipients fell back.

Arguments

NameTypeInDescription
blueprintIdrequiredstringbody
torequiredstring[]body
variablesobjectbody
namestringbody

Request

curl -X POST "https://your-server/api/agent/messages/send" \
  -H "Authorization: Bearer $WA_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "blueprintId": <string>,
    "to": <string[]>
  }'

Same call, as a tool

# MCP tool name
send_message

# CLI (planned)
$ wa send <blueprintId> --to +1555... [--var key=value ...]