Inbound & opt-outs
Receive replies, handle STOP and START, and test before a number is live.
When someone replies to a number SMS21 has assigned to you, the reply is stored and sent to your webhooks, and SMS21 acts on opt-out keywords for you. Replies arrive on the same provider callback URL as delivery reports, so there is nothing extra to configure.
Numbers are assigned by SMS21
to.STOP and START are handled for you
Only the first word counts, upper-cased and without punctuation — Stop please. is a STOP. A STOP word adds the sender to your opt-out list, which every bulk campaign already honours; a START word removes them. Everything else is stored and forwarded untouched: SMS21 does not interpret your customers’ messages.
| Reply starts with | What SMS21 does | action |
|---|---|---|
| STOP, UNSUBSCRIBE, CANCEL, END, QUIT, OPTOUT | Adds the sender to your opt-out list | opt_out |
| START, UNSTOP, SUBSCRIBE, OPTIN | Removes them from it | opt_in |
| Anything else | Stores and forwards the reply | none |
Read replies
| Field | Type | Description | |
|---|---|---|---|
from | string | optional | Only replies from this number. |
to | string | optional | Only replies to this number of yours. |
action | string | optional | none, opt_out or opt_in. |
receivedFrom / receivedTo | string | optional | ISO 8601 bounds on arrival time. |
curl "https://sms21.in/v1/inbound?action=opt_out" -H "X-API-Key: $SMS21_API_KEY"The message.received webhook
Subscribe an endpoint to message.received to get replies as they arrive. Unlike the message.* status events, this payload carries the sender’s number and the text: that is the message being delivered to you. Verify the signature exactly as for other webhooks.
{
"id": "evt_…",
"event": "message.received",
"timestamp": "2026-09-16T10:30:00.000Z",
"inboundId": "inb_…",
"from": "919876543210",
"to": "919812345678",
"text": "STOP",
"keyword": "STOP",
"action": "opt_out"
}Test before a number is live
With a test key, POST /inbound/simulate delivers a reply through the sandbox as if a handset had sent it: the keyword is applied, your opt-out list is updated and your webhooks fire. It only works for a number assigned to the same project.
curl -X POST https://sms21.in/v1/inbound/simulate \
-H "X-API-Key: $SMS21_TEST_KEY" -H "Content-Type: application/json" \
-d '{"from":"919876543210","to":"919812345678","text":"STOP"}'What to expect
- Replies to a number that is not assigned (or is disabled) are not delivered to anyone.
- Providers retry callbacks; SMS21 de-duplicates on the provider’s message ID, so you see one reply.
- Replies are personal data: the text is cleared and numbers masked after the retention period (90 days by default).
- Inbound messages are not charged.
- Long replies arrive as the provider sends them; SMS21 does not reassemble multi-part messages.