Java: Receive Android SMS Gateway API Webhooks

Featured illustration for Java: Receive Android SMS Gateway API Webhooks

Receive Android SMS Gateway API webhooks in Java/Spring: HowTo, code sample, signature verify, and two-way adjacency.

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

InformationAndroid SMS GatewayAPIDevelopers
Article
Published
January 25, 2026
Updated
February 23, 2026
Reading time
17 minute read

Key Takeaways

  • Java receiving Android SMS gateway API webhooks means a Spring (or servlet) endpoint that verifies X-SmsGateway-Signature on the raw body, then ACKs 200 fast.
  • There is no official Maven “Complete Java SDK.” Use HttpClient / servlet APIs. Confirm headers in Developer Center.
  • message.delivered is DLR. message.received is two-way inbound. Different parsers.
  • Deduplicate on X-SmsGateway-Event-Id. Retries reuse it.
  • Do not process OTP guess logic inline on the webhook thread.

Java: Receive Android SMS Gateway API Webhooks is a Spring/servlet pattern: raw body, HMAC, fast 200. Hub: Android SMS gateway API. Signing notes live with the OpenAPI webhooks key in the Developer Center. Two-way product: two-way SMS.

You bring the Android and airtime. Devices and send volume.

v1=HMAC-SHA256(ts.body)

Pretty-printed JSON is a signature mismatch waiting to happen.

A servlet is not an SMSC

Your controller records what already happened on the SIM. It does not send. Delivery reports.

If you HMAC a Map you just rebuilt, you will “fix” production by turning verification off. Read the bytes.

How to receive webhooks in Java

  1. Register the HTTPS URL (OpenAPI webhooks).
  2. Read raw bytes. Timestamp header + body.
  3. HMAC-SHA256, constant-time compare to v1= hex.
  4. Reject skew > ~5 minutes. Dedupe Event-Id.
  5. 200, then a queue for CRM / OTP state.

Servlet/filter background: Spring Web MVC.

HMAC on the raw body

Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
byte[] digest = mac.doFinal((timestamp + "." + rawBody).getBytes(StandardCharsets.UTF_8));
String expected = "v1=" + HexFormat.of().formatHex(digest);
// MessageDigest.isEqual(expected.getBytes(UTF_8), headerCandidate.getBytes(UTF_8));

Conceptual. Header names and encoding must match Developer Center — this is not a packaged SDK.

DLR vs inbound

typeMeansYour job
message.deliveredOperator DLR (when present)Mark OTP/order sent
message.failedSend path failedAlert; do not infinite-retry OTP
message.receivedInbound on the SIMThread / STOP / agent

Inbound payload 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"
    }
  }
}

PHP sibling for the same headers: webhook in-depth.

HttpClient, not a Java SDK product

Sending still uses POST /messages with Bearer — same as every other language sample. Do not NuGet/Maven-brand this as a complete SDK. C# HTTPS samples · PHP HTTPS samples.

Next steps

Point a staging URL, send a staff inbound, watch Event-Id land once. Install the app. Canaries use 300 lifetime SMS — not unmetered radio.

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.

How do I receive Android SMS gateway API webhooks in Java?

Expose HTTPS POST, read the raw body, verify HMAC SHA-256 of timestamp + "." + body against X-SmsGateway-Signature (v1=hex), reject stale timestamps, persist Event-Id, return 200, enqueue work.

Is there an official Java/Spring SDK?

No. REST HTTPS/JSON plus your HttpClient. Do not brand a wrapper as our SDK.

Can I parse the body then verify the signature?

No. HMAC the exact bytes. JSON re-serialization will fail verify.

Does the webhook include carrier credit?

No. You still fund the SIM. Free is 300 SMS lifetime on the platform.
Keep learning

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

Information
android sms gateway api webhook

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.

Dec 24, 202516 min
Read article
Information
android sms gateway troubleshooting webhook timeout

Android SMS Gateway Troubleshooting: Webhook timeout

Android SMS Gateway Troubleshooting: Webhook timeout. KB article diagnosing webhook timeout. Symptoms, likely causes, validation steps, recovery. Priced by devices and SMS send volume; BYO phone and operator credit.

Jul 6, 202516 min
Read article
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

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.