textbee Logotextbee.dev
Plans from $9.99/mo.View Plans

SMS gateway: definition and how it works

Published and updated

An SMS gateway is the piece of software or hardware that takes a message from an application and hands it to a mobile network so it arrives as a text on a phone.

How it works

Applications do not speak the protocols mobile networks use. They speak HTTP. An SMS gateway sits between the two: it accepts a request from your code, usually a POST with a recipient and a message body, and turns it into a short message that a carrier can deliver. On the way back it does the reverse, turning a text that arrives on a number into data your code can read.

Gateways come in two shapes. A carrier-grade gateway is a server connected to one or more operators over SMPP or a wholesale route. It sends from numbers it rents, at high throughput, and bills per message. A phone-based gateway is an ordinary Android phone with a SIM card and an app on it. The app receives your API call over the internet and asks the phone to send the SMS over the SIM, so the message leaves from a real mobile number on a normal consumer plan.

The choice between them is mostly about volume, sender identity and cost. Carrier gateways scale to millions of messages and support short codes and alphanumeric senders. A phone gateway sends at the speed of one handset, but recipients see a local number they can reply to, and the messages come out of the SIM plan rather than a per-message fee.

Whichever shape you pick, the developer-facing part looks the same: an endpoint to send, an endpoint or webhook to receive, and a status for each message.

How this applies with textbee

textbee is a phone-based gateway. You install the app on an Android phone with a SIM, register the device against your account, and call POST /gateway/send-sms with an API key. The phone sends the SMS over its SIM, and inbound texts arrive through GET /gateway/messages or a webhook.

Related terms

  • SMS API: An SMS API is a programmatic interface, almost always HTTP, that lets software send text messages, read the ones that arrive, and check what happened to each one.
  • SMS gateway app: An SMS gateway app is an Android application that turns a phone with a SIM into an SMS gateway: it receives send requests from an API over the internet and sends them as texts through the phone's SIM, and forwards texts the phone receives back to your software.
  • A2P and P2P messaging: P2P is a text one person sends to another; A2P is a text an application sends to a person, and carriers apply different rules, filters and prices to each.
  • SMPP: SMPP (Short Message Peer-to-Peer) is the binary, persistent-connection protocol that message centres, aggregators and high-volume senders use to exchange SMS with mobile networks.

Frequently asked questions

Is an SMS gateway the same as an SMS API?

No. The gateway is the thing that moves messages between the internet and the mobile network. The API is the interface your code uses to talk to the gateway. Every gateway exposes some API, and most SMS APIs are the front door of a gateway.

Do I need a carrier contract to run an SMS gateway?

Not for a phone-based gateway. A SIM card on a normal plan is the carrier relationship. Carrier-grade gateways need an aggregator or direct operator agreement and bill per message.

Read next