Messaging in Twilio Flex
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.
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.
Prior versions of Flex Channel Messaging API are still fully functional, including any chats/messages/channels created through the
https://preview.twilio.com/Flex/ API endpoint.
The new endpoint for the Flex API is
https://flex-api.twilio.com/v1/. The latest API supports additional attributes, meaning changes are required if you move to the new API.
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 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 chat bot logic prior to agent handover - these are called Webchat flow and Messaging flow respectively.
- Flex Webchat 2.0 or newer (if using Webchat use cases)
For SMS, you can add and configure Message Handlers for your phone numbers with the REST API and through the Twilio Console. For other channels, learn more about configuring message handlers in the Inbound Messaging Developer Guide.
Learn more about how Inbound Webchat works.
Inbound flow from a messaging channel
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 (task creation on customer response)
Learn more about how you can build outbound messaging with Flex.
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.