SMS and WhatsApp
OpenPush texts the people who use your app by SMS and WhatsApp, under your app's own brand name.
A phone number is a subscription like a push device, with its own channel: sms or whatsapp.
The same number can be on both. Push devices are never texted, and a number is never pushed.
All examples use https://app.openpush.ai, the OpenPush API base URL, and the app's REST API key
in X-OP-API-Key.
When to use this page
When you want to text alerts, campaigns or journey steps, send one-time phone codes, or collect phone numbers in your app. For push, see sending messages.
The one rule: never text a number that opted out
A number that replied STOP, or that your app opted out, is never texted again by that app on that channel: not by a campaign, a journey, a keyword reply, a test, or a phone code. There is no option to include opted-out numbers. The check runs when the audience is built and again just before each text goes out, so a STOP that arrives mid-send still stops the next text. Importing or registering an opted-out number again leaves it opted out. Only the person can opt back in, by replying START.
Turning it on
Texting has two switches:
- The deployment. An OpenPush platform admin turns Messaging on for the whole deployment.
While it is off, the SMS / WhatsApp pages are hidden, the REST routes answer
503, and nothing is texted. - The app. An app admin opens Settings → SMS & WhatsApp and chooses who runs the sending account.
OpenPush runs it
OpenPush sends from senders it registers for your app. There is no provider account or paperwork of your own; you pay per text from prepaid text credit. Texting run by OpenPush is on paid plans.
Enter a Brand name (2 to 30 characters), which people read in every text and phone code, and pick the countries the app may text. Press Turn on messaging. It creates, for this app only:
- a sending account,
- sending services for alerts and for codes,
- a phone-code service in your brand name, and
- a daily spend cap of $20.
The brand name is also added as a sender where carriers accept one. The Setup checklist turns green item by item; Retry setup continues from the first step that failed. Change brand name renames it later. Over REST:
Code
The call is idempotent: a retry continues from the first step that has not finished. A step the
provider refuses answers 409 with step and reason; a workspace not on a paid plan gets 402.
Close messaging account releases every number and stops all texts from the app. It cannot be reopened.
Connect your own Twilio account
Free on every plan; Twilio bills you directly. Enter the Brand name, your Account SID (it
starts with AC) and your Auth Token (not an API key). Then:
- Sender — choose the number texts come from, from the numbers in your Twilio account that can send texts.
- Replies — OpenPush sets its incoming-texts address on that number (or on your Messaging Service), so replies, STOP and HELP reach OpenPush. Sending starts only once they do. Your previous setting is saved and put back when you disconnect, if it is still unchanged.
- Optionally Create a phone-code service in my Twilio account, so phone codes go out through Twilio Verify in your brand name. Twilio bills per code.
A Twilio trial account must be upgraded. Twilio's free trial only sends its own sample texts, so OpenPush saves the connection and shows Upgrade required until you upgrade in Twilio and press Check again.
Later, Manage Twilio connection updates the Auth Token or disconnects the account. If replies stop reaching OpenPush, sending pauses so a STOP cannot be missed, and the settings pages show Fix reply routing.
Over REST: POST /v1/apps/{app_id}/messaging/twilio with account_sid, auth_token, brand,
and default_from when the account has more than one number; PATCH the same route to change the
token or sender, or with repair_replies: true; DELETE disconnects.
Text credit
Text credit is prepaid, shared by every app in the workspace, and lasts 12 months from purchase.
Buy it under the workspace's Text credit page, which also shows the rate card, a statement by
app for each month, and your purchases. Each text is charged when it is accepted, at the rate for
its country; a long SMS is charged per part. Texts to a country without a rate are not sent.
GET /v1/apps/{app_id}/messaging/rates returns the rate card.
A campaign is refused with 402 while the balance is zero. A campaign larger than the balance
sends until the credit runs out, and the rest are skipped and listed in Logs. Apps on their own
Twilio account never use text credit.
Senders
Settings → SMS & WhatsApp → SMS senders lists what texts come from: your brand name where carriers accept it, or a phone number (Toll-free, Local number, 10DLC or Short code), with its countries and status.
- US and Canada do not accept a brand name. Get a toll-free number, then File verification (business details, use case, how people opt in, and a sample message). Verification takes 1–5 business days; until then the number sends at a reduced rate. With OpenPush running the account, the number's monthly fee comes from text credit.
- Country paperwork lists the countries that only deliver texts from a registered sender, what each needs, and the details to paste into the forms.
- With your own Twilio account, buy numbers and file registrations in Twilio, then refresh the list.
The composer sends from Best sender for each country unless you pick one.
WhatsApp is linked after texting is on, from Settings → SMS & WhatsApp → WhatsApp, where your deployment enables it. An app uses one WhatsApp account at a time:
| Provider | What it is |
|---|---|
| Your Twilio account | A WhatsApp sender already set up in your Twilio account, with the templates WhatsApp approved there. Twilio bills you. |
| Your Meta account | A number in your own WhatsApp Business Account, through your own Meta app. Meta bills you. |
| OpenPush | OpenPush adds a number for the app and sends from it. Ask OpenPush support to set it up. |
To connect your Meta account, enter the WhatsApp Business Account ID, the Phone number
ID, a System user token with the whatsapp_business_messaging and
whatsapp_business_management permissions, and your Meta app's App secret. Then Register
number with its two-step PIN. In your Meta app, the messages webhook field must be on. Replies,
STOP and button presses come to OpenPush either way.
The 24-hour window. Outside the 24 hours after someone last wrote to you, WhatsApp only delivers approved templates. Free text reaches only people inside that window.
WhatsApp templates
Templates live on Templates → SMS / WhatsApp, with their category, language and review status.
- On your Meta account or OpenPush, press New WhatsApp template: a Name (lowercase
letters, digits and underscores), Language, Category (Utility or Marketing), the
Text with
{{1}},{{2}}where each message fills in a value, Example values for the review, and optional quick-reply buttons. Submit the starter templates adds a sign-in code with a copy-code button and an alert with an Acknowledge button. - On your Twilio account, create templates in Twilio's Content Template Builder, then refresh.
WhatsApp reviews each template, from minutes to a day. Only approved templates can be sent.
Phone numbers
Phone numbers are stored in international form (E.164, such as +14155550123). A number reaches
a subscription in one of four ways.
From your app, with a phone code
Available in SDK 1.2.2 and later. The phone number and phone code APIs are part of the iOS, Android and Unity SDKs.
A number added from a device is not verified: it receives nothing until a phone code sent to it is approved. Add the number, then verify it:
Code
Code
Code
The SDK cleans the number the way the server does: every character but digits and + is removed,
a leading 00 becomes +, and the result must be + and 8 to 15 digits, the first not 0. An
invalid number returns false, logs why and sends nothing. An accepted write is saved and retried
like a tag write, and belongs to the user logged in at the time of the call.
removeSms / removeWhatsApp (RemoveSms / RemoveWhatsApp in Unity) opt the number out of that
channel. The number stays on the user, and nothing more is texted to it there.
When identity verification is on, these writes
carry the user's auth hash. Under the hood each is POST /v1/apps/{app_id}/subscriptions with the
SDK key and {"token": "+14155550123", "platform": "sms", "external_id": "…"} ("platform": "whatsapp" for WhatsApp), plus external_id_auth_hash; a removal adds "status": -2. A device
can never mark a number subscribed itself.
Register from your server
When your own sign-in has already proven a number, register it with the REST key. It is subscribed
on each channel at once, unless it opted out. With double opt-in on, a new SMS number is
asked to reply YES first (status 0):
Code
Code
A 400 means the value is not a phone number, a channel is unknown, or texting is off for the app.
Import
Import → Phone numbers takes a CSV of up to 5 MB with one column of numbers named
phone_number, phone, number, sms or mobile. Optional columns: external_id, channel
(sms, whatsapp or sms,whatsapp), tags as JSON, consent_source, language, country and
timezone. Rows with device type 14 from your previous provider's export use the identifier
column. Say how these people agreed to texts (saved with each number as your record of consent) and
which channels to subscribe them to.
The result counts new subscribed numbers, numbers asked to reply YES, numbers already subscribed, opted-out numbers kept opted out, rows that are not a phone number, and numbers outside your countries. Importing a number again updates it instead of adding a copy.
Over REST, POST /v1/apps/{app_id}/phone-numbers/import takes up to 1,000 rows:
{"consent_source": "…", "numbers": [{"number", "channels", "external_id", "tags", …}]}.
Sign-up keywords
People can join by texting a sign-up keyword to your number. See keywords.
Consent
Settings → SMS & WhatsApp → Consent controls how people confirm, stop and restart texts.
- Double opt-in. With Ask new numbers to confirm on, each new SMS number gets one confirmation text and stays Awaiting confirmation until it replies YES. The text is yours to edit, up to 320 characters, and must say how to confirm (YES) and how to opt out (STOP). A number typed into your app gets it after a phone code proves the number. New WhatsApp numbers are subscribed at once.
- Stop texts. STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT or ARRET to any of the app's numbers stops SMS, WhatsApp and phone codes to that number from this app. OpenPush sends no reply after STOP.
- Start again. START, YES or UNSTOP restores only the channel the person replied on; the other stays opted out until they opt in there.
- Help. HELP or INFO gets your help reply on WhatsApp. On SMS the network answers HELP (with your own Twilio account, Twilio's own replies apply).
Keywords
Settings → SMS & WhatsApp → Keywords sets what happens when someone texts a word to your app. OpenPush checks the first and last word of a text and any word in brackets, in upper or lower case. Each keyword can:
- answer with a saved SMS template, or with one reply for subscribers and another for numbers that never subscribed,
- Subscribe people who text this keyword,
- tag the person, and
- listen on SMS, WhatsApp or both.
When no keyword matches sets an automatic reply, at most one per number a day. Keyword replies
never go to a number that opted out. REST: GET|POST /v1/apps/{app_id}/messaging/keywords,
PATCH|DELETE …/keywords/{keyword_id}, and GET|PUT|DELETE /v1/apps/{app_id}/messaging/auto-responder.
Phone codes
A phone code is a one-time code sent under your app's name ("Your Acme code is 482913"), with fraud protection. A correct code also proves the number: the number's not-verified SMS and WhatsApp subscriptions become subscribed (or, with double opt-in, are asked to reply YES).
| Channels | sms, call (a voice call reads the code out), whatsapp where your deployment enables it, and auto: WhatsApp where enabled, else SMS |
| Code lifetime | 10 minutes |
| Limits | 5 codes per number an hour, 10 per device an hour, 5 tries per code |
| Resend | At least 30 seconds after the last send |
A number that opted out gets no code. With OpenPush running the account, each code is charged from text credit. Settings → SMS & WhatsApp → Phone codes shows the last seven days: codes sent, correct and the success rate.
From the SDKs
Code
Code
Code
| Platform | Start | Check | Resend |
|---|---|---|---|
| iOS | Verify.start(_ phone:, channel: = .auto, locale: = nil) async throws | Verify.check(_:code:) | Verify.resend(_:channel:) |
| Android | Verify.start(phone, channel = AUTO, locale = null) | Verify.check(verification, code) | Verify.resend(verification, channel = verification.channel) |
| Unity | Verify.StartAsync(phone, channel = Auto, locale = null) | Verify.CheckAsync(verification, code) | Verify.ResendAsync(verification, channel = null) |
On Android each call is a suspend function and also has a callback form that reports an
OpenPushVerifyResult (Success or Failure) on an SDK background thread. Unity tasks complete on
the main thread; in the Editor nothing is sent and the code 123456 is accepted. locale ("en",
"pt-BR") picks the message's language.
Each call is one request and is not retried, because a person is waiting. A wrong code is not an
error: the verification comes back pending with attempts counted up. approved,
expired and max attempts are final; start a new verification after the last two. The
verification holds the full number in memory only and is never saved, so it does not survive the
app being killed.
On Android, OpenPush.Verify.smsRetrieverHashFor(context) returns the 11-character hash the SMS
Retriever API needs, and on iOS give the code field the .oneTimeCode text content type so the
keyboard offers the code.
Errors
Server code | HTTP | Swift | Kotlin | C# | Meaning |
|---|---|---|---|---|---|
rate_limited | 429 | .rateLimited | RATE_LIMITED | RateLimited | Too many codes to this number or from this device in the last hour |
too_soon | 429 | .tooSoon | TOO_SOON | TooSoon | A resend inside 30 seconds of the last send |
not_pending | 409 | .notPending | NOT_PENDING | NotPending | Already approved, expired or out of tries; start a new one |
provider | 400 | .provider | PROVIDER | Provider | The SMS, WhatsApp or voice provider could not deliver the code |
opted_out | 409 | .optedOut | OPTED_OUT | OptedOut | The number replied STOP. Never retry; it can opt back in by replying START |
credit | 402 | .noCredit | NO_CREDIT | NoCredit | The workspace has no text credit left |
no_rate | 409 | .noRate | NO_RATE | NoRate | No price for this number's country yet |
refused | 400, 404 | .refused | REFUSED | Refused | Anything else: not a phone number, a country or range this app does not allow, a channel not enabled, an unknown verification |
| — | — | .invalidNumber | INVALID_NUMBER | InvalidNumber | Not a valid number; raised on the device, nothing sent |
| — | — | .network | NETWORK | Network | No usable answer: no connection, or a server failure |
The SDKs read an unknown server code as refused.
From your server
The same routes take the REST key (with write access) as well as the SDK key:
Code
Code
Then POST /v1/apps/{app_id}/verify/{verification_id}/check with {"to", "code"}, and
POST …/{verification_id}/resend with {"to", "channel"}. to must be the same number each
time. A refusal is {"detail": {"code": "…", "message": "…"}} with the codes above.
Supabase phone sign-in
Phone codes also shows a Hook URL and Secret for Supabase. In Supabase, open Auth → Hooks → Send SMS, choose HTTPS and paste them; Supabase's phone sign-in codes then go out through your app's phone-code setup, in your brand name. Only admins can see or rotate the secret.
Composing and sending
Open SMS / WhatsApp and press New text:
- Audience — Send to subscribed phone numbers (minus anyone who replied STOP) or Send to particular segments, plus optional numbers typed one per line, which must already be subscribed.
- Send by — SMS, WhatsApp, or WhatsApp, then SMS: each person gets the first channel that reaches them. For WhatsApp choose an approved template and its values, one per line, or free text for people inside the 24-hour window.
- Message — plain text up to 1,600 characters, longer texts being sent in parts. Liquid works,
as in push: see personalization. Start from a template uses a saved SMS
template or a quick-start. Add pictures by URL (up to 10,
https); pictures go by SMS only. Send as picks a sender. - Delivery — Send now or Schedule.
Review and send shows the numbers matched now, who will not be sent to and why, the parts per text, the estimated charge or cost by country, your text credit and today's spend against the cap. A send that needs approval goes to Awaiting approval first. Save as draft keeps it.
Send a test texts the app's phone test subscriptions, or typed numbers that are already subscribed.
Trackable links
Insert trackable link replaces a link with a short link that counts clicks, up to three per
text, SMS only, on paid plans. Each must be an https URL that appears in the text. Link previews
that phones and carriers fetch are ignored where OpenPush can recognise them.
Who is not texted
A send skips, and the report and Logs list, every number that:
- opted out (replied STOP),
- is outside the app's allowed countries or in a blocked number range,
- arrived while sending was paused or the daily cap was reached,
- is outside WhatsApp's 24-hour window with no approved template and no other channel, or
- could not be charged because the text credit ran out, or its country has no rate yet.
Templates
Templates → SMS / WhatsApp holds saved SMS templates (text and pictures) and quick-starts, and
the WhatsApp templates. REST:
GET|POST /v1/apps/{app_id}/sms-templates and GET|PATCH|DELETE …/sms-templates/{template_id}.
Sending over REST
A send is POST /v1/apps/{app_id}/messages with target_channel: "sms" or "whatsapp":
Code
| Field | Notes |
|---|---|
target_channel | sms or whatsapp |
body or contents | The text, at most 1,600 characters. Liquid works |
template_id | A saved SMS template |
fallback | The order to try, starting with target_channel, e.g. ["whatsapp", "sms"] |
whatsapp | {template, language, variables, buttons}; the template must be approved and get one variable for each placeholder |
include_phone_numbers | Subscribed numbers to add to the audience. Unknown numbers are skipped and named in an unknown_phone_numbers warning |
include_segments / exclude_segments | As for push |
sms_from | One of the app's ready senders |
sms_media_urls | Up to 10 https picture URLs, SMS only |
sms_tracked_links | Up to three https URLs from the text to count clicks on |
schedule_at | Send later |
Approvals and Idempotency-Key work as for push. A 400 explains what is wrong in words; texting
off for the app, or a provider that is not ready, is a 400; no matching subscription is a 404;
no text credit is a 402. POST /v1/apps/{app_id}/messaging/estimate takes the same body and
returns the audience, parts and cost without sending; POST /v1/apps/{app_id}/messaging/send-test
sends a test to subscription_ids or numbers.
Limits and spend
Settings → SMS & WhatsApp → Limits & spend:
- Allowed countries — nothing is texted outside them, phone codes included.
- Daily cap — once today's spend reaches it, texts pause for the rest of the UTC day; the next day lifts the pause. Default $20. Phone codes are not paused by the cap.
- Blocked number ranges — one prefix per line, such as
+4470; numbers starting with one are never texted. - Pause sending stops texts from the app until an admin presses Resume today. Texts sent meanwhile are recorded and every number skipped.
The page also shows today's spend and a month-to-date table by channel and country. Over REST,
PATCH /v1/apps/{app_id}/messaging takes allowed_countries, daily_cap_usd (1 to 10,000),
blocked_prefixes and paused.
Logs lists the last 1,000 texts and every automatic reply, with status, detail and charge or price, filtered by status and exportable as CSV. Numbers are masked there; the full number lives only on the subscription.
Journeys
Two journey steps text a person, at their own phone subscriptions:
send_sms—{"body": "…", "media_urls": [...]}.send_whatsapp—{"template": "…", "language": "en", "variables": [...], "sms_fallback": true, "body": "…"}; withsms_fallback, people WhatsApp cannot reach getbodyby SMS.
Text and template values take Liquid. Opt-outs, allowed countries, blocked ranges, the daily cap and the WhatsApp-then-SMS order apply exactly as for a campaign. See journeys.
Ask AI and MCP
For managers and admins, ask "text the VIPs" in Ask AI and it prepares an SMS, or a WhatsApp template send with an SMS fallback when WhatsApp is ready, with the text's preview on a card. Nothing is sent until you confirm. MCP agents prepare texts the same way. If texting is off or still being set up for the app, Ask says so and links to the settings.
Event Streams
Event Streams can send texting activity to your own system:
| Event | Label |
|---|---|
message.sms.sent | Sent |
message.sms.delivered | Delivered |
message.sms.clicked | Link clicked |
message.sms.undelivered | Not delivered |
message.sms.failed | Could not send |
message.sms.unsubscribed | Opted out |
message.whatsapp.sent | Sent |
message.whatsapp.delivered | Delivered |
message.whatsapp.read | Read |
message.whatsapp.failed | Could not deliver |
message.reply | Reply received |
message.button | Button pressed |
message.keyword | Keyword matched |
subscription.opted_out | Opted out |
subscription.opted_in | Opted back in |
subscription.confirmed | Double opt-in confirmed |
verify.approved | Phone number verified |
REST quick reference
| Route | What it does |
|---|---|
GET /v1/apps/{app_id}/messaging | Status, checklist, limits, spend and senders as JSON |
POST /v1/apps/{app_id}/messaging/enable | Turn on texting run by OpenPush |
POST|PATCH|DELETE /v1/apps/{app_id}/messaging/twilio | Your own Twilio account |
PATCH /v1/apps/{app_id}/messaging | Countries, daily cap, blocked ranges, pause |
GET /v1/apps/{app_id}/messaging/rates | Rate card |
GET /v1/apps/{app_id}/messaging/senders, POST …/senders/tollfree, POST …/senders/refresh | Senders |
GET|PATCH /v1/apps/{app_id}/messaging/consent | Double opt-in and replies |
GET|POST /v1/apps/{app_id}/messaging/keywords, PATCH|DELETE …/{keyword_id} | Keywords |
GET|PUT|DELETE /v1/apps/{app_id}/messaging/auto-responder | Reply when no keyword matches |
GET /v1/apps/{app_id}/messaging/whatsapp, POST …/whatsapp/templates | WhatsApp status and templates |
GET|POST /v1/apps/{app_id}/sms-templates, GET|PATCH|DELETE …/{template_id} | SMS templates |
POST /v1/apps/{app_id}/phone-numbers, …/phone-numbers/import | Register or import numbers |
POST /v1/apps/{app_id}/verify, …/{verification_id}/check, …/{verification_id}/resend | Phone codes |
POST /v1/apps/{app_id}/messaging/estimate, …/messaging/send-test | Estimate and test |
POST /v1/apps/{app_id}/messages with target_channel: "sms" or "whatsapp" | Send |
Request and response schemas are in the API reference.
Related
- Sending messages — push sends and shared options
- Personalization — Liquid, tags and dynamic content
- Journeys —
send_smsandsend_whatsappsteps - Security and limits — keys and identity verification
- Messages API reference