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

Messaging in Twilio Flex



This guide is for Flex UI 1.x.x and channels that use Programmable Chat and Proxy. If you are using Flex UI 2.x.x or you are starting out, we recommend that you build with Flex Conversations.

Flex uses an orchestration layer to enable setup and processing of messages that relate to a variety of contact center messaging use cases. These use cases include customer initiated messaging (commonly referred to as inbound flows) and business initiated messaging (commonly referred to as outbound flows). Flex also supports conversation control and bot interactions. While your customers may interact with the contact center using a wide variety of messaging channels, your agent can always respond with a standard webchat interface. Under the hood, Flex uses Twilio products to achieve this end-to-end flow. These products include:

  • Twilio Chat for the Agent chat interface and for customer webchat experiences
  • Twilio Proxy for phone number and session management
  • Twilio Studio for developing Chatbots

Flex simplifies this integration, providing you with basic messaging capabilities that you can customize to your business needs.


Backwards compatibility

Prior versions of Flex Channel Messaging API are still fully functional, including any chats/messages/channels created through the API endpoint.

The new endpoint for the Flex API is The latest API supports additional attributes, meaning changes are required if you move to the new API.

Useful Terminology

useful-terminology page anchor

An Agent is a person who handles incoming calls or messages in a contact center.

The Messaging Channel is the method of communication that your end user is using to interact with Flex. Twilio supports Web chat, SMS, Facebook Messenger, and WhatsApp. Facebook and WhatsApp integrations are in Beta.

Web Chat or Webchat is a type of messaging channel in which the end user interacts with Flex through a chat interface. Web chat is usually found on your website or app. Flex offers a Webchat UI that you can use to embed Web chat into your app. Contact centers commonly use Web chat for use cases like in-site customer support.

A Chat Channel refers to the Channel object found in Twilio Chat. Flex creates these channels and makes them private by default. All Messaging interactions for Flex are stored and managed in these channels. Developers have full REST and SDK control over these channels and the interactions in them. Continue reading to learn more about Chat Channels in Flex.

A Flex Flow is the logic linking a Messaging Channel, like SMS, to Flex. A Flex Flow also describes the way Flex should handle messages on this channel. You can configure a Flex Flow via the Twilio Console(link takes you to an external page) or using the REST API. A Flex Flow can also be called a Message Handler.

The Contact Identity is the "address" of the Flex contact center - for example, the phone number or the WhatsApp number and the associated message handler.

Flex allows agents to work from a single interface even as customers communicate over multiple channels. While the user experience feels simple, people building contact centers understand the underlying complexity in creating this functionality. This page offers a high-level understanding of how Flex manages omnichannel two-way communications. By default, Flex supports inbound SMS, but you can add support for additional channels, create a chatbot experience, build an outbound messaging experience, and more.



Flex Messaging requires:

  • A Flex Account/Project
  • Flex UI version 1.6.0 or newer
  • A Flex Message Handler
    • Flex onboarding sets up default handlers for inbound Webchat and inbound Twilio SMS. It also configures standard Studio interaction for these to build any chatbot logic prior to agent handover - these are called Webchat flow and Messaging flow respectively.


For SMS, you can add and configure Message Handlers for your phone numbers with the REST API and through the Twilio Console(link takes you to an external page). For other channels, learn more about configuring message handlers in the Inbound Messaging Developer Guide.

Inbound webchat

inbound-webchat page anchor
A diagram of how Flex handles Inbound Webchats.

Learn more about how Inbound Webchat works.

Inbound flow from a messaging channel

inbound-flow-from-a-messaging-channel page anchor
A diagram of data traveling through the Flex, Proxy, and Programmable Chat to reach an agent.

Instead of using the Webchat Widget, Session management is handled by Twilio Proxy. Learn more about how omnichannel inbound messages work.

Outbound flow on a messaging channel (immediate task creation)

outbound-flow-on-a-messaging-channel-immediate-task-creation page anchor
A diagram showing how to immediately create a task when sending an outbound message in Flex.

Outbound flow on a messaging channel (task creation on customer response)

outbound-flow-on-a-messaging-channel-task-creation-on-customer-response page anchor
A diagram showing how to initiate an outbound message from Flex and handle task creation on the customer response.

Learn more about how you can build outbound messaging with Flex.

Rate this page: