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:
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.
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.
In this step, we will create a new Studio Flow that routes new inbound Conversations to Flex as per the following diagram:
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"
Click Save and Publish your changes.
We will use this Studio Flow SID when we create the Conversations Address
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:
1"conversation": {2"EventType": "onMessageAdded",3"InstanceSid": "IS497d26fb5332435e9cccadbf114d4aff",4"Attributes": "{}",5"DateCreated": "2022-02-21T05:01:46.886Z",6"Index": "0",7"From": "customer1",8"MessageSid": "IM3032b674d70647a798ffa8e78eb23abf",9"AccountSid": "ACd9ecc21b1ae907b3cf65d9044c891eb3",10"Source": "API",11"ChannelSid": "CH1b8e780f14db45b6b44b070bb3f9172c",12"RetryCount": "0",13"Author": "customer1",14"To": "CH1b8e780f14db45b6b44b070bb3f9172c",15"Body": "hello",16"WebhookSid": "WHae4ab4d5e7344cdab97274af52159f9c",17"ConversationSid": "CH1b8e780f14db45b6b44b070bb3f9172c",18"ChannelAttributes": {}19}
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.
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.