Messages API
The Messages API allows you to send and receive WhatsApp messages directly from your custom applications. You can send free-form text messages or pre-approved WhatsApp Business Templates.
Authentication
All requests to the Messages API must include your API key in the Authorization header:
Authorization: Bearer sydx_your_api_key_here
Send Message
Send a WhatsApp message to a specific contact.
Endpoint
POST /api/v1/messages/send
Payload (Text)
{
"contactId": "919876543210",
"type": "text",
"content": "Hello from Sydx AI! This is a test message via API."
}
Payload (Template)
{
"contactId": "919876543210",
"type": "template",
"templateName": "welcome_confirmation",
"templateLanguage": "en",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Customer Name" },
{ "type": "text", "text": "Order ID #12345" }
]
}
]
}
CURL Example (Text Message)
curl -X POST https://sydxai.com/api/v1/messages/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contactId": "9193901XXXXX",
"type": "text",
"content": "Hey! Looking forward to our meeting today."
}'
Message Status Codes
| Status | Meaning |
|---|---|
sent | 📤 Message sent to Meta's server |
delivered | 📥 Message delivered to the recipient's phone |
read | 👁️ Message read by the recipient |
failed | ❌ Message delivery failed |
Get Message History
Retrieve the conversation history for a specific contact.
Endpoint
GET /api/v1/messages/:contactPhone
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | number | Page number (default: 1) |
limit | number | Messages per page (default: 50) |
CURL Example
curl -X GET https://sydxai.com/api/v1/messages/9193901XXXXX \
-H "Authorization: Bearer YOUR_API_KEY"
Media Support
To send media (images, docs, video), use the type: "media" and provide a public URL:
{
"contactId": "919876543210",
"type": "image",
"mediaUrl": "https://your-website.com/image.jpg",
"caption": "Check out our new catalog!"
}
Webhook Updates
To receive real-time updates when message status changes (sent → delivered → read), subscribe to the message.received and message.updated events in Outbound Webhooks.