Skip to main content

Send Message

Send a WhatsApp template message to a recipient.

Endpoint

POST /api/v1/message/send

Headers

HeaderRequiredDescription
X-API-KeyYesYour API key
Content-TypeYesMust 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

ParameterTypeRequiredDescription
tostringYesRecipient phone number with country code (no + prefix)
templatestringYesTemplate name (must be approved by WhatsApp)
languagestringYesTemplate language code (e.g., en, hi, en_US)
variablesobjectNoTemplate variables as key-value pairs
externalIdstringNoYour reference ID for tracking (returned in webhooks)
accountIdstringNoSpecific 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:

FormatValid
919876543210Yes
+919876543210No
9876543210No
91-9876543210No

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"
}
}
FieldDescription
messageIdGB Chat internal message ID
waMessageIdWhatsApp message ID
statusMessage status (sent)
toRecipient phone number
templateTemplate name used
externalIdYour 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

TemplatePurposeVariables
hello_worldTest messageNone
order_confirmationOrder placedOrder ID, amount
order_shippedShipment notificationCustomer name, order ID, delivery date
appointment_reminderAppointment reminderDoctor name, date/time
payment_receivedPayment confirmationAmount, 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.

warning

This will send a real message to the phone number you enter. Use your own number for testing.

API Tester