AccountSMS
Fires when a text message is sent or received on any of the account's
numbers — including messages sent from the portal's message center and from
POST /sms/messages.
Payload
{
"id": 88214417,
"direction": "received",
"startTime": "2026-08-11T13:20:01Z",
"fromNumber": "13475550123",
"toNumber": "12125550188",
"message": "Can we move Tuesday to 9am?",
"media": "",
"webhookType": "AccountSMS"
}
| Field | Type | Description |
|---|---|---|
id | integer | The message id. Use it to spot duplicates — there is no separate delivery id. |
direction | string | received (inbound to your number) or sent (outbound from it). |
startTime | string | RFC 3339 UTC. Named startTime, not time. |
fromNumber | string | Sender, in full international format (with a country code). |
toNumber | string | Recipient, in full international format (with a country code). |
message | string | The body. Can contain anything the sender typed — escape it before showing it in a web page. |
media | string | MMS attachments, as a JSON-encoded array of URLs inside a string — see below. Empty for a plain SMS. |
webhookType | string | Always AccountSMS. |
fromNumber and toNumber swap with directionOn a received message, toNumber is your line. On a sent message,
fromNumber is. Pick the field by direction — do not assume either position is
yours.
Reacting to it
The two numbers are exactly what the conversation endpoints take — a conversation has no id, it is the pair — so you can act on the thread with no lookup first:
# your line = toNumber, other party = fromNumber, on a received message
curl -X POST ".../sms/conversations/12125550188/13475550123/resolve" \
-H "Authorization: Bearer $TB_KEY"
MMS media
media is a string containing a JSON array of URLs — not an array, not a
single URL:
"media": "[\"https://mms.example.net/9f2c/photo.jpg\"]"
Parse it, but keep a fallback. A few older events set media to a single plain URL
— just https://…/photo.jpg, with none of the ["…"] array wrapping — which isn't
valid JSON. When JSON.parse fails on a value like that, treat the whole thing as
one URL:
function mediaUrls(media) {
if (!media) return [];
try {
const parsed = JSON.parse(media);
return Array.isArray(parsed) ? parsed : [String(parsed)];
} catch {
return [media]; // not JSON: treat the whole value as one URL
}
}
The URLs need no login or key, so anyone who has one can open the attachment. They are also not permanent — download the file when the event arrives rather than storing the link.
Delivery status
This event fires when a message is recorded on the account. For a message you
send, that only means the carrier accepted it for sending — not that it reached
the recipient's phone. There is no delivered or failed event afterward, so
webhooks can't tell you whether a sent message actually arrived.
Gotchas
- Messages you send also trigger this event. When you send a text — through the
API or the portal — you get an
AccountSMSevent for it too, withdirection: "sent". So an auto-responder that replies to everyAccountSMSwould see its own outgoing replies and answer those as well, looping forever. React only to incoming messages: filter ondirection == "received". - Only messages trigger this event — not thread actions. Resolving, reopening,
or assigning a conversation (in the portal or the API) sends no webhook at all.
AccountSMSis about individual messages only. - An outbound group message has
toNumber: "0". A message sent to a group arrives withtoNumberset to"0"instead of a real number, and the payload does not include the group's participants — so this event alone won't tell you who received it.