Skip to main content
DocsAPIAPI tin nhắn

API tin nhắn

Gửi tin nhắn qua các kênh WhatsApp, Email và SMS. Truy xuất các cuộc hội thoại và lịch sử tin nhắn.

POST/whatsapp/send

Send a WhatsApp message using an approved template or freeform text (within 24h window).

POST /api/whatsapp/send
Content-Type: application/json

{
  "to": "+12025551234",
  "type": "template",
  "template": {
    "name": "welcome_message",
    "language": "en",
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "John" }
        ]
      }
    ]
  }
}

// Response
{
  "success": true,
  "data": {
    "messageId": "msg_abc123",
    "status": "SENT",
    "timestamp": "2025-03-26T10:00:00Z"
  }
}

POST/email/send

Send an email to one or more recipients.

POST /api/email/send
Content-Type: application/json

{
  "to": "[email protected]",
  "subject": "Welcome to BeeCastly!",
  "html": "<h1>Hello!</h1><p>Thanks for signing up.</p>",
  "replyTo": "[email protected]"
}

POST/sms/send

Send an SMS via your configured provider.

POST /api/sms/send
Content-Type: application/json

{
  "to": "+14155551234",
  "message": "Your OTP is 123456. Valid for 10 minutes."
}

GET/conversations

List all conversations with pagination. Filter by channel.

GET /api/conversations?channel=WHATSAPP&page=1&limit=20

// Response
{
  "success": true,
  "data": {
    "conversations": [
      {
        "id": "conv_abc123",
        "contactId": "contact_def456",
        "channel": "WHATSAPP",
        "status": "ACTIVE",
        "lastMessageAt": "2025-03-26T09:30:00Z",
        "lastMessageText": "Thanks for the info!",
        "aiEnabled": true,
        "messageCount": 12
      }
    ],
    "total": 350
  }
}

GET/conversations/:id/messages

Retrieve all messages in a conversation.