Send Template Message (Contact ID)
Send Template Messages
Send Template Message (Id)
Send a WhatsApp template message to a contact using their contact ID. Templates can include text/media headers, body with variables, footers, and buttons.
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!"
- 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\}\}!"
- 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)
- Allowed types: jpg, jpeg, png
- Maximum size: 5 MB (5120 KB)
5. Video Header Template
Using Video URL
Uploading Video File
- Allowed type: video/mp4
- Maximum size: 16 MB (16384 KB)
6. Document Header Template
Using Document URL
Uploading Document File
- Allowed type: application/pdf
- Maximum size: 30 MB (30720 KB)
7. Authentication/OTP Template
For one-time password templates:- Variables max 11 characters
- No links allowed in variables
8. URL Button with Variables
Template with dynamic URL button:https://example.com/promo/\{\{1\}\}
- 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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the workspace.
ID of the contact.