Texts
Send a text
POST /Accounts/{AccountSid}/Messages.json with To, From (your line's number) and Body (1-1600 characters).
The answer is 201, status queued, with num_segments: a part holds 153 GSM-7 or 67 UCS-2 characters.
Not in v1, each refused with a code that names it: MediaUrl (711001), and messaging services,
content templates, scheduling, link shortening and validity periods (710003).
Status
queued, then sent. delivered and undelivered come later, once the dongle's delivery reports are built:
until then sent is the last status (see How a dongle line behaves).
failed comes with error_code 710002 and a reason from the list below. A text refused
when you POST it answers 400, "The text can't be sent:" followed by the reason's words. A text that fails after it
was accepted reports its reason on the Message and to its StatusCallback.
reason |
In words |
|---|---|
recipient |
That number can't be texted from this line |
too_long |
The text is too long |
content |
The text has characters that can't be sent |
invalid |
The text isn't valid |
line_rate_limited |
This line's text limit is reached |
line_busy |
Too many texts are waiting on this line: try again shortly |
line_suspended |
The line isn't active: not rented, moving, or ended |
dongle_offline |
The line's dongle isn't connected right now |
send_failed |
The text couldn't be sent |
unknown |
It isn't known whether the text went out: check before sending it again |
temporarily_unavailable |
The line is briefly unavailable: try again shortly |
unknown: we lost track of the text while it was going out, or only part of a long text went. We never send it again by ourselves, so check before you do.line_rate_limitedis a text that met your line's limit after it was accepted. A POST past the limit is refused at once with 710001 andreopens_at(see Limits).
A text sent as a TwiML <Message> reply has direction outbound-reply.
Receive texts
Set your line's SmsUrl. Incoming texts are never lost while your server or ours is down: they wait on the SIM and
arrive late. A text over 1600 characters arrives as several Messages, never cut short.
Privacy
- Redact a body:
POST /Accounts/{AccountSid}/Messages/{Sid}.jsonwithBody=(empty). That's the only change a message allows: any otherBodyis 710004. - Delete a record:
DELETE /Accounts/{AccountSid}/Messages/{Sid}.json. - Kept 3 months: texts and calls are kept for 3 months (90 days), then deleted with their bodies. Older ones are gone from every list and lookup.