Connect Retool to Twilio by adding a Twilio Resource in Retool's Resources tab and authenticating with your Account SID and Auth Token. From there you can build SMS operations dashboards to send messages, view message history, manage phone numbers, and trigger automated SMS alerts from Retool Workflows — all with credentials securely proxied server-side.
| Fact | Value |
|---|---|
| Tool | Twilio |
| Category | Communication |
| Method | Retool Native Resource |
| Difficulty | Intermediate |
| Time required | 20 minutes |
| Last updated | April 2026 |
Build an SMS Operations Dashboard with Retool and Twilio
Support teams, operations leads, and on-call engineers frequently need to send SMS notifications — order updates, appointment reminders, incident alerts, or outage notifications — and track delivery in one place. Twilio's own console is powerful but designed for developers, not the ops agents who need to trigger and monitor messages daily. Retool transforms Twilio into a user-friendly operations tool by wrapping the Twilio API in a custom dashboard that fits your team's workflow.
With a Retool–Twilio integration, you can build a message-sending panel where agents fill in recipient and message fields with data pulled from your customer database, click Send, and immediately see the delivery status update in a live table. You can search historical message threads by phone number, monitor failed deliveries, and trigger Twilio in Retool Workflows for automated sends that fire on schedule or in response to database events.
Retool's native Twilio Resource means you never need to know Twilio's endpoint structure or handle authentication headers manually — the action picker in the query editor exposes SMS, voice, and number management operations in plain language. Your Account SID and Auth Token are stored encrypted in Retool and never exposed to browser-side JavaScript or end users.
Integration method
Retool includes a built-in Twilio Resource that authenticates with an Account SID and Auth Token. Queries use a visual action picker to send messages, list message history, look up phone numbers, and manage Twilio resources — no manual endpoint configuration required. All calls are proxied through Retool's server-side layer, keeping credentials off the client.
Prerequisites
- A Twilio account with a verified phone number capable of sending SMS (Twilio trial accounts restrict sending to verified numbers only; upgrade to a paid account for unrestricted sending)
- Your Twilio Account SID and Auth Token, found on the Twilio Console dashboard (console.twilio.com)
- The Twilio phone number or messaging service SID you will send from
- A Retool account with permission to create and edit Resources
- Basic familiarity with Retool's query editor, Table component, and event handler system
Step-by-step guide
Create the Twilio Resource in Retool
Navigate to the Resources tab in Retool's left navigation sidebar. Click the Add Resource button in the top-right corner. In the resource type picker, scroll to the Messaging section and click Twilio. The Twilio resource configuration form opens. In the 'Resource name' field, enter a name such as 'Twilio SMS' or 'Twilio Production'. For teams with multiple Twilio accounts (e.g., US and EU regional accounts), use descriptive names that identify the account region and purpose. In the 'Account SID' field, paste your Twilio Account SID — it begins with 'AC' followed by a 32-character alphanumeric string (e.g., ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx). You can find this on the Twilio Console homepage under 'Account Info'. In the 'Auth Token' field, paste the corresponding Auth Token. The Auth Token is displayed alongside the Account SID on the Twilio Console homepage — click the eye icon to reveal it. Treat this token as a secret password; it has full access to your Twilio account. Do not enter the Auth Token directly if you prefer additional security. Instead, create a Retool Configuration Variable (Settings → Configuration Variables) named 'TWILIO_AUTH_TOKEN', mark it as secret, paste the token as its value, and then reference it in the resource field as `{{ environment.variables.TWILIO_AUTH_TOKEN }}`. Click Save Changes. Retool will validate the credentials against Twilio's API. A green Connected status confirms a successful connection.
Pro tip: Use a Twilio API Key pair (API Key SID + Secret) instead of the master Auth Token when possible. API Keys can be scoped and revoked without changing your master credentials. Create them in the Twilio Console under Account → Keys & Credentials → API Keys.
Expected result: The Twilio Resource appears in the Resources tab with a green Connected indicator. The resource is available as a data source option in the Retool query editor.
Create a Send SMS query
Open your Retool app (or create a new one from the Apps tab). In the Code panel at the bottom, click + New query. From the Resource dropdown, select your Twilio Resource. Retool displays a Twilio-specific query form with an 'Action' dropdown. Select 'Send SMS Message'. The form updates to show the fields required for sending: - 'To': Enter `{{ toNumberInput.value }}` to bind to a text input component where agents type the recipient's number. Phone numbers must be in E.164 format (e.g., +14155552671). - 'From': Enter your Twilio phone number in E.164 format (e.g., +18005551234), or enter `{{ fromNumberSelect.value }}` if you want operators to choose from multiple Twilio numbers via a Select component. - 'Body': Enter `{{ messageBody.value }}` to bind to a text area where agents compose the message. - 'Media URL' (optional): Leave empty for SMS; populate for MMS with image or file URLs. Set 'Run query on page load' to Off — this query should only fire when a Send button is clicked. In the 'On success' event handler, click + Add event handler and select 'Show notification' with message 'SMS sent successfully to {{ toNumberInput.value }}'. Add a second on-success handler to trigger a 'getMessageHistory' query (which you will create in the next step) so the message log table refreshes immediately after sending. Name the query 'sendSMS' and click Save.
Pro tip: Add a simple phone number format validator in a transformer or component validation: `{{ /^\+[1-9]\d{7,14}$/.test(toNumberInput.value) ? null : 'Phone number must be in E.164 format (e.g. +14155552671)' }}`. Bind this to the To field's validation message to catch format errors before the API call.
Expected result: The sendSMS query appears in the Code panel. Manually triggering it with a test phone number delivers an SMS and returns a Twilio message SID in the response.
Query message history and build the log table
Create a second query to display historical messages. Click + New query, select your Twilio Resource, and from the 'Action' dropdown choose 'List Messages'. Set the query parameters: - 'To': Optionally bind to `{{ phoneSearchInput.value }}` to filter messages for a specific recipient when a phone number is entered, or leave empty to return all recent messages. - 'From': Optionally bind to your Twilio number to scope the history to a specific sender. - 'Date sent after': Bind to `{{ dateFilter.startDate }}` for date-range filtering. - 'Date sent before': Bind to `{{ dateFilter.endDate }}`. - 'Page size': Set to 50. Name the query 'getMessageHistory'. Set 'Run query on page load' to On. On the canvas, drag a Table component from the Component panel and rename it 'messageTable'. Set its Data to `{{ getMessageHistory.data }}`. Configure the Table columns to show: direction (inbound/outbound), from, to, body (with word wrap enabled), status, date_sent (formatted as a readable date), error_message (shown only if non-null), and price. Add conditional row coloring: rows where status is 'failed' or 'undelivered' show with a red background tint. Use the Table's 'Row color' setting with condition `{{ row.status === 'failed' || row.status === 'undelivered' }}` → color red. Add a Text Input component 'phoneSearchInput' above the table labeled 'Filter by phone number', and a Date Range Picker 'dateFilter'. Wire them so changing either re-triggers the getMessageHistory query using event handlers on the input's 'Change' event.
1// Transformer: reshape Twilio message list for display2const messages = data;3return messages.map(msg => ({4 direction: msg.direction,5 from: msg.from,6 to: msg.to,7 body: msg.body,8 status: msg.status,9 sent: new Date(msg.date_sent).toLocaleString(),10 error: msg.error_message || '',11 sid: msg.sid,12 price: msg.price ? `$${Math.abs(parseFloat(msg.price)).toFixed(4)}` : 'N/A'13}));Pro tip: Twilio stores up to 400 days of message history. For high-volume accounts, the 'List Messages' query can return slowly. Add a default 7-day date filter to the query so it loads quickly on page open, and let operators expand the range if needed.
Expected result: The message history table populates with recent Twilio messages. Filtering by phone number narrows the results to that recipient. Failed messages are highlighted in red.
Build the compose form and complete the UI
With queries in place, construct a polished send form that agents use day-to-day. From the Component panel, arrange the following on the canvas: 1. A Container with title 'Send SMS' — drag it to the left side of the canvas. 2. Inside the container, add a Text Input component named 'toNumberInput'. Set label to 'To (E.164 format)' and placeholder '+14155552671'. In the Validation section, add a regex validator: `^\+[1-9]\d{7,14}$` with error message 'Use E.164 format'. 3. A Select component named 'fromNumberSelect'. Manually add Options with your Twilio phone number(s) or bind to a 'List Incoming Phone Numbers' query that dynamically fetches your account's active numbers. 4. A Text Area named 'messageBody'. Set label to 'Message' with max character display of 160 (standard SMS length) using Retool's character counter feature. Add a validation requiring the field to be non-empty. 5. A Button named 'sendButton' labeled 'Send SMS'. Wire its Click event handler to the sendSMS query with a 'Show confirmation' dialog displaying 'Send SMS to {{ toNumberInput.value }}?'. 6. A Text component below the button that shows the character count: `{{ messageBody.value?.length || 0 }} / 160 characters`. On the right side of the canvas, place the messageTable Table component and the phoneSearchInput and dateFilter controls above it. The layout creates a split view — compose on the left, history on the right — suitable for a support agent workflow.
Pro tip: If your support team sends templated messages (e.g., 'Your order #ORDER_ID has shipped'), add a Select component with preset template options. Wire it to auto-populate the messageBody text area using an event handler that sets the text area value when a template is selected.
Expected result: The canvas shows a clean split layout with the SMS compose form on the left and message history table on the right. The character counter updates as agents type, and the Send button requires confirmation before dispatching.
Automate SMS alerts with Retool Workflows
Beyond manual sends from the app UI, Retool Workflows let you trigger Twilio SMS automatically on schedules or in response to webhook events — without an operator needing to be logged into the Retool app. Navigate to the Retool Workflows section (accessible from the Retool sidebar or Apps dashboard). Click + Create new Workflow and name it 'SendAlertSMS'. Add a Trigger: for scheduled sends, click Add Trigger → Schedule and set a cron expression (e.g., `0 9 * * 1` for every Monday at 9 AM). For event-driven sends, click Add Trigger → Webhook — Retool generates a unique webhook URL with a secret key header. On the Workflow canvas, add a Resource Query block. Set the Resource to your Twilio Resource and Action to 'Send SMS Message'. Wire the 'To' field to data from a previous block (e.g., a PostgreSQL query block that fetches on-call engineer phone numbers from a database). For a weekly digest pattern: 1. Block 1 (PostgreSQL query): `SELECT phone_number, first_name FROM on_call_engineers WHERE active = true` 2. Block 2 (Loop block): iterate over each row from Block 1 3. Inside loop — Block 3 (Twilio query): Send SMS to `{{ loop.value.phone_number }}` with body `Hi {{ loop.value.first_name }}, here is your weekly ops summary...` Add error handling: add a Global Error Handler block that sends an SMS or Slack notification to the ops lead if any step fails. For complex notification workflows with conditional routing, retry logic, and multi-channel escalation (SMS → Slack → PagerDuty), RapidDev's team can help build the Retool Workflow architecture.
1// JavaScript block: build personalized SMS message bodies2const engineers = blocks.getOnCallEngineers.data;3return engineers.map(eng => ({4 to: eng.phone_number,5 body: `Hi ${eng.first_name}, this is your weekly ops digest for ${new Date().toLocaleDateString()}. You have ${eng.open_incidents} open incidents. Reply STOP to unsubscribe.`6}));Pro tip: Twilio enforces message-per-second rate limits per phone number (typically 1 SMS/second for long codes). When sending bulk messages in a Workflow Loop, add a Wait block between iterations with a 1000ms delay to avoid hitting this limit and receiving 429 errors.
Expected result: The Workflow appears in the Retool Workflows dashboard. Manually triggering it sends personalized SMS messages to the configured recipients. Scheduled or webhook triggers fire the workflow automatically in production.
Common use cases
Build a customer SMS notification panel for support agents
Create a Retool app where support agents can search for a customer by name or email, see their phone number and recent message history pulled from Twilio, compose a message in a text area, and click Send to dispatch an SMS. The panel shows delivery status (queued, sent, delivered, failed) for each message, and agents can resend failed messages with one click.
Build a Retool support SMS panel with a customer search input querying PostgreSQL, a message history Table showing recent Twilio messages for the selected customer, a message compose Text Area, a From Number selector, and a Send SMS button that triggers the Twilio send query.
Copy this prompt to try it in Retool
Build a bulk SMS broadcast tool for operational alerts
Create a Retool broadcast panel that queries a PostgreSQL or CRM resource for a list of phone numbers matching a filter (e.g., active subscribers in a region), previews the recipient count, and sends a templated SMS message to all matching numbers via a Retool Workflow. Operators can review the recipient list before confirming, and a log table tracks each send batch.
Build a Retool broadcast tool with a filter form for selecting recipients from a database, a preview showing recipient count, a message template text area with variable substitution, a confirmation step, and a Workflow-triggered bulk send that loops through the recipient list and logs each send to a database table.
Copy this prompt to try it in Retool
Monitor Twilio message delivery and failed-send alerting
Build a Retool monitoring dashboard that polls Twilio for messages with 'failed' or 'undelivered' status across the last 24 hours. Ops engineers can see the failure reason (invalid number, carrier blocking, etc.), filter by date and error code, and trigger a retry or route the customer to an alternative channel. A Chart component shows delivery failure rates over time.
Build a Retool Twilio monitoring dashboard with a Table of recent failed messages showing recipient, error code, error message, and sent_at time, a Retry Send button for selected rows, a date filter, and a bar Chart showing daily failure counts by error code.
Copy this prompt to try it in Retool
Troubleshooting
SMS send query returns 'Error 21614: To number is not a valid mobile number' or 'Error 21211: Invalid To phone number'
Cause: The recipient phone number is not in E.164 format, is a landline (for SMS), contains formatting characters (dashes, spaces, parentheses), or is a number that Twilio cannot route SMS to.
Solution: Normalize phone numbers to E.164 format before passing them to the Twilio query. Use a JavaScript transformer to strip non-numeric characters and add the country code prefix. For US numbers, ensure they begin with +1. If the number is confirmed mobile but still fails, check whether the number is on Twilio's 'Do Not Call' registry or if it has previously opted out by replying STOP.
1// Transformer: normalize phone number to E.164 format (US example)2const raw = toNumberInput.value || '';3const digits = raw.replace(/\D/g, '');4// Assume US number if 10 digits; otherwise assume international with country code5if (digits.length === 10) {6 return `+1${digits}`;7} else if (digits.length > 10) {8 return `+${digits}`;9} else {10 return null; // invalid11}Resource test returns 'Authentication Error - No credentials provided' or HTTP 401
Cause: The Account SID or Auth Token entered in the Retool resource configuration is incorrect, has been regenerated in the Twilio console, or was copied with extra whitespace.
Solution: Go to the Twilio Console (console.twilio.com) and copy the Account SID and Auth Token fresh — click the copy icon next to each value to avoid manual selection errors. Update the Retool resource with the new values and click Save. Ensure you are using the main account's credentials, not a subaccount SID. If you recently regenerated your Auth Token in the Twilio Console (under 'API Credentials → Auth Token → Rotate'), the old token is immediately invalidated.
Messages show status 'sent' in Twilio but never reach the recipient device
Cause: 'Sent' means Twilio accepted the message and passed it to the carrier. Delivery failures after this point are controlled by the carrier and may result in 'delivered' or 'undelivered' status updates via Twilio's delivery receipt webhooks. Common causes: the recipient opted out (replied STOP), number is ported and carrier routing is stale, or the message contains content that triggers carrier filtering.
Solution: Check the Twilio Message SID detail page in the Twilio Console to see the full status history and any carrier error codes. If the recipient previously replied STOP, they are on Twilio's opt-out list and you cannot SMS them without their consent — this is by design and legally required. For messages triggering carrier filters, avoid URL shorteners, excessive capitalization, and certain keywords in message bodies. Enable Twilio's Advanced Opt-Out feature if your use case requires opt-out management.
Workflow bulk SMS send triggers Twilio error 429 'Too Many Requests'
Cause: Twilio enforces throughput limits per phone number: standard long-code numbers are limited to approximately 1 message per second. Retool Workflows loop at maximum speed by default, dispatching multiple Twilio requests faster than the rate limit allows.
Solution: Add a Wait block inside the Workflow Loop block between each Twilio send, configured with a 1100ms delay (slightly over 1 second to account for processing time). For high-volume sends (thousands of messages), use a Twilio Messaging Service with multiple phone numbers — Messaging Services automatically distribute messages across numbers to increase throughput. Alternatively, schedule the Workflow during off-peak hours when message queues are shorter.
Best practices
- Store your Twilio Account SID and Auth Token in Retool Configuration Variables (Settings → Configuration Variables) marked as secret, then reference them in the resource configuration — this prevents the credentials from being visible to non-admin Retool users who view the resource settings.
- Use Twilio API Keys (created in the Twilio Console under Account → API Keys) instead of the master Auth Token in Retool resources — API Keys have restricted scope and can be revoked independently without invalidating your master credentials.
- Always include an opt-out instruction in the first SMS to any new recipient (e.g., 'Reply STOP to unsubscribe') as required by US carrier regulations. Retool's message template feature makes it easy to enforce this consistently across all agent-composed messages.
- Add a confirmation modal to Send SMS buttons in Retool apps, especially for bulk send operations. Agents should always confirm the recipient count and message content before dispatching — a single misdirected broadcast SMS can damage customer relationships.
- Use Twilio Messaging Services (created in the Twilio Console) rather than raw phone numbers in production — Messaging Services provide automatic number rotation for rate limiting, sticky sender for conversation continuity, and fallback numbers if one number is blocked.
- Implement an opt-out tracking table in your database: after every successful send, check the Twilio response for 'STOP' signals and update a do_not_contact flag on the customer record to prevent future sends.
- Monitor Twilio spending with budget alerts in the Twilio Console. Unexpected high volumes (caused by a bug in a Retool Workflow loop, for example) can run up large SMS costs quickly — set account balance alerts at threshold values.
- Test all Twilio queries in Retool using Twilio test credentials before switching to live credentials. Twilio provides a test Account SID and Auth Token that simulate responses without sending real messages or incurring charges.
Alternatives
Use SendGrid if your primary communication channel is email rather than SMS — SendGrid's native Retool connector handles transactional email delivery and templates where Twilio covers phone-based channels.
Choose Slack if your notification targets are internal team members on Slack rather than external customers via SMS — Retool's Slack connector is better suited for internal ops alerts and team notifications.
Use Bandwidth if your organization requires PSTN-grade voice and messaging infrastructure with direct carrier relationships and lower per-message costs at high volume — Bandwidth connects via a REST API Resource in Retool.
Frequently asked questions
Can Retool receive inbound SMS messages from Twilio?
Retool does not natively receive inbound webhooks in apps, but you can handle inbound SMS through Retool Workflows. Configure a Twilio phone number's inbound webhook URL to point to a Retool Workflow Webhook trigger URL. The Workflow receives the message payload, processes it, and can write to a database that your Retool app displays. For two-way SMS conversations, this pattern lets you build a basic customer messaging inbox in Retool.
Does Retool's Twilio Resource support WhatsApp messages as well as SMS?
Yes. Twilio supports WhatsApp messaging through the same Messages API that handles SMS. To send WhatsApp messages, format the 'To' number with the whatsapp: prefix (e.g., whatsapp:+14155552671) and use a WhatsApp-enabled Twilio number or the Twilio Sandbox for WhatsApp as the 'From'. The Retool Twilio Resource's 'Send SMS Message' action works for both SMS and WhatsApp sends — only the number format changes.
How do I use a Twilio Messaging Service SID instead of a phone number in Retool?
In the Retool Twilio query's 'From' field, enter your Messaging Service SID (starts with 'MG') instead of a phone number. Twilio will route the message through the appropriate number in the messaging service pool. This is the recommended approach for production because it provides number rotation, sticky sender behavior, and fallback redundancy.
Can I send Twilio SMS from a Retool Workflow triggered by a database event?
Retool Workflows support webhook triggers but not native database change triggers. The workaround is to set up a database trigger or application event that calls the Retool Workflow webhook URL, passing the relevant data as a JSON payload. The Workflow then extracts the phone number and message content from the payload and fires the Twilio SMS query. This pattern works with PostgreSQL triggers via pg_notify, application-level events, or intermediary services like Zapier or n8n.
What is the cost of sending SMS through Twilio via Retool?
Retool itself does not charge per SMS. Twilio's standard pricing for US long-code SMS is approximately $0.0079 per message segment (one segment = 160 characters). International SMS rates vary by destination country and are listed on Twilio's pricing page. Short code numbers ($500-1,000/month plus per-message fees) provide higher throughput and are required for high-volume marketing sends in the US.
How do I handle Twilio message delivery receipts in Retool?
Twilio sends delivery status callbacks to a webhook URL when message status changes (delivered, failed, undelivered). Point this callback URL to a Retool Workflow Webhook trigger, which receives the status update payload, extracts the MessageSid and status, and updates a database record accordingly. Your Retool SMS dashboard can then query this database to show real-time delivery status rather than relying on polling the Twilio List Messages API.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation