Skip to main content

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"
}
FieldTypeDescription
idintegerThe message id. Use it to spot duplicates — there is no separate delivery id.
directionstringreceived (inbound to your number) or sent (outbound from it).
startTimestringRFC 3339 UTC. Named startTime, not time.
fromNumberstringSender, in full international format (with a country code).
toNumberstringRecipient, in full international format (with a country code).
messagestringThe body. Can contain anything the sender typed — escape it before showing it in a web page.
mediastringMMS attachments, as a JSON-encoded array of URLs inside a string — see below. Empty for a plain SMS.
webhookTypestringAlways AccountSMS.
fromNumber and toNumber swap with direction

On 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 AccountSMS event for it too, with direction: "sent". So an auto-responder that replies to every AccountSMS would see its own outgoing replies and answer those as well, looping forever. React only to incoming messages: filter on direction == "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. AccountSMS is about individual messages only.
  • An outbound group message has toNumber: "0". A message sent to a group arrives with toNumber set 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.