Integrating Twilio for SMS in Bubble requires configuring the API Connector with your Account SID, Auth Token, and Twilio phone number. This tutorial walks through the complete setup — creating a Twilio account, configuring the API Connector with proper authentication, sending SMS messages via workflows, and tracking delivery status.
Overview: Twilio SMS Integration in Bubble
This tutorial shows you how to send SMS notifications from your Bubble app using Twilio's messaging API. You will configure the API Connector with Twilio's credentials, create workflows that send text messages when specific events occur, handle phone number formatting for international numbers, and optionally track message delivery status. This guide is for non-technical founders who want to add SMS capabilities to their Bubble app.
Prerequisites
- A Bubble account with an existing app
- A Twilio account (free trial available at twilio.com)
- A Twilio phone number capable of sending SMS
- The API Connector plugin installed in your Bubble app
Step-by-step guide
Get your Twilio credentials
Get your Twilio credentials
Go to twilio.com and sign up for a free account (or log in if you already have one). From the Twilio Console dashboard, locate your Account SID and Auth Token — these are displayed prominently on the main page. Copy both values and save them securely. Then navigate to Phone Numbers in the left sidebar and note your Twilio phone number (the one Twilio assigned to you). If you do not have a number yet, click Buy a Number and select one with SMS capability. On the free trial, you can only send SMS to verified phone numbers.
Pro tip: Twilio's free trial includes a small credit balance and lets you test SMS without paying. Upgrade to a paid account to remove restrictions on recipient numbers.
Expected result: You have your Twilio Account SID, Auth Token, and a Twilio phone number ready for configuration.
Configure the API Connector for Twilio
Configure the API Connector for Twilio
In your Bubble editor, go to the Plugins tab and open the API Connector plugin (install it if you have not already). Click Add another API and name it 'Twilio'. Set the authentication to HTTP Basic Auth. In the Username field, enter your Account SID. In the Password field, enter your Auth Token. Mark both as Private so they are never sent to the browser. Now add a new API call named 'Send SMS'. Set the method to POST and enter the URL: https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json (replace YOUR_ACCOUNT_SID with your actual SID). Set Use as to Action.
1{2 "URL": "https://api.twilio.com/2010-04-01/Accounts/[account_sid]/Messages.json",3 "Method": "POST",4 "Headers": {5 "Content-Type": "application/x-www-form-urlencoded"6 },7 "Body": "To=[to_phone]&From=[from_phone]&Body=[message_body]"8}Expected result: The API Connector has a Twilio API configured with authentication and a Send SMS call ready for initialization.
Set up the API call parameters and initialize
Set up the API call parameters and initialize
In the Send SMS API call, add three body parameters: To (the recipient phone number in E.164 format like +15551234567), From (your Twilio phone number), and Body (the message text). Mark From as Private since it will not change per request. Set To and Body as dynamic (not private, not client-safe) so they can be set from workflows. Click Initialize call and enter test values: a verified phone number for To, your Twilio number for From, and 'Test from Bubble' for Body. Click Initialize — Twilio should return a JSON response with the message SID and status.
Pro tip: On Twilio's free trial, you must verify recipient phone numbers in the Twilio Console before you can send them SMS.
Expected result: The API call initializes successfully and you receive a test SMS on your phone, confirming the integration works.
Create a workflow to send SMS from your app
Create a workflow to send SMS from your app
Go to the Workflow tab and create a new workflow for the event that should trigger the SMS (for example, When Button Send Notification is clicked, or a backend workflow triggered by a database change). Add an action — under Plugins, select Twilio - Send SMS. Set the To field to the recipient's phone number (from an Input element or a database field). Set the Body field to your message text (can include dynamic data like the user's name or order details). The From field should be pre-set to your Twilio number if you marked it as private.
Expected result: An SMS is sent to the specified phone number whenever the workflow triggers.
Format phone numbers to E.164 standard
Format phone numbers to E.164 standard
Twilio requires phone numbers in E.164 format: +[country code][number] with no spaces or dashes (example: +15551234567). To handle user input, add a phone number Input field on your page. When saving the number, use Bubble's text operators to clean it: remove spaces, dashes, and parentheses using the :find & replace operator. If users do not enter a country code, prepend +1 (for US) using a conditional expression. Store the cleaned E.164 number in your database so every SMS send uses the correct format.
Pro tip: Create a reusable custom event called 'Format Phone Number' that accepts raw input and returns a clean E.164 number.
Expected result: All phone numbers stored in your database are in E.164 format, ensuring Twilio can deliver SMS without formatting errors.
Track SMS delivery status with a webhook (optional)
Track SMS delivery status with a webhook (optional)
To track whether SMS messages are delivered, create a backend workflow in Bubble that accepts Twilio's status callback. Go to the Workflow tab, click the Pages dropdown, and select Backend workflows. Create a new backend workflow called 'twilio-status-callback'. Add parameters for MessageSid (text) and MessageStatus (text). In the API Connector, update your Send SMS call URL to include a StatusCallback parameter pointing to your backend workflow URL: https://yourapp.bubbleapps.io/api/1.1/wf/twilio-status-callback. Create an SMS_Log Data Type with fields: message_sid, status, to_number, sent_at. Update the log when the callback fires.
Expected result: Twilio sends delivery status updates to your Bubble backend workflow, which logs them for tracking and reporting.
Complete working example
1{2 "api_name": "Twilio",3 "authentication": {4 "type": "HTTP Basic Auth",5 "username": "[Account_SID] (Private)",6 "password": "[Auth_Token] (Private)"7 },8 "calls": [9 {10 "name": "Send SMS",11 "method": "POST",12 "url": "https://api.twilio.com/2010-04-01/Accounts/[account_sid]/Messages.json",13 "headers": {14 "Content-Type": "application/x-www-form-urlencoded"15 },16 "body_parameters": {17 "To": "[recipient_phone_e164] (Dynamic)",18 "From": "[twilio_phone_number] (Private)",19 "Body": "[message_text] (Dynamic)",20 "StatusCallback": "https://yourapp.bubbleapps.io/api/1.1/wf/twilio-status-callback (Optional)"21 },22 "use_as": "Action",23 "response_example": {24 "sid": "SM1234567890abcdef",25 "status": "queued",26 "to": "+15551234567",27 "from": "+15559876543",28 "body": "Your order has shipped!",29 "date_created": "2026-03-28T10:30:00Z"30 }31 }32 ],33 "data_types": {34 "SMS_Log": {35 "message_sid": "text",36 "status": "text (queued/sent/delivered/failed)",37 "to_number": "text",38 "body_preview": "text",39 "sent_at": "date"40 }41 },42 "backend_workflow": {43 "name": "twilio-status-callback",44 "parameters": {45 "MessageSid": "text",46 "MessageStatus": "text"47 },48 "actions": [49 "Search for SMS_Log where message_sid = MessageSid",50 "Make changes to result: status = MessageStatus"51 ]52 }53}Common mistakes when integrating Twilio for SMS notifications in Bubble.io: Step-by-Step Guide
Why it's a problem: Not formatting phone numbers in E.164 format
How to avoid: Clean all phone numbers to E.164 format (+15551234567) before passing them to the Twilio API call
Why it's a problem: Putting the Auth Token in a non-private parameter
How to avoid: Always mark Account SID and Auth Token as Private in the API Connector so they stay server-side
Why it's a problem: Trying to send SMS to unverified numbers on the free trial
How to avoid: Verify test recipient numbers in the Twilio Console, or upgrade to a paid Twilio account to send to any number
Best practices
- Always mark Twilio credentials (Account SID and Auth Token) as Private in the API Connector
- Store phone numbers in E.164 format in your database to avoid formatting issues
- Use backend workflows for SMS sends triggered by database changes to avoid exposing logic to the frontend
- Implement a StatusCallback to track delivery and handle failed messages
- Create an SMS_Log Data Type to keep a record of all sent messages for auditing
- Test with Twilio's free trial before upgrading to a paid account
- Add rate limiting to prevent accidental mass SMS sends from workflow loops
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to send SMS notifications from my Bubble app using Twilio when a new order is placed. I have the Twilio Account SID and Auth Token. Can you help me configure the API Connector and create the workflow?
Help me set up Twilio SMS in my app. I need to send an SMS notification to the customer when their order status changes to 'shipped'. Configure the API Connector with Twilio and create a backend workflow that triggers on order status change.
Frequently asked questions
How much does Twilio SMS cost?
Twilio charges approximately $0.0079 per SMS sent in the US. International rates vary by country. The free trial includes a small credit balance for testing. Check Twilio's pricing page for current rates.
Can I send SMS from Bubble's free plan?
Yes. The API Connector works on all Bubble plans, so you can integrate Twilio on the free plan. The cost is on the Twilio side, not the Bubble side.
Why is my Twilio SMS not being delivered?
Common causes: the phone number is not in E.164 format, you are on Twilio's free trial and the recipient is not verified, your Twilio account balance is zero, or the carrier is blocking the message. Check the Twilio Console logs for specific error codes.
Can I send bulk SMS from Bubble?
Yes, but use a backend recursive workflow to send messages one at a time with a short delay between each. Twilio has rate limits (typically 1 message per second per number). For true bulk messaging, consider Twilio's Messaging Service.
How do I handle international phone numbers?
Always store numbers in E.164 format with the country code prefix. When displaying a phone input to users, consider using a plugin that adds country code selection, or detect the user's country and prepend the appropriate code.
Can RapidDev help set up Twilio integration in my Bubble app?
Yes. RapidDev can configure the complete Twilio integration including SMS, voice calls, status tracking, and bulk messaging workflows so you can focus on your business logic.
Can I send WhatsApp messages through Twilio in Bubble?
Yes. Twilio's WhatsApp API uses a similar endpoint. Configure a separate API call in the API Connector with the WhatsApp-specific URL and prefix the From number with 'whatsapp:'. You need to set up a WhatsApp sender in the Twilio Console first.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation