Note: For accounts created on or after March 30, 2022, the following prerequisites should already be set up out-of-box as part of Flex account creation and you can skip this section. If you can see this prerequisite UI under Flex > Manage > Messaging > Conversations, your account was created earlier and you should follow these steps.


Flex Conversations requires Flex UI 2.0. If you are on Flex UI 1.x, please refer to Chat and Messaging pages.

Prerequisites for using Flex Conversations are:

Install Flex UI 2.0

Please follow the instructions for enabling Flex UI 2.0 in your account.

If you are using plugins with Flex UI 1.x, you will need to perform the migration before you can use Flex Conversations.

Prepare your Flex Integration

For inbound contact, Flex Conversations allows you to use either Twilio Studio or your own webhook to send the interaction to Flex. In this guide, we will walk you through setting up a Studio Flow and a webhook to facilitate forwarding of incoming contact to Flex. To learn more about Twilio Studio, visit the Configure Pre-Agent Workflow with Studio page.

Create a Studio Flow for Conversations

In this step, we will create a new Studio Flow that routes new inbound Conversations to Flex as per the following diagram:

Screen Shot 2022-03-09 at 12.54.15 PM.png

To get started:

  • Create a new Studio Flow
  • Locate the Incoming Conversation trigger. If you don't see it, your account is missing a special account flag. Please contact support or your account manager for assistance.
  • Connect the Incoming Conversation trigger to a Send to Flex widget. Configure the widget as follows:
    • Select your desired TaskRouter Workflow
    • Set the Task Channel to "Programmable Chat"
      Screen Shot 2022-03-09 at 12.55.06 PM.png
  • Click Save and Publish your changes.
  • We will use this Studio Flow SID when we create the Conversations Address

Create a webhook handler (Advanced)

An alternative to using Studio to handle inbound contact is to have your backend application handle it. Your backend will need to do the following:

  • Make an endpoint available which will get called for the “onMessageAdded” event. The following is an example payload this endpoint will receive:
    "conversation": {
          "EventType": "onMessageAdded",
          "InstanceSid": "IS497d26fb5332435e9cccadbf114d4aff",
          "Attributes": "{}",
          "DateCreated": "2022-02-21T05:01:46.886Z",
          "Index": "0",
          "From": "customer1",
          "MessageSid": "IM3032b674d70647a798ffa8e78eb23abf",
          "AccountSid": "ACd9ecc21b1ae907b3cf65d9044c891eb3",
          "Source": "API",
          "ChannelSid": "CH1b8e780f14db45b6b44b070bb3f9172c",
          "RetryCount": "0",
          "Author": "customer1",
          "To": "CH1b8e780f14db45b6b44b070bb3f9172c",
          "Body": "hello",
          "WebhookSid": "WHae4ab4d5e7344cdab97274af52159f9c",
          "ConversationSid": "CH1b8e780f14db45b6b44b070bb3f9172c",
          "ChannelAttributes": {}

    When the endpoint is invoked, create an interaction. When an interaction is created, it will create a task which will get routed to an agent. Please refer to the API documentation and our guide for creating an Interaction for an inbound conversation.
  • You will use this endpoint (webhook URL) when you’re configuring a Conversations Address for your Flex phone number.

Default Conversation Service

If the Flex Conversation Service is not set as your default Conversation Service, the Flex Console will prompt you to make the necessary configuration change. Apply the change.

Screen Shot 2022-03-21 at 2.27.34 PM.png

What's next?

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!