Android Sms Gateway Api Webhook: In-Depth Guide

Featured illustration for Android Sms Gateway Api Webhook: In-Depth Guide

Android Sms Gateway Api Webhook: In-Depth Guide. Long-tail article focused on exact query "android sms gateway api webhook". Expand with examples, limits, FAQ, and links to hub C. Priced by devices and SMS send volume; BYO phone and operator credit. Developer Center owns live API parameters.

Written by the SMS Gateway team for operators who run phones and airtime themselves — not for theoretical cloud SMS demos.

InformationAndroid SMS GatewayIn-DepthHub C
Article
Published
December 24, 2025
Updated
January 25, 2026
Reading time
16 minute read

Key Takeaways

  • HTTP 200 on POST /messages means the control plane accepted the job. Delivery is a later webhook (or DLR poll).
  • Verify X-SmsGateway-Signature as v1=HMAC-SHA256("{timestamp}.{body}", secret) and reject stale timestamps.
  • Deduplicate on X-SmsGateway-Event-Id. Retries are normal; applying Delivered twice must be a no-op.
  • Subscribe to message.delivered, message.failed, and message.received. Do not infer inbound from DLR.
  • You bring the Android phone and operator credit. Gateway pricing is devices plus send volume.

An android sms gateway api webhook is how your backend learns what the radio did after you hung up the HTTP send. Without it you either poll GET /api/v1/messages/{id} in a tight loop or you lie to users (“sent!”) on accept. This long-tail is the webhook design guide. Live paths stay in the Developer Center; the send contract is covered in the Android SMS Gateway API cornerstone.

You still pair an Android phone and fund the SIM. We meter devices and send volume — not aggregator per-segment fees.

Event bus (illustrative)

Phone radio → control plane → POST /api/v1/webhooks consumer

Why polling DLR is not enough

Polling works for a demo. In production you have bursts, backoff, and a fleet. Webhooks invert the relationship: the control plane tells you when status changes, including inbound SMS that polling a send-id will never see.

Treat accept, sent, and delivered as three clocks. If your user-facing copy collapses them into one, you will page yourself for a carrier that never returns DLR.

Some networks leave status at Sent. That can be terminal. Design UI copy for “handed to the operator” versus “handset acknowledged.” The FAQ on DLR in product docs is the same distinction.

Event catalog

typeWhen it firesWhat you should persistTypical next action
message.deliveredOperator/handset DLR says deliveredmessage id, deliveredAt, deviceIdMark notification delivered; stop retry
message.failedRadio or operator failureid, failure, deviceIdRetry on another device or fail the OTP challenge
message.receivedInbound SMS on the SIMfrom, body, receivedAt, deviceIdSTOP list, ticket, or two-way reply via POST /messages

Register endpoints with POST https://app.sms-gateway.app/api/v1/webhooks. Field-level schema is owned by the OpenAPI, not this article.

Phone → control plane → your HTTPS

The Android app is what talks to the modem. It reports status upstream. Your server never opens a socket to the phone. If the phone is offline, events queue until it reconnects — inbound SMS included, subject to the device remaining powered and the app un-killed. That is why a desk phone on a charger still matters for two-way.

Illustrative delivery payload:

{
  "id": "evt_01K2F8QW3N4RXB7M",
  "type": "message.delivered",
  "createdAt": "2026-08-12T14:04:09Z",
  "apiVersion": "2026-08-12",
  "data": {
    "message": {
      "id": 41823,
      "number": "+14155552671",
      "text": "Your verification code is 481920",
      "status": "Delivered",
      "campaignId": 17,
      "deviceId": 3,
      "metadata": { "orderId": "1234" },
      "sentAt": "2026-08-12T14:04:02Z",
      "deliveredAt": "2026-08-12T14:04:09Z"
    }
  }
}

Inbound shape:

{
  "id": "evt_01K2F8QW3N4RXB7M",
  "type": "message.received",
  "createdAt": "2026-08-12T14:04:09Z",
  "apiVersion": "2026-08-12",
  "data": {
    "message": {
      "id": 41822,
      "number": "+14155552671",
      "text": "Yes, please reschedule to Thursday.",
      "status": "Received",
      "deviceId": 3,
      "receivedAt": "2026-08-12T14:04:09Z"
    }
  }
}

HMAC, timestamp, and replay

Header contract: X-SmsGateway-Signature = v1=hex(HMAC-SHA256("{timestamp}.{body}", secret)) with X-SmsGateway-Timestamp in unix seconds. Hash the raw body, not a re-serialized JSON object. Whitespace changes break signatures.

Reject timestamps older than about 300 seconds to limit replays. Still persist event ids — a retry inside the window is legitimate. Language samples for verification live as HTTPS/JSON snippets, not as a packaged “Complete SDK.”

PHP-oriented samples: PHP HTTPS examples. C# samples: C# HTTPS examples.

Idempotency and ordering

Deduplicate on X-SmsGateway-Event-Id. Do not assume delivered arrives after failed, or that inbound related to a send shares an id you issued. Store gateway message id as a foreign key on your notification row.

At-least-once delivery means your handler must be safe to run twice. “Increment SMS used” on every webhook is how people double-count. Key the increment on event id.

Inbound SMS and STOP

message.received is how STOP lands if the user texts the SIM. Honor it for campaigns. OTP policy is yours: many teams keep authentication working after a marketing opt-out. Wire keywords through auto-reply and STOP while the device is online, and still persist the webhook for your system of record.

Two-way product context: two-way SMS inbox.

Your endpoint failures

Return 2xx only after you have durably stored the event (or idempotently recognized it). 5xx and timeouts invite retries. Do not do slow vendor calls (Slack, your ESP) inline; enqueue. If you 401 on a bad signature, investigate clock skew before rotating secrets in a panic.

Keep the URL on HTTPS. Pin to a dedicated path. Do not reuse a public debug catcher in production.

OTP: delivered vs guessed

Do not mark an OTP “delivered” on send accept. Wait for message.delivered or a timeout that triggers a second device. If DLR never comes, decide in policy whether to offer voice or a second channel — do not resend the same digits forever.

Isolate OTP devices so bulk cannot delay the webhook that unblocks login.

Ops and cost

Alert on webhook error rate, signature failures, and lag from sentAt to event createdAt. Lag is often the phone (doze, OEM killer), not your ELB.

Webhooks are free of extra SKU drama; sends still consume operator airtime and plan volume. Free: 300 SMS lifetime. Developer: 25,000 SMS per year. Starter / Professional / Business uncap platform send volume with device caps 2 / 5 / 15. Pause on Free and Developer when the allowance is exhausted.

Checklist

  • Endpoint registered; secret in a vault; old secrets overlapping during rotation.
  • Signature + timestamp verified on the raw body.
  • Event id uniqueness constraint in the database.
  • Handlers for delivered, failed, received — even if received only logs at first.
  • Staff canary: send → webhook row appears within your SLO before customer OTP.

Next steps

Stand up a staging URL, send one SMS to yourself, and prove the three clocks in your own logs. Then add signature checks. Architecture around the control plane: gateway server. App install: downloads.

Jump to the live product docs for this topic—not another long-form article.

FAQ

Frequently asked questions

Direct answers about android sms gateway api webhook.

What is an Android SMS gateway API webhook?

It is an HTTPS POST to an endpoint you register. The control plane pushes delivery, failure, and inbound events as JSON so you do not have to poll every message ID.

How do I verify webhook authenticity?

Read X-SmsGateway-Timestamp and X-SmsGateway-Signature. Compute v1=hex(HMAC-SHA256 of timestamp + "." + raw body) with your webhook secret. Use a constant-time compare. Reject skew beyond about five minutes.

Which events should I handle first?

message.delivered and message.failed for send pipelines; message.received if you need two-way, STOP, or keyword auto-replies.

Does a webhook include carrier SMS credit?

No. Webhooks are signaling. Airtime is still yours. Platform tests on Free are 300 SMS lifetime.
Keep learning

Topically related guides—chosen by subject overlap, not a fixed sitewide footer.

Information
create_webhook via mcp android sms gateway

Create_webhook Via Mcp Android Sms Gateway: In-Depth Guide

Create_webhook Via Mcp Android Sms Gateway: In-Depth Guide. Long-tail article focused on exact query "create_webhook via mcp android sms gateway". Expand with examples, limits, FAQ, and links to hub C. Priced by devices and SMS send volume; BYO phone and operator credit. Developer Center owns live API parameters.

Jun 20, 202616 min
Read article
Information
agentic otp verification android sms gateway

Agentic Otp Verification Android Sms Gateway: In-Depth Guide

Agentic Otp Verification Android Sms Gateway: In-Depth Guide. Long-tail article focused on exact query "agentic otp verification android sms gateway". Expand with examples, limits, FAQ, and links to hub C. Priced by devices and SMS send volume; BYO phone and operator credit. Developer Center owns live API parameters.

Jan 1, 202516 min
Read article
Information
android sms gateway api dual sim

Android Sms Gateway Api Dual Sim: In-Depth Guide

Android Sms Gateway Api Dual Sim: In-Depth Guide. Long-tail article focused on exact query "android sms gateway api dual sim". Expand with examples, limits, FAQ, and links to hub C. Priced by devices and SMS send volume; BYO phone and operator credit. Developer Center owns live API parameters.

Aug 22, 202616 min
Read article

Browse the full Android SMS gateway knowledge base or return to how an Android SMS gateway works.

Get started

Test the gateway on your own Android phone

Install the app, pair one device, and validate your API flow before choosing a paid plan.

You supply the phone, SIM, and operator SMS credit.