Key Takeaways
- A webhook on an Android phone SMS gateway is your backend hearing DLR and inbound events over HTTPS — the radio still lives on the handset.
- Verify signatures (`X-SmsGateway-Signature` in live docs) and reject unsigned or stale callbacks; do not trust a naked POST.
- Make handlers idempotent. Delivery and inbound events will retry when your endpoint 500s or times out.
- Inbound replies only exist while a paired phone is online and the SIM can receive. A webhook URL cannot resurrect a dead battery.
- Priced by devices and SMS send volume. You use your own phone and operator SMS credit. Callbacks are not a separate billable product; failed sends still consume volume and airtime.
- Keep OTP and marketing on separate device pools so a campaign webhook storm cannot delay login events.
An android phone as sms gateway webhook is the missing half of “we sent a text.” The API accept is not delivery. Delivery is a radio event. Your software only learns it in time if something pushes the status — or you poll. This spoke is the push path, sitting under the Hub B cornerstone how to use an Android phone as an SMS gateway.
Product surface: SMS webhook integration. Live fields: SMS API documentation. Priced by devices and SMS send volume. You use your own phone and operator SMS credit.
A webhook is a receipt printer. If the phone is off, the printer has nothing to print — no matter how pretty your endpoint is.
What a phone-gateway webhook actually is
Your backend exposes HTTPS. You register that URL. After the control plane accepts a send, the Android app drives the modem. When a delivery report or an inbound SMS shows up, the control plane POSTs JSON to you. That is the whole loop. It is closer to Stripe event callbacks than to an SMPP bind.
Two-way traffic uses the same SIM the customer already has. Replies are inbound events, not a second rented long code. If you need that model, read two-way SMS after this page.
Event types you should care about
Names below are conceptual. Confirm the live enum in Developer Center before you switch on production parsers.
| Event (concept) | When it fires | What you should do | What you should not do |
|---|---|---|---|
| Accepted / queued | Control plane stored the job | Record message id; start your own timeout | Tell the user “delivered” |
| Sent on radio | Handset handed the PDU to the modem | Mark in-flight | Assume the operator delivered |
| Delivered / failed (DLR) | Operator report (when available) | Close the OTP attempt or alert | Retry blindly without a new code |
| Inbound received | Someone texted the SIM | STOP handling, support thread, keyword | Run untrusted URLs from the body |
| Device offline (if you subscribe) | Heartbeat missed | Page ops; failover device | Keep enqueueing OTP without a fallback |
DLR is not guaranteed on every operator. Design OTP expiry in your app. The webhook is evidence, not a cryptographic proof that a human read the code.
The packet path
Left to right: radio event, control plane, your TLS terminator, your handler, your database. Time moves with the dashed packet. If any hop is down, status piles up or retries.
Signatures, TLS, and replay
Anyone who discovers your URL can POST a fake “delivered.” Verify the gateway signature header on every request. Reject unsigned bodies. Use HTTPS with a real certificate. Rotate secrets when a contractor leaves.
Replay: cache seen event ids for a window (hours, not months). A retried delivered event must not increment “successful OTP” twice. HTTP semantics for this pattern are ordinary — the MDN guidance on HTTP retries is a useful reminder that 5xx invites another POST.
Do not log the raw signature secret. Do not log full OTP bodies from inbound or outbound payloads. See the log retention how-to.
Retries and idempotency
Your endpoint will be slow. You will deploy. You will 502. The control plane should retry. Your handler must treat (event id) as a unique key. If you key off “phone number + minute,” two different messages collapse.
Timeouts: if you process the event but fail to 200, you will get a duplicate. That is why the unique key belongs in the database commit, not in an in-memory set on one box.
Ordering is not guaranteed under retry. A failed DLR can arrive after a later delivered event if you re-queued. Store timestamps from the payload and apply a state machine (pending → sent → delivered/failed) that never moves backward without an explicit reason.
Inbound replies on the same SIM
STOP, YES, and free-text support replies hit the SIM, then the app, then your webhook. If the device is in airplane mode, the reply sits with the operator or the handset until the app is alive. Do not promise “instant two-way” in a sales deck if ops cannot keep a charger in the wall.
Keyword auto-reply is a separate feature: auto-reply and STOP. Webhooks are how your CRM hears the same inbound if you need it in a ticket, not only on the phone.
When the phone is offline
Queue depth grows. Heartbeats miss. Webhooks go quiet. That is not an API outage. Check pairing, OEM battery, SIM credit, then your endpoint. Spare charged devices beat brochure SLAs — the Hub B rule still applies.
Isolate OTP from marketing so a bulk CSV webhook flood cannot starve login callbacks on the only worker you run. Scale the consumer like any other event bus.
Local listener vs public HTTPS
A self-hosted control plane might hit an internal URL. The hosted product cannot. For local labs, tunnel or poll. Do not disable signature checks “just for ngrok.” The bad habit ships.
Confirm subscription create/delete shapes in Developer Center. This page will not mirror them.
Checklist
- Public HTTPS endpoint with signature verification.
- Idempotent handler keyed on event id.
- State machine that does not regress DLR.
- OTP expiry owned by your app, not by “we got a callback.”
- Offline phone runbook; spare device paired.
- STOP persisted from inbound events on promo lanes.
- No OTP bodies in webhook logs.
- Canary send to staff numbers before customer cutover.
- Live headers checked in docs, not copied from a blog.
Next steps
Prove one delivered callback and one inbound reply on a lab phone. Then read DLR, keep the handset alive via the app guide, and budget devices on pricing. Webhooks make the phone look like a cloud API. The charger still has to be in the wall.
Related product pages
Jump to the live product docs for this topic—not another long-form article.
- SMS webhook integrationInbound and status events
- device and SMS volume pricingPlans and allowances
- Android SMS gateway product guideDefinition, product, and how to buy
- SMS API documentationLive endpoint reference




