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 Type | Purpose |
|---|---|
text | Plain or lightly formatted text content. |
image | Image attachment (by attachment_id or link). |
audio | Audio clip or voice note. |
video | Video clip. |
file | Generic document or file attachment. |
location | Geographic coordinates / place. |
buttons | Interactive choice buttons (title + id). |
list | Selectable list of options. |
template | Pre-approved template (WhatsApp). |
reaction | Emoji reaction to an existing message. |
Delivery Lifecycle
POSTvalidates the request, channel status, consent policy, and service window, then creates aqueuedmessage (202 Accepted).- A background job hands the message to the channel adapter and paces sends per channel (default 5/sec, or provider limit).
- Status updates flow back as
message.statusevents:sending→sent→delivered→read(orfailedwitherror_codeanderror_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