Twilio and Slack connect through Slack Incoming Webhooks and the Slack API to forward inbound SMS and call events into specific Slack channels, giving your team real-time visibility into customer messages and on-call alerts without requiring anyone to monitor a separate dashboard. This integration is used by support teams routing customer SMS into a triage channel, DevOps teams receiving Twilio call alerts in an on-call channel, and sales teams that want inbound lead texts to appear instantly in their CRM Slack notification feed. The connection uses a Twilio inbound webhook to receive the message or call event, a middleware layer to format the data, and a Slack Incoming Webhook or Slack API call to post the notification to the correct channel.
What You Need Before You Start
Create a Slack App at https://api.slack.com/apps by clicking Create New App, choosing From scratch, naming it something like Twilio SMS Bridge, and selecting your workspace. In the app settings, navigate to Incoming Webhooks, toggle Activate Incoming Webhooks to On, click Add New Webhook to Workspace, select the channel where Twilio messages should appear, and copy the Webhook URL that Slack generates, which follows the pattern https://hooks.slack.com/services/T.../B.../. From Twilio, gather your Account SID and Auth Token, and configure your Twilio phone number's Messaging webhook URL in the Console to point to your middleware endpoint that will receive inbound SMS events and forward them to Slack. Your middleware can be a lightweight server, a Twilio Function, or a serverless function on AWS Lambda or Cloudflare Workers that accepts the Twilio POST, formats the message, and POSTs to the Slack webhook URL.
Step-by-Step Integration Guide
Set your Twilio phone number's Messaging webhook URL in the Console under Phone Numbers, then Manage, then Active Numbers to your middleware endpoint such as https://yourapp.com/twilio/inbound with the HTTP method set to POST. In your middleware, parse the Twilio inbound POST payload extracting the From, To, Body, and MessageSid fields from the URL-encoded form data that Twilio sends. Construct a Slack message payload as a JSON object with a text field containing a formatted string such as New SMS from {From}: {Body} and optionally include a blocks array with a Section block for richer formatting that shows the sender phone, message body, and timestamp. Post the notification to Slack by calling the Slack Incoming Webhook URL with a POST request, the Content-Type header set to application/json, and the body set to your formatted JSON payload. Return HTTP 200 with an empty TwiML response body containing only the XML declaration and Response tags from your middleware so Twilio does not retry the webhook and the inbound flow completes cleanly.
Common Issues and How to Fix Them
Slack posts from Twilio stop arriving in the channel when the Slack Incoming Webhook URL is invalidated, which happens when the Slack app is uninstalled from the workspace or the channel the webhook was authorized for is deleted. Regenerate the Incoming Webhook URL by going back to your Slack app settings under Incoming Webhooks, adding a new webhook to the replacement channel, and updating the URL in your middleware environment variables. Twilio sends inbound message payloads as application/x-www-form-urlencoded and not JSON, which causes middleware built with JSON-only body parsers to receive null or undefined for all fields including From and Body. Configure your middleware framework to parse URL-encoded bodies using the appropriate middleware such as express.urlencoded in Node.js or Flask's request.form in Python before accessing any Twilio payload field. Slack will rate-limit your Incoming Webhook if you post more than one message per second, which can happen on high-traffic Twilio numbers receiving burst SMS. Implement a message queue in your middleware that batches Slack notifications at a rate of one per second using a setTimeout or equivalent async delay when multiple Twilio events arrive simultaneously.
How to Get More from This Integration
Add Slack Block Kit interactive components by upgrading from Incoming Webhooks to the Slack Web API using the chat.postMessage endpoint at https://slack.com/api/chat.postMessage with your Slack Bot Token in the Authorization header, and include button actions on the message that let Slack users reply to the SMS directly from the channel by clicking a Reply button that opens a Slack modal. Build a two-way SMS bridge by handling Slack interactive component payloads at an action endpoint in your middleware, extracting the typed reply text from the Slack payload, and calling the Twilio Messages API to send the reply back to the original sender's phone number stored from the initial inbound event. Use Slack's thread_ts parameter when posting follow-up messages from the same SMS conversation to group all messages from a single phone number into a single Slack thread, keeping your channel organized when contacts send multiple messages. Route inbound Twilio SMS from different numbers or containing different keywords to different Slack channels by adding routing logic in your middleware that maps the Twilio To number to a specific Slack webhook URL, enabling a support number and a sales number to post into separate Slack channels from a single middleware deployment.
Conclusion
Twilio and Slack together ensure your team sees every inbound SMS and call alert the moment it arrives in the same tool they already work in all day. Contact Telphi Consulting to build and configure a Twilio-Slack bridge for your team's specific channels and routing needs.
Ready to Transform Your Business Communications?
Get a free consultation with our VoIP experts and discover how we can help you save costs, improve efficiency, and scale your business.
Comments (0)
Join the discussion and share your thoughts (AI-moderated for quality)
Be the first to comment
No comments yet. Share your thoughts below.