Flex Conversations

Flex Conversations requires Flex UI 2.x.x. To check which version of the Flex UI you are running, see Flex UI Versioning. If you're running 1.x.x, follow the migration guide.

Flex Conversations gives your contact center the digital channel capabilities for both customer-initiated (commonly referred to as inbound flows) and business-initiated (commonly referred to as outbound flows) interactions, and provides the orchestration layer for managing and processing those customer interactions. Since it is based on the single Twilio Conversations primitive, the developer experience is improved and the complexity of building async channel workflows is reduced. For more details on the benefits of building on Flex Conversations, see the FAQ page.

While your customers may interact with the contact center using a variety of messaging channels, your agent always responds using the standard Flex agent desktop chat interface.

Under the hood, Flex uses Twilio products to achieve this. These products include:

While Conversations and Messaging Services are responsible for providing the ability to send and receive messages over different channels, the Interactions API gives you the ability to orchestrate agent routing and the ability to add and remove agents to and from a given conversation.

The Flex /Interactions API endpoint supports the following channel types:

  • WhatsApp
  • Chat
  • Facebook Messenger (Public Beta)
  • Google Business Messages (Public Beta)

The following sequence diagram illustrates an example of how Flex handles an inbound SMS contact:

diagram on how to handle inbound sms contact

When you create an interaction, you specify the Twilio Conversation to bind to and the TaskRouter workspace to use for routing. You can optionally declare additional routing attributes according to your interaction type. This will result in a reservation which once accepted, will automatically add that agent to the conversation.

For more information about the Interactions API, please refer to the API documentation.

Architectural Overview

Flex allows agents to work from a single interface even as customers communicate over different 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. With Twilio Conversations and the Interactions API, you can create inbound and outbound conversations with your customers. Your agents will have more granular control on the lifecycle of a conversation and can proactively reach out to your customers. For detailed examples and use cases, see the Interactions API documentation.

Flex Conversations requires:

  • A Flex Account/Project
  • Flex UI version 2.x.x or newer
  • Conversations Addresses for your phone numbers or sender IDs
  • Flex onboarding sets up default handlers for inbound Chat and inbound SMS. It also configures standard Studio interaction for these to build any chat bot logic prior to agent handover. The default handlers – Chat flow (see the demo app for more information) and Conversation flow – use the "Incoming Conversation" trigger with the Send to Flex widget to handover to the Flex application. You can manage Addresses using the Twilio Console. Learn more in handle inbound SMS and WhatsApp messages.

Inbound flow from a messaging channel

high level inbound flow from a messaging channel

The Conversations Service will create a new Conversation as per the Address configuration for your Flex phone number. In the diagram above, it was configured to invoke a Studio Flow. Once a conversation arrives at Studio, you can design your bespoke flow to handle this conversation. If you decide to send to Flex, use the Send To Flex widget. This widget will call the Interactions endpoint which in turn creates a task and route it to the agent. 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)

In this scenario, the agent clicks on start conversation through a Flex plugin or a third-party application. This invokes the Interactions API to create an outbound channel and add the customer to it. Once that orchestration is complete, the agent is able to send and receive messages from the customer.

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

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

This is similar to the previous outbound flow except in this case, you need to create the conversation first and add your scoped webhook integration to handle the reply. Once you’ve done that, you can send a message to the participant. When the participant replies, the scoped webhook will invoke your integration. When your integration is invoked, you can auto-reply to the customer and then forward to Flex by using the Interactions API.

Learn more about how you can send outbound messages with Flex Conversations.

Rate this page:

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.

Thank you for your feedback!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!