We have seen how to automate the interaction with Power Virtual Agents using Topics and how to drive the conversation based on the user inputs. However, there can be a situation where the Topics that we have defined is not covering the problem statement that the user is facing or he may have a query that is not covered within the existing Topics. In this scenario, we a human intervention is required.
In this article, we will see how to transfer the conversation from a bot to a Live Agent who is a Human user to take up further communication with the End user.
We will consider a scenario where we will build a simple bot that provides the Organization links to internal tools, process documents and Project Repositories. However, there can be a situation where the requested information is not present in the Power Virtual Agent topic to provide a response. In such a case, we will try to implement handing over the conversation to a human agent who can assist in sharing the requested information.
Let’s head over to https://web.powerva.microsoft.com/ and click on the Bot symbol on the top right corner which lets you create a new bot
Specify the name and language for use in the bot as well as the environment where it should be provisioned.
It will create a basic bot where we can add the customizations needed for our requirement. We can see the section Topics which by default lists multiple conversation topic listed out. A topic defines how a bot conversation will be initiated and how the bot would respond to user interactions.
Click on New Topic and Select From blank to create a Topic and we will name it ProcessEnquiry.
To trigger the topic, so that the control flows to that specific topic, we will define few words called Trigger Phrases that will transfer the control to these topics. The trigger phrases can be single keywords or a group of words and to cover a broad spectrum of possible trigger conditions, It is good to mention 5-10 different and still related phrases. Click on Trigger phrases that will open a right pane where we can add the trigger words.
We will then add a welcome message followed by the question to the user to understand what kind of information he/she is looking for
Based on the user input, we will branch the conversation to 4 branches which will show the respective process document links so that the user can navigate to it to get the needed information.
However if the user has a query not related to the provided options above, he should still have an option to get the needed information for which we will include a new functionality to transfer the conversation to a live agent.
Lets add a new Option to the initial question we were asking the user that gives the flexibility for the user to select it which will take the control to the branch that will hand off the conversation from the bot to the live agent.
In the Hand off to Live Agent branch, we will add the node to transfer conversation to the agent.
Power Virtual Agent by default has a topic that responds to the trigger words like “Talk to agent” that gives the below standard response.
We can view this Topic from the collection which is named as Escalate.
As we can see, this topic does not in reality transfer to an agent. It just outputs the message without providing the actual hand off link
We handled the Transfer to agent scenario that occurs when a user clicks on the Transfer to agent option asked by the Bot. However, if the user types in a trigger word to transfer the conversation to a live agent, he will be seeing this meaningless message without any link. To avoid confusion for the end user, who may reach this topic by typing in the trigger word, lets delete this message and add a Transfer to Agent Node.
This way for any human interactions, we have a consistent flow that takes it to the Omnichannel that we are going to configure.
Before making further changes, lets save the Topic and Publish the bot once.
Now lets configure the Agent transfer by selecting Agent Transfers -> Omnichannel from the left pane.
Select Enable to turn on the Omnichannel experience.
You would need a Dyanmics 365 Customer Service environment for the Omnichannel to work. If available, it will be listed in the environment drop down, else create a free trial by clicking on the link.
Enter the work email id and subscribe for a 30 day trial if you are activating Dyanmics 365 Customer Service for the first time. On Successful subscription and provisioning, we can see Dynamics 365 Customer Service in action
Now we can head back to the omnichannel pane where we can select the recently provisioned environment.
We can also connect the bot to the customer service environment by entering the Application ID which we will generate by registering in Azure.
To generate the Application ID and to connect the bot with Customer Services lets register an application by heading over to portal.azure.com and search for App Registrations.
Click on New Registration and specify a name for the application and click on Register
Once the Application is registered, select the Application ID from the Overview tab.
We will now paste this in the omnichannel pane. This will enable the Add your bot button. Click on it.
The bot has been successfully added
The yellow banner on top indicates missing features. For our bot to hand off a conversation to your omnichannel interface, we have to install the appropriate extension solutions for Dynamics 365 Customer Service omnichannel integration and Power Virtual Agents.
- If we only want text-based (messaging) handoff capabilities, we must install the following extension:
- If we want both text-based (messaging) and voice-based handoff capabilities, we must install each of the following extensions in the following order:
- Power Virtual Agents telephony extension
- Omnichannel Power Virtual Agents extension
- Omnichannel voice Power Virtual Agents extension
As we are going to hand over only chat conversations, we will just install the Omnichannel Power Virtual Agents Extension. Head over to Power Platform Admin centre and select the environment where omnichannel has to be configured. From Resources-> Dynamics 365 Apps , select Omnichannel Power Virtual Agent Extension.
Click on Install which will open a right pane where you would be asked to agree to the terms of service.
Specify the environment in which you have the bot created and click on Install.
This will complete installation of the extension package
Now that we have completed the connection of the bot with the omnichannel, lets head over to Dynamics 365 to configure the Workstream and Queue which will handle the bot conversation handover.
https://<tenant>.crm.dynamics.com/apps will take you to the Dynamics 365 Unified Interface page from which we can navigate to the Omnichannel Admin centre and Omnichannel for customer serivce with which we will work in the next steps.
First, let’s head over to the Omnichannel admin centre.
In the users section we can see the Bot added as a User.
So as to get started with the configurations of the Omnichannel we will do 3 actions
- Create a Queue
- Create a Workstream
- Create a RuleSet
To hold the incoming conversations that are handed over, we will create a Queue and the human agent as well as the bot that we have created to the queue.
From the Queue tab in the left pane, click on Queue and specify the name and the type of the queue to be created. We can create a Messaging/Record/Voice queues. For this demo, we will create a messaging handover queue.
Clicking on Create will provision the Messaging Queue
Thus the queue is created and now we need to add the Human Agent as well as the Power Virtual Agent to the Queue
Click on Add users to add the agents to the queue.
Thus we have completed the setting up of the queue.
Now let’s create a Workstream. A workstream acts as a container to route, and assign work items. From the Workstreams tab in the left pane, click on New Workstream to create a Messaging Type Workstream. In the Channel, we will select Chat as we will be handling chat based customer service. It provides the option to setup Voice, Facebook, WhatsApp etc channels as well.
Now that the Workstream is created and clicking on the newly created workstream will open up the below page where we can configure the chat that we will be using for interacting with the users.
Click on setup chat and give a name to the Chat Widget.
Subsequent pages let you define the chat widget behaviour and features. For time being we will keep the defaults and proceed to the next pages.
Thus we have finished the setting up of the Chat Channel within the Workstream. It will also give us a HTML script tag that can be used to plug and play the chat widget in any webpage. Copy the script and we will test it out in a while.
We have to make few more configurations in the workstream, let route the requests to a queue so that whenever a user initiates the chat, it goes to the queue for service.
Click on Create ruleset to define the routing. Give the ruleset a name and description
Click on Create to provision the ruleset. Now we can add the routing rule inside the ruleset
We can specify conditional routing to control the routing to different queues based on the conditions. For now, we will do a simple routing to the Process Enquiry Queue that we had created previously so that all conversational requests go to it.
The ruleset is created
Lets head back to the workstream and add the Power Virtual Agent that we had created to the Workstream so that it will handle the conversations before handing it over to a human agent. In the Workstream, at the bottom, click on Show advanced settings.
Click on Add bot to select the Power Virtual Agent that we had connected to the Omnichannel.
It will list the available bots. Select the bot that we would like to add to this workstream and Click on Add.
While testing the Power Virtual Agent and handing over the conversation to the agent. It will pass a set of variables from the bot which we can view by clicking on View context variables
Clicking on View Context variables shows the details of the variables
We can access these variables by defining them in the Context Variables section in the WorkStream
Click on Add Context variable to add the variables by the same name as provided by the bot and click on Create.
Thus we have completed the configurations within the Workstream .
Now lets see how the Power Virtual Agent and Omnichannel Agent hand over works. We will copy the chat widget script to a webpage to test this. A readily available online HTML editor like W3schools could be a good testing ground.
Adding the Chat Widget Script to the body of the html and running it will open up the Omnichannel where we have the Power Virtual Agent connected to it.
Lets type in a trigger word that will invoke the Power Virtual Agent branch for showing the leave documents
Now lets type in a query which our existing topics cannot handle.
It will ask us to rephrase the query. So lets try to speak with a human agent. It has handed over the request to the Omnichannel agent
Now lets head over to the Omnichannel agent dashboard by going to the https://<tenant>.crm.dynamics.com/apps and selecting Omnichannel for customer service
We can see that in the Open work items, it has come up.
The agent can based on his availability, assign it to himself
This will open the chat between the agent and the end customer.
It will instantly show the agent name who has joined the chat and the Power Virtual Agent has successfully handed over the conversation to the Human agent and they can converse and take it forward.
Thus we saw how to setup a handover between Power Virtual Agent and Omnichannel in Dynamics 365 so that when the end user is not able to find the needed details in the topics defined, the conversation can be handed over to the human agent.