Prerequisites
- A workspace with a live line.
- A Messages API key with
comms_send. - A phone number you control for testing (
toin E.164).
Request
Fields
| Field | Required | Notes |
|---|---|---|
to | One of to / conversation_id | E.164, e.g. +12125550147 |
conversation_id | One of to / conversation_id | Continue an existing thread |
body | Yes | Plain text for SMS / iMessage |
channel | No | "sms" or "imessage" when you want to prefer one |
idempotency_key | No | Same as header; either works |
Auth
comms_send → 403 with { "error": "missing comms_send scope" }.
Response
Accepted
202 — Comms accepted the message for delivery.Duplicate
200 — Same idempotency key already processed. No second send.Idempotency
Use a stable key derived from your business event:Channels
| Value | Behavior |
|---|---|
| omitted | Comms picks the best path for that recipient |
"imessage" | Prefer iMessage when available |
"sms" | Force SMS |
channel unless you have a product reason.
Continuing a thread
First touch:Checklist for production
Key lives only on the server
Key lives only on the server
Inject
COMMS_API_KEY from your secret store. Never embed it in a frontend bundle.Every send has an Idempotency-Key
Every send has an Idempotency-Key
Derive it from the domain event so retries are safe.
Log status + message id
Log status + message id
Persist
message.id and HTTP status so support can trace a send without reading phone logs.Handle 429
Handle 429
Back off using
retry_after when present. See Errors & rate limits.
