Skip to main content

Messaging API Endpoints

Complete API reference for messaging endpoints.

Send Message

Send a message via any channel (WhatsApp, SMS, Email, IVR).

POST /api/messages/send
Authorization: Bearer {token}
Content-Type: application/json

{
"channel": "whatsapp",
"to": "+919876543210",
"message": "Hello, this is a test message",
"template_id": "optional_template_id"
}

Parameters

ParameterTypeRequiredDescription
channelstringYesChannel: whatsapp, sms, email, ivr
tostringYesRecipient phone/email
messagestringYesMessage content
template_idstringNoTemplate ID (for WhatsApp)
media_urlstringNoMedia URL (for WhatsApp)

Response

{
"success": true,
"message": "Message sent successfully",
"data": {
"id": "msg_123",
"status": "sent",
"channel": "whatsapp",
"to": "+919876543210"
}
}

Broadcast Message

Send a message to multiple recipients.

POST /api/messages/broadcast
Authorization: Bearer {token}
Content-Type: application/json

{
"channel": "whatsapp",
"recipients": ["+919876543210", "+919876543211"],
"message": "Broadcast message",
"segment_id": "optional_segment_id"
}

Response

{
"success": true,
"message": "Broadcast initiated",
"data": {
"campaign_id": "camp_123",
"total_recipients": 100,
"status": "queued"
}
}

Message History

Retrieve message history.

GET /api/messages/history
Authorization: Bearer {token}

Query Parameters

  • page: Page number
  • per_page: Items per page
  • channel: Filter by channel
  • status: Filter by status
  • date_from: Start date
  • date_to: End date

Response

{
"success": true,
"data": {
"data": [
{
"id": "msg_123",
"channel": "whatsapp",
"to": "+919876543210",
"message": "Hello",
"status": "delivered",
"sent_at": "2024-01-01T00:00:00Z"
}
],
"current_page": 1,
"total": 100
}
}

Next Steps


Need help? Contact Support