The goal for this guide is to clarify how the handover works, and how to set it up.
How it works
We need a couple of elements to do a handover in Web Conversations to MSC. First we need to know when to do a handover, for this we use the ‘triggerEvent’ metadata in the CAIC output. This triggers a CAIC event after the answer, which will start the intake dialog before the actual handover. This will contain the availability check to see if MSC agents are available, capture inputs to retrieve information from the user like name/email and the actual Handover to MSC containing this information. When the handover happened, Web Conversations needs to be notified that a handover occured, so it can update the UI to enable file attachments for example. This can be done by setting the Handover Endpoint in your Conversational Router adapter for Web Conversations.
How to set it up
Handover Event
Create a handover event.
Create a CAIC event to return a dialog which will do the intake before handing over a conversation to a live agent in MSC. The event name is free to choose. In this example we use "handover" as the event name.
Handover Dialog
Create a CAIC dialog containing the following nodes:
Step 1: First step is to check if agents in MSC are available. We use the API Callout node to do an availability check:
GET https://presence.robinhq.com/api/v1
Required parameters can be found here.
Create an agentStatus dialog variable to store the response of the API call online or offline into the variable.
Step 2: Add a Logical Step node to differentiate if agents are online or offline . When agents are online, we continue the handover flow to the next Capture Input node at 3. We use the Fallback node in case of agentStatus offline or when the call failed. This can go to a regular output node notifying that there are no agents available at the moment.
Step 3: Add Capture Input nodes to retrieve information used within the handover call to MSC. The amount of nodes can vary, but in this use case we take one node for email and one node for name . We capture the inputs in the corresponding dialog variables, which we will use later within the handover.
Step 4: Add an API Callout node when all information is present to do the handover. In our case that’s the name and email dialog variables.
POST https://api.conversational.cm.com/conversational/control/v1/accounts/{TechnicalLinkId}/chats/{ChatId}/routing/mutationrequests
More information can be found here: Routing Control
The required TechnicalLinkId can be found in your Conversational Router settings:
The required ChatId inside the URL can be added as a CAIC conversation variable. In order to use it, you will need to create a new conversation variable called chatId and use it inside the URL and Body. The value will automatically set when a session is present.
There are 2 headers required:
1) X-Cm-Producttoken: yourProductToken, which can be found in your Conversational Router settings as described in the previous step.
2) Content-Type: application/json
The body should be of Type: Raw and will look as following:
TriggerEvent Addition
Create a CAIC output containing metadata of type “text”. The name of the metadata should be “triggerEvent” and the value needs to be the event name from step 1 ( handover in this case). This metadata will trigger the event after the answer and will start the dialog handover.