Twilio Flex: Hand over omnichannel conversations

written by Theodor Gieschen from Twilio

Guide for how to connect customers to a Cognigy bot over a messaging channel & escalate the conversation to a Flex Agent.

Steps:

  • Create regular Cognigy Bot, however, you adjust “options” => “data” at the point you would like to escalate the conversation, for example{ “escalation”: true}, as shown here:

    mceclip0.png

  • Create a REST Endpoint in Cognigy and connect it to the Cognigy Flow you just created. Make sure to note down the Endpoint URL in the REST Endpoint configuration as we’ll need this to connect Twilio to this bot.

  • Edit the default “Messaging Flow” Studio Flow in your Flex project (or create your own flow), that looks like this:

    mceclip1.png

    The purpose of the widgets are:
  1. Initialize the flow variable “text” which represents the latest message a user-entered to the user’s initial message.
  2. Process the user’s latest message by forwarding it to the Cognigy endpoint we defined earlier. We will be adding additional parameters to the request as explained here:

    1. userId: the unique user ID; for example, this could be set to the user’s phone number when using SMS as a channel, via {{trigger.message.From}}

    2. sessionId: the unique session Id; can be set to the proxy session for example, via {{trigger.message.ChannelAttributes.proxySession}}

    3. text: the latest text the user entered to initiate or respond to the bot; We saved this value as the flow variable “text” which can be accessed via {{flow.variables.text}}

    4. data: optional additional data to add for context in the Cognigy bot; added the phone number here for user ID when making data fetches from the Cognigy bot for contextual information, via {{trigger.message.From}}
  3. Check if the user initiated an escalation request. Here we check for the variable we defined in the first step, which would be accessed similar to:

    ProcessUserInput.parsed.data.escalation

  4. If no escalation request was made, respond to the user with the answer from the Cognigy Bot, for example via {{widgets.ProcessUserInput.parsed.text}} and wait for the user’s response.
  5. We set the flow variable “text” to be the user’s response from 4, which would look like {{widgets.SendUserReply.inbound.Body}} and forward the flow back to step 2 to process the latest user response.
  6. If the user initiated an escalation request we notify the user of the escalation by sending the last Cognigy message via {{widgets.ProcessUserInput.parsed.text}}
  7. We escalate the conversation to an agent.

Comments

0 comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful