To send SMS from an iOS or Android app, don't. Have the app call your own backend, and have the backend call the texting API with a key that never leaves the server. Two shortcuts tempt every mobile team: putting the API key in the app, and sending from the phone's own SIM. Both are traps.

This post covers why, the proxy pattern that replaces them, and the controls you need so your endpoint doesn't become a free texting service for strangers.

Why the app must never hold the API key

Anything shipped inside an app can be extracted. Obfuscation slows someone down by an afternoon. A key in your bundle can send texts on your bill to any number, with your registered brand on them. Our notes on API key security and rotation apply double here: the safe place for the key is a server environment you control.

The fix is architectural. The app authenticates the user to your backend, and the backend decides whether a text goes out.

Why the device SIM is the wrong line

Sending from the user's phone, through the native messages app or an SMS intent, looks free and simple. It isn't a fit for a product that texts on behalf of a business:

  • It's a personal number sending business traffic, outside the registration that carriers expect for application-to-person messaging. Our 10DLC explainer covers why that matters for filtering.
  • You get no delivery reports, no opt-out handling and no audit trail.
  • iOS in particular won't let an app send a text silently. The user has to tap send in a compose sheet, so it can't be an automated flow.
  • Replies land on the user's personal phone, not in your system.

The backend proxy pattern

  1. The app calls your endpoint, for example POST /api/invite, with its normal user session.
  2. Your server checks who the user is, whether they may send, and whether they're within limits.
  3. Your server calls the texting API and returns a plain result to the app.

From a server, a send to Ready looks like this:

POST https://api.tryready.com/v1/messages
X-API-Key: <key>
Idempotency-Key: <uuid you generated for this action>
Content-Type: application/json

{"to": "+12125550199", "body": "Your order #1042 has shipped.", "consent_attested": true}

to is E.164. Generate the Idempotency-Key header once per user action and reuse it on retries, because mobile networks drop connections and users double-tap. See duplicate texts and idempotency. The full field list is in the messages docs.

Rate limiting and abuse control

An endpoint that texts any number on request will be found. Put these in front of it:

ControlWhat it stops
Per-user and per-device send limitsOne account hammering the endpoint
Per-recipient limitHarassing one phone number
Allowed message types onlyFree-form text from the client
Server-built message bodyUsers writing their own content
Spend alert on your accountA slow leak you'd otherwise miss

Keep the recipient list server side where you can. If the app sends "invite this contact", have your backend look up the number and fill the template, so the client never gets to choose both the number and the words. For platform-side limits, read SMS API rate limits.

Consent comes from you

consent_attested is your promise the recipient agreed to texts. Ready records that attestation for the send (who sent, when), but it isn't a per-contact consent record. Store the opt-in yourself, with the time, the wording shown and the screen it happened on, and only send when you have it. In-app flows are good at this because you control the screen. A contact list in the user's address book isn't consent, so never text from it. See documenting SMS consent.

STOP replies are honored on the Ready side, and you can read them with GET /v1/opt-outs/:phone before a send from another tool.

Receiving replies in the app

Replies arrive on your backend through a webhook, not on the phone. Store them and push a notification or refresh the thread in the app. Setup is in the API quickstart.

Next step

Move the send call off the device, add the three limits above, and test with a test key before going live. Our guide to adding SMS to your app is the next read.

Frequently asked questions

Can I send SMS directly from an iOS app?

Not silently. Apple's compose sheet needs the user's tap, and it sends from their personal number. Use your backend.

Is it safe to put a restricted key in the app?

We wouldn't. Anything in the bundle can be extracted, so keep the key on the server.

Do I need 10DLC registration for app-triggered texts?

Texts to US numbers from a business application go through registered numbers. Ready handles registration in the app or through the registration API.

How do I stop users abusing my send endpoint?

Limit per user and per recipient, build the message body on the server, and alert on spend.