Send Message
Send a WhatsApp template message to a recipient.
Endpoint
POST /api/v1/message/send
Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your API key |
Content-Type | Yes | Must be application/json |
Request Body
{
"to": "919876543210",
"template": "order_confirmation",
"language": "en",
"variables": {
"1": "John Doe",
"2": "ORD-12345",
"3": "₹1,499"
},
"externalId": "your-reference-123",
"accountId": "wa_account_id"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number with country code (no + prefix) |
template | string | Yes | Template name (must be approved by WhatsApp) |
language | string | Yes | Template language code (e.g., en, hi, en_US) |
variables | object | No | Template variables as key-value pairs |
externalId | string | No | Your reference ID for tracking (returned in webhooks) |
accountId | string | No | Specific WhatsApp account ID (uses default if not provided) |
Phone Number Format
The to field must be a phone number with country code, without the + prefix:
| Format | Valid |
|---|---|
919876543210 | Yes |
+919876543210 | No |
9876543210 | No |
91-9876543210 | No |
Variables
Template variables are numbered placeholders in your approved template. Provide them as an object with string keys:
{
"variables": {
"1": "First variable",
"2": "Second variable",
"3": "Third variable"
}
}
For example, if your template is:
Hello {{1}}, your order {{2}} has been shipped!
You would provide:
{
"variables": {
"1": "John Doe",
"2": "ORD-12345"
}
}
Response
Success (200)
{
"success": true,
"data": {
"messageId": "msg_abc123xyz",
"waMessageId": "wamid.HBgLMTIzNDU2Nzg5MA==",
"status": "sent",
"to": "919876543210",
"template": "order_confirmation",
"externalId": "your-reference-123"
}
}
| Field | Description |
|---|---|
messageId | GB Chat internal message ID |
waMessageId | WhatsApp message ID |
status | Message status (sent) |
to | Recipient phone number |
template | Template name used |
externalId | Your reference ID (if provided) |
Error Responses
Validation Error (400)
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Phone number is required"
}
}
Template Not Found (404)
{
"success": false,
"error": {
"code": "TEMPLATE_NOT_FOUND",
"message": "Template 'order_shipped' not found or not approved"
}
}
No Active WhatsApp Account (400)
{
"success": false,
"error": {
"code": "NO_ACTIVE_ACCOUNT",
"message": "No active WhatsApp account available"
}
}
Examples
Basic Message
curl -X POST https://inboxapi.workmatic.in/api/v1/message/send \
-H "X-API-Key: gbk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"template": "hello_world",
"language": "en"
}'
Message with Variables
curl -X POST https://inboxapi.workmatic.in/api/v1/message/send \
-H "X-API-Key: gbk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"template": "order_shipped",
"language": "en",
"variables": {
"1": "John Doe",
"2": "ORD-12345",
"3": "Feb 10, 2024"
},
"externalId": "order-12345"
}'
Using a Specific WhatsApp Account
curl -X POST https://inboxapi.workmatic.in/api/v1/message/send \
-H "X-API-Key: gbk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"template": "appointment_reminder",
"language": "en",
"variables": {
"1": "Dr. Smith",
"2": "Tomorrow at 10:00 AM"
},
"accountId": "67890abcdef"
}'
Template Requirements
Approval Status
Only templates with APPROVED status can be used. Check your template status in the Dashboard.
Template Components
Templates can have multiple components:
- HEADER - Text, image, video, or document
- BODY - Main message text with variables
- FOOTER - Optional footer text
- BUTTONS - Call-to-action or quick reply buttons
Currently, the API supports BODY variables only. Header media and button parameters will be supported in a future update.
Common Templates
| Template | Purpose | Variables |
|---|---|---|
hello_world | Test message | None |
order_confirmation | Order placed | Order ID, amount |
order_shipped | Shipment notification | Customer name, order ID, delivery date |
appointment_reminder | Appointment reminder | Doctor name, date/time |
payment_received | Payment confirmation | Amount, transaction ID |
Rate Limiting
This endpoint is subject to rate limiting. Default: 60 requests per minute.
Try It Out
Test the API directly from your browser. Enter your API key and send a test message.
This will send a real message to the phone number you enter. Use your own number for testing.