Skip to Content
MessagingSending Messages & Parts

Sending Messages & Parts

Your agent sends messages through one of two endpoints—both return 202 Accepted immediately once queued:

  • Reply in an existing conversation: POST /api/v1/conversations/:id/messages
  • Start a conversation (or reuse an open one with a known recipient): POST /api/v1/messages

Replying vs. Starting a Conversation

# Reply in a conversation curl -X POST https://app.msend.dev/api/v1/conversations/cnv_xxx/messages \ -H "Authorization: Bearer msk_xxx" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: reply-42" \ -d '{ "text": "Thanks, we are on it.", "in_reply_to": "msg_xxx" }' # Start a conversation with a known recipient curl -X POST https://app.msend.dev/api/v1/messages \ -H "Authorization: Bearer msk_xxx" \ -H "Content-Type: application/json" \ -d '{ "channel_id": "chn_xxx", "to": { "kind": "email", "external_id": "ada@example.com" }, "subject": "Hello", "text": "Hi Ada" }'

Text vs. Typed parts

Send either text (shorthand for a single text part) or parts (an array of typed content objects), never both. You can also attach arbitrary metadata JSON, which is stored and returned with the message.

Supported parts types:

Part TypePurpose
textPlain or lightly formatted text content.
imageImage attachment (by attachment_id or link).
audioAudio clip or voice note.
videoVideo clip.
fileGeneric document or file attachment.
locationGeographic coordinates / place.
buttonsInteractive choice buttons (title + id).
listSelectable list of options.
templatePre-approved template (WhatsApp).
reactionEmoji reaction to an existing message.

Delivery Lifecycle

  1. POST validates the request, channel status, consent policy, and service window, then creates a queued message (202 Accepted).
  2. A background job hands the message to the channel adapter and paces sends per channel (default 5/sec, or provider limit).
  3. Status updates flow back as message.status events: sending → sent → delivered → read (or failed with error_code and error_detail).

Always pass an Idempotency-Key header on sends. Repeating a request with the same key and body returns the original message with 200 OK; reusing the key with a different body returns 422.

Last updated on