Skip to main content
POST
Send Template Message (Contact ID)

Description

This endpoint allows you to send WhatsApp template messages to a contact using their contact ID. Templates can include various components such as headers (text/media), body text with variables, footers, and buttons.

Template Components

Templates may contain the following components:
  • Header: Text (with variables) or Media (image, video, document)
  • Body: Message text with dynamic variables ({{1}}, {{2}}, etc.)
  • Footer: Static footer text
  • Buttons: URL buttons (with variables), phone buttons, or quick reply buttons

Request Payload Structure

Basic Structure


Examples by Template Type

1. Simple Body-Only Template

For templates with only body text and no variables:

2. Body with Variables

Template body: "Hello \{\{1\}\}, your order \{\{2\}\} is confirmed!"
Validation Rules:
  • Maximum 20 variables in body
  • Each variable max 1000 characters
  • Total body length (with variables) max 1024 characters
  • Authentication templates: variables max 11 characters, no links allowed

3. Text Header with Variables

Template header: "Welcome \{\{1\}\}!"
Validation Rules:
  • Maximum 1 variable in text header
  • Variable max 60 characters
  • Total header length (with variables) max 60 characters

4. Image Header Template

Option A: Using Image URL (JSON)

Option B: Uploading Image File (multipart/form-data)

Validation Rules:
  • Allowed types: jpg, jpeg, png
  • Maximum size: 5 MB (5120 KB)

5. Video Header Template

Using Video URL

Uploading Video File

Validation Rules:
  • Allowed type: video/mp4
  • Maximum size: 16 MB (16384 KB)

6. Document Header Template

Using Document URL

Uploading Document File

Validation Rules:
  • Allowed type: application/pdf
  • Maximum size: 30 MB (30720 KB)

7. Authentication/OTP Template

For one-time password templates:
Validation Rules:
  • Variables max 11 characters
  • No links allowed in variables

8. URL Button with Variables

Template with dynamic URL button: https://example.com/promo/\{\{1\}\}
Validation Rules:
  • Each URL button variable max 2000 characters
  • Number of variables must match template definition

9. Multiple URL Buttons with Variables

For templates with multiple URL buttons:

10. Complex Template (All Components)

Image header + body variables + URL button with variable:

Media File Requirements

Image Header

  • Required: When template has image header
  • Allowed types: jpg, jpeg, png
  • Maximum size: 5 MB (5120 KB)

Video Header

  • Required: When template has video header
  • Allowed type: mp4
  • Maximum size: 16 MB (16384 KB)

Document Header

  • Required: When template has document header
  • Allowed type: PDF
  • Maximum size: 30 MB (30720 KB)

Complete Example with cURL


Error Responses

Invalid Template ID

Missing Required Variables

Variable Count Mismatch

Body Text Too Long

Invalid Media File


Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspace
string<uuid>
required

ID of the workspace.

contact
string<uuid>
required

ID of the contact.

Body

template_id
integer
required

ID of the approved template to send.

Example:

123

template_data
object

Template data containing variables and media files. Structure depends on template configuration.

Response

status
integer
required
Example:

201

message
string
required
Example:

"Resource created successfully."

data
object
required

Created resource data.