Send SMS with Twilio
Send text messages (alerts, one-time codes) from your app. Your Account SID and Auth Token are secrets used only from a server function.
1. Before you start
Create a Twilio account. You get a trial number to test; go through verification to send to any number.
Sending SMS runs in a server function, which requires a paid plan.
2. Where to find your credentials
- Open the Twilio Console — the dashboard shows your Account SID and Auth Token.
- Get a phone number (Console → Phone Numbers) that can send SMS in your country.
- Paste the values in the key panel as secret names (no VITE_): TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and your sending number.
The Auth Token is a secret — never a VITE_ name, never pasted in the chat.
3. Trial to production
On a trial account you can only text verified numbers and messages carry a trial prefix. Upgrade and buy a number to send freely. The platform reminds you to check your keys when you publish.
4. Common problems
21608 / “unverified number”: on trial you can only send to verified numbers — verify the recipient or upgrade.
20003 authentication error: the Account SID or Auth Token is wrong.
Number cannot send SMS to that country: pick a number with SMS capability for that destination.