Create a template
POST /v1/templates
Creates a template and submits it to WhatsApp for review. WhatsApp approves or rejects it later.
Needs templates:write. Counts against the heavy request limit (10 a minute).
If WhatsApp refuses the template, Soosh keeps it as a DRAFT in the app, and error.details.id is the draft.
number_id string · uuid Required
The number to make the template on (see GET /v1/numbers).
name string Required
Lowercase letters, numbers and underscores, up to 255 characters. Unique per number and language.
language string Required
A WhatsApp language code, such as en or pt_BR.
category string Required
Authentication templates are made in the app.
One of MARKETING UTILITY.
body string Required
Up to 1024 characters. Variables are {{1}}, {{2}} in order, or
{{name}}; not both.
header object
A text header. Image, video and document headers are made in the app.
Show 3 child parametersHide child parameters
header.format string Required
Always TEXT.
header.text string Required
Up to 60 characters, with at most one variable.
header.example string
An example for the header’s variable. Required when it has one.
body_examples array of strings
One example for each variable of the body, in the order they first appear. Required when the body has variables.
buttons array of objects
Up to 10 buttons. Keep quick replies together, before or after the others.
Show 5 child parametersHide child parameters
Each item:
buttons[].type string Required
One of QUICK_REPLY URL PHONE_NUMBER COPY_CODE.
buttons[].text string
Up to 25 characters. Not used by COPY_CODE.
buttons[].url string
For URL. May end in {{1}}.
buttons[].phone_number string
For PHONE_NUMBER, for example +14155550123.
buttons[].example string
For URL with a {{1}}: an example for the variable. For
COPY_CODE: the sample code (up to 20 characters).
Headers
Section titled “Headers”Idempotency-Key string
Send one so a retry doesn’t create the template twice. See Retrying safely.
1 to 255 characters.
Names and languages
Section titled “Names and languages”A template is the same one only in the same language. The same name in another language is a new template.
Copy-code buttons
Section titled “Copy-code buttons”A COPY_CODE button needs an example code. Its value is required again when you send the template: variables.buttons of the template lists it, and POST /v1/messages must supply it.
Returns
Section titled “Returns”201 The template object. The template, PENDING until WhatsApp decides. Follow it with GET /v1/templates/{id} or the template.status webhook.
Errors
Section titled “Errors”Besides the ones every request can get:
invalid_fieldA field breaks a rule, such as a header that isn’t TEXT, or WhatsApp refuses the template.conflictThe name and language already exist on this number. error.details.id is the existing template.idempotency_mismatchThe Idempotency-Key was used before for a different request, or by another of your API keys.