01What is an SMS gateway?
An SMS gateway is the service that sits between an application and the mobile networks. Your software hands it a message through an HTTP API, or over SMPP for very high volumes; the gateway checks it, queues it, chooses a route, submits it to an operator's Short Message Service Centre (SMSC) and later tells you whether it reached the handset. To a developer sending A2P traffic (application-to-person messages such as OTPs and alerts) it looks like one endpoint. Behind it sit connections to operators and aggregators, throttling per route, retry logic and a pipeline that turns carrier receipts into status callbacks.
Routing is where gateways differ most. A gateway may hold direct connections to operators, buy capacity from other aggregators, or both, and many choose a route per destination with least-cost routing that weighs price against delivery rate and latency. Direct, compliant routes keep sender IDs and delivery reports intact; a grey route may look cheaper but loses both. The delivery report (DLR) comes back from the SMSC as an SMPP deliver_sm receipt with a final state such as DELIVRD, UNDELIV, EXPIRED or REJECTD, and the gateway forwards it to your callback URL against your message ID.
In India a gateway is also a compliance checkpoint. Every commercial SMS must carry the sender's DLT identifiers (the principal entity ID, a registered header and the registered content template ID), and since late 2024 the telemarketer chain that carries it. The operator runs DLT scrubbing on each message before delivery, so a good gateway passes these fields through, rejects sends that would fail before they cost anything, and maps operator error codes to reasons your team can act on. A CPaaS usually wraps an SMS gateway together with other channels such as WhatsApp, voice and email.
Key takeaways
- An SMS gateway accepts messages from your software, picks a carrier route, submits them to an operator SMSC and reports back what happened.
- An HTTP 200 or "accepted" from a gateway means queued, not delivered; only the delivery report (DLR) tells you the outcome.
- In India every commercial SMS must carry its DLT identifiers (entity ID, registered header and content template ID) or the operator rejects it.
- Route quality decides delivery: compare gateways on delivery rate, latency and DLR completeness per operator, not on price per SMS alone.
- SMPP is one protocol a gateway may speak; the gateway is the whole service of queues, routing, retries and reporting around it.
02 · How it works, step by step
How does an SMS gateway work?
- Step 1
Your app submits the message
An HTTPS POST (or SMPP
submit_sm) carries the recipient, the header, the text and, in India, the DLT entity and template IDs. The gateway answers at once with its own message ID; that response means accepted, not delivered. - Step 2
The gateway validates and queues
It authenticates you, normalises the number, detects GSM-7 or UCS-2 encoding to count billable segments, checks the DLT fields and queues the message within the throughput your account and route allow.
- Step 3
A route is chosen
Routing rules pick an operator connection or aggregator for the destination, often by price, recent delivery rate and latency, with a backup route if the first one is degraded.
- Step 4
The operator scrubs and delivers
The message goes to the SMSC over SMPP. In India the operator checks header, template, consent, DND preference and PE-TM chain against DLT, then delivers it to the handset or rejects it.
- Step 5
The delivery report comes back
The SMSC returns a
deliver_smreceipt with a final state and error code. The gateway normalises it and POSTs a status callback to your URL, keyed to the message ID it gave you in step one.
03An SMS gateway in code
# Representative gateway API: field names vary by provider,# but every Indian request carries the same DLT identifiers.curl -X POST https://sms-gateway.example.com/v1/messages \-H "Authorization: Bearer {API_KEY}" \-H "Content-Type: application/json" \-d '{"to": "919812345678","sender": "{DLT_HEADER}","text": "Your report REF 48213 is ready. Download it from the patient portal.","dlt": { "entity_id": "{PE_ID}", "template_id": "{DLT_TEMPLATE_ID}" },"callback_url": "https://example.com/sms/dlr"}'# 202 Accepted means queued, not delivered:# { "message_id": "gw-7f3c9a21", "status": "accepted", "segments": 1, "encoding": "GSM-7" }
The response only confirms the gateway took the message; delivery arrives later as a DLR.
04An SMS gateway: key facts and limits
- App-side interfaces
- HTTPS API; SMPP v3.4 for high volume
- Carrier side
- SMPP binds to operator SMSCs or aggregators
- Final DLR states
- DELIVRD, UNDELIV, EXPIRED, REJECTD (plus DELETED, UNKNOWN)
- India: required on each send
- DLT entity ID, registered header, content template ID
- Segment size
- 160 GSM-7 or 70 UCS-2 characters; 153 or 67 per part when split
- Billing unit
- Per segment, on submission or delivery depending on the contract
05Why does an SMS gateway matter?
For most businesses the gateway is invisible until something goes wrong: OTPs arrive late, a festive campaign shows "sent" but customers never see it, or the bill counts three segments per message. Knowing what the gateway does at each hop tells you where to look. It also turns vendor selection from a price comparison into a quality one: delivery rate per operator, time to handset, DLR completeness and how clearly rejections are explained.
06Example: A diagnostics lab's missing report alerts
A Hyderabad diagnostics chain sends "your report is ready" texts through an SMS gateway. After an editor adds the branch name to the wording in the app, delivery falls from 97% to almost nothing, yet every API call still returns accepted. The DLR callbacks show REJECTD with the operator's template-mismatch code: the new text no longer matches the registered DLT content template. The team registers a revised template with the branch as a {#var#} placeholder, switches the template ID in the request, and adds an alert on any hour where rejections pass 2% of sends.
07 · Common mistakes, and the fix
Common mistakes with an SMS gateway
Treating "accepted" as delivered
The API response only means the gateway queued the message. Store its message ID, wait for the DLR and report delivery from the final state, never from the submit response.
Choosing on price per SMS alone
The cheapest route is often a grey or multi-hop one that drops DLRs and delays OTPs. Run a test batch to every major operator and compare delivery rate, time to handset and DLR completeness.
Editing text without updating the DLT template
Operators match each message to its registered content template, and a changed word is enough to fail scrubbing. Put changing values in
{#var#}placeholders and register a new template before changing wording.Ignoring encoding
One curly apostrophe or emoji switches the whole message to UCS-2 and can double or triple the segments you pay for. Check the segment count the gateway returns and normalise text before sending.
08 · Tips from the bench
Best practices for an SMS gateway
- Ask each gateway which operators it connects to directly and which traffic it hands to other aggregators.
- Alert on the rejection rate per template and per operator, not just on API errors.
- Keep the gateway's message ID alongside your own reference so support can trace any single SMS end to end.
- Test failover: switch a route off in staging and confirm traffic moves without duplicates.