Docs/Messages

Messages

Send and receive messages across all connected channels. The Messages API provides a unified interface regardless of whether the message goes via WhatsApp, web chat, or email.

Send a Message

POST/v1/messages

Send a message to a customer on any connected channel. HanDl automatically routes the message through the correct channel based on the conversation context.

ParameterTypeDescription
conversation_id
Required
stringThe conversation to send the message in.
body
Required
stringThe message content. Supports plain text. Max 4096 characters.
type
Optional
stringMessage type: 'text', 'image', 'template'. Defaults to 'text'.
media_url
Optional
stringURL of the media attachment. Required when type is 'image'.
metadata
Optional
objectArbitrary key-value pairs to attach to the message.
curl
curl -X POST https://api.handl-ng.com/v1/messages \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "conversation_id": "conv_8xk2m",
    "body": "Hi! Your order #1042 has been shipped 🚚",
    "metadata": {
      "order_id": "ord_abc123"
    }
  }'
javascript
const res = await fetch('https://api.handl-ng.com/v1/messages', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_live_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    conversation_id: 'conv_8xk2m',
    body: 'Hi! Your order #1042 has been shipped 🚚',
    metadata: { order_id: 'ord_abc123' },
  }),
});

const message = await res.json();
console.log(message.id); // "msg_xyz789"

Response

json
{
  "id": "msg_xyz789",
  "object": "message",
  "conversation_id": "conv_8xk2m",
  "body": "Hi! Your order #1042 has been shipped 🚚",
  "type": "text",
  "direction": "outbound",
  "channel": "whatsapp",
  "status": "sent",
  "metadata": {
    "order_id": "ord_abc123"
  },
  "created_at": "2025-06-15T14:30:00Z"
}

List Messages

GET/v1/messages

Retrieve messages, optionally filtered by conversation.

ParameterTypeDescription
conversation_id
Optional
stringFilter by conversation.
direction
Optional
string'inbound' or 'outbound'.
limit
Optional
integerNumber of results (1–100). Default 25.
starting_after
Optional
stringCursor for pagination. Pass the last message ID.
curl
curl "https://api.handl-ng.com/v1/messages?conversation_id=conv_8xk2m&limit=10" \
  -H "Authorization: Bearer sk_live_..."

Response

json
{
  "object": "list",
  "data": [
    {
      "id": "msg_xyz789",
      "body": "Hi! Your order #1042 has been shipped 🚚",
      "direction": "outbound",
      "status": "delivered",
      "created_at": "2025-06-15T14:30:00Z"
    }
  ],
  "has_more": true
}

Retrieve a Message

GET/v1/messages/:id
curl
curl https://api.handl-ng.com/v1/messages/msg_xyz789 \
  -H "Authorization: Bearer sk_live_..."
â„šī¸
Messages sent via the API appear in your Conversations inbox just like any other message. Your AI agent and team can see and respond to them.

Message Statuses

queuedMessage accepted by HanDl, waiting to be sent to the channel
sentMessage delivered to the channel provider (e.g., WhatsApp)
deliveredMessage confirmed delivered to the recipient
readRecipient has read the message (channel-dependent)
failedMessage could not be delivered. Check the error field.