Skip to main content

Templates API - V2

See Also

Looking to manage templates (create, update, delete)? See the Template Management API.

WhatsApp allows you to send pre-approved message templates to users without them having to interact with your WhatsApp Business number first.

Overview

  • Your template must be approved by WhatsApp before you can use it. Our team can help you with this.
  • Each template must be categorised as either MARKETING, UTILITY or AUTHENTICATION.
  • Templates can include:
    • parameters for personalisation (e.g. name, order number or anything else)
    • a text, image, video, document or location header
    • up to three buttons (Quick Reply, Link or Call)
    • a carousel of cards, each with its own media header, body text, and buttons

See the authentication page for how to obtain a bearer token.

Send a Template Message

V2 uses a flat, intuitive structure with body_variables as an ordered list of values, header as a single object, and typed buttons[]/cards[] arrays.

POST https://api.cuedesk.com/v2/messages/whatsapp
Authorization: Bearer <token>
Content-Type: application/json

Examples

{
"to": "447592850122",
"from": "447576209857",
"client_reference": "order-confirmation-123",
"template": {
"name": "order_confirmation",
"locale": "en",
"body_variables": ["Alex", "ORD-12345", "25 Jan 2025"]
}
}

Request Body

FieldTypeRequiredDescription
tostringYesRecipient WhatsApp number with country code (no leading +)
fromstringYesYour WhatsApp Business number (channel identifier)
client_referencestringNoCustom reference ID returned in webhook status updates (max 255 chars)
templateobjectYesTemplate definition (see below)

Template Object

FieldTypeRequiredDescription
namestringYesName of the approved WhatsApp template
localestringYesLanguage code (e.g. en, pt_BR)
headerobjectNoHeader media or text
body_variablesarray[string]NoOrdered values for body placeholders. Position 0 replaces {{1}}, position 1 replaces {{2}}, etc.
buttonsarrayNoButton parameters
cardsarrayNoCard definitions for carousel templates
FieldTypeRequiredDescription
typestringNoMedia type: image, video, document
linkstringNoURL of the media file
filenamestringNoDisplay filename for document type headers
info

You cannot override your template's header with a different media type. If the template has an image header, only provide an image URL.

Buttons

FieldTypeRequiredDescription
indexintegerYesZero-based position of the button in the template
typestringYesButton type: URL, QUICK_REPLY, or OTP
titlestringNoQuick-reply button payload text. Required for QUICK_REPLY
urlstringNoDynamic URL suffix. Required for URL type
otp_codestringNoOne-time password code. Required for OTP type

Cards

FieldTypeRequiredDescription
indexintegerYesZero-based position of the card
headerobjectNoCard media header (same structure as above)
body_variablesarray[string]NoOrdered values for this card's body placeholders
buttonsarrayNoCard button parameters (same structure as above)
info

You can include both top-level body_variables (for the template greeting above the carousel) and per-card body_variables in the same request. Top-level header is not supported on carousel templates — headers are defined per card only.

Response

202 Accepted

{
"id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
FieldTypeDescription
idstringUnique message identifier. Use to correlate with webhook status updates

Error Responses

400 Bad Request:

{
"message": "Template 'order_confirmation' not found or not approved for locale 'en'"
}

403 Forbidden:

{
"detail": "Could not send message. Invalid channel."
}

429 Too Many Requests — Channel rate limit exceeded. Retry after a brief delay.