Receive Inbound Messages from SMS, WhatsApp and Facebook Messenger
This guide is for Flex UI 1.x and channels that use Programmable Chat and Proxy. If you are using Flex UI 2.x or you are starting out, we recommend that you build with Flex Conversations.
With Flex, your customers can reach you via channels like SMS, WhatsApp, and Facebook Messenger. This page details how to configure these Twilio-supported channels.
The Flex Messaging page in the Twilio Console allows you to register a phone number with Flex to be handled for inbound SMS. When you register a number, we:
- Link the phone number's messaging handler to Proxy.
- Create a Flex Flow that redirects to your custom message handling. This defaults to a Studio Flow.
To manually configure SMS, you will need to update the messaging handler on the Phone Numbers page. Connect this to your 'Flex Proxy Service', and then use the Flex Flow API to create a new entry for your number.
Configure WhatsApp and Facebook
Like SMS, all other messaging channels have a configurable webhook for processing inbound messages. You'll need to update the messaging handler for each channel you want to connect to Flex.
For WhatsApp you can configure the message handler using the WhatsApp Sandbox. If you're using WhatsApp with Flex Conversations, refer to Manage Conversations WhatsApp Addresses.
For Facebook and other channels you can configure the callback URL from the Channels Page.
Set the Message Handler
Once you've found the right place in the console to configure the message handler, you can set the Incoming Message webhook to point to the Flex Proxy Service. This webhook looks like:
Your unique URL will replace the
KSxx identifiers with your Account SID and Flex Proxy Service SID. You can find your default Flex Proxy instance SID in the Proxy section of the console. Your messaging channel needs to be connected to Proxy in order to be handled by Flex. Proxy translates all messages between Flex's chat channel (which your agent interacts with) and your messaging channel (which your customers interact with).
Configure the Flex Flow
As with SMS, you must create a Flex Flow entity for each identity that you are connecting to Flex.
When Flex receives a new message, it will first send to Proxy and post to a new Chat Channel. Afterwards, the message handler will redirect to whatever destination you have specified in your Flex Flow. By default this is a Studio Flow. The Studio Flow can send automated responses to your inbound message or collect any additional information before passing the conversation to an agent within Flex.
Existing Flex Flows can be modified or removed from the Flex Messaging page in the Twilio Console.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.