Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Receive Inbound Messages from SMS, WhatsApp and Facebook Messenger


(information)

Info

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.


Configure SMS

configure-sms page anchor

The Flex Messaging page(link takes you to an external 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:

  1. Link the phone number's messaging handler to Proxy.
  2. 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(link takes you to an external page) 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

configure-whatsapp-and-facebook page anchor

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(link takes you to an external page). 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(link takes you to an external page).

Set the Message Handler

set-the-message-handler page anchor

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:


_10
https://webhooks.twilio.com/v1/Accounts/ACxx/Proxy/KSxx/Webhooks/Message

Your unique URL will replace the ACxx and 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(link takes you to an external page). 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).


As with SMS, you must create a Flex Flow entity for each identity that you are connecting to Flex.

Create a Flex Flow

create-a-flex-flow page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = require('twilio')(accountSid, authToken);
_15
_15
client.flexApi.v1.flexFlow
_15
.create({
_15
'integration.flowSid': 'FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_15
friendlyName: 'WhatsApp Flex Flow',
_15
chatServiceSid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_15
channelType: 'whatsapp'
_15
})
_15
.then(flex_flow => console.log(flex_flow.sid));

Output

_19
{
_19
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-08-01T22:10:40Z",
_19
"date_updated": "2016-08-01T22:10:40Z",
_19
"friendly_name": "WhatsApp Flex Flow",
_19
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_type": "whatsapp",
_19
"contact_identity": "12345",
_19
"enabled": true,
_19
"integration_type": "studio",
_19
"integration": {
_19
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"retry_count": 1
_19
},
_19
"long_lived": true,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}

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(link takes you to an external page) in the Twilio Console.


Rate this page: