Hand Over Power Virtual Agent Conversation to Human Agent using Omnichannel

Introduction

Scenario

Implementation

Modifying Default Transfer to Agent Trigger

Configure Transfer to Agent Node

Registering Application in Azure AD

Setting up Omnichannel for Customer Service

Configure the Omnichannel Hand Over

Create the Queue

Create Workstream

Add Ruleset

Add Bot to the Worksteam

Add Context Variable

Test the implementation

Summary

Introduction

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.

Scenario

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.

Implementation

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

Graphical user interface, application

Description automatically generated

Specify the name and language for use in the bot as well as the environment where it should be provisioned.

Graphical user interface, diagram, text

Description automatically generated

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.

Graphical user interface, text, application, email

Description automatically generated

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

Graphical user interface, application

Description automatically generated

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.

Graphical user interface

Description automatically generated

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.

Graphical user interface, application

Description automatically generated

In the Hand off to Live Agent branch, we will add the node to transfer conversation to the agent.

Graphical user interface

Description automatically generated

Modifying Default Transfer to Agent Trigger

Power Virtual Agent by default has a topic that responds to the trigger words like “Talk to agent” that gives the below standard response.

Graphical user interface, text, application

Description automatically generated

We can view this Topic from the collection which is named as Escalate.

Graphical user interface, application

Description automatically generated

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

Graphical user interface, text

Description automatically generated

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.

Timeline

Description automatically generated

Configure Transfer to Agent Node

Before making further changes, lets save the Topic and Publish the bot once.

Graphical user interface, application

Description automatically generated

Now lets configure the Agent transfer by selecting Agent Transfers -> Omnichannel from the left pane.

Graphical user interface, application

Description automatically generated

Select Enable to turn on the Omnichannel experience.

Graphical user interface, text, application

Description automatically generated

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.

Graphical user interface, text, application, chat or text message

Description automatically generated

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

Graphical user interface, application

Description automatically generated

Now we can head back to the omnichannel pane where we can select the recently provisioned environment.

Graphical user interface, text, application, email

Description automatically generated

We can also connect the bot to the customer service environment by entering the Application ID which we will generate by registering in Azure.

Registering Application in Azure AD

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.

Graphical user interface, text, application, chat or text message

Description automatically generated

Click on New Registration and specify a name for the application and click on Register

Graphical user interface, text, application, email

Description automatically generated

Once the Application is registered, select the Application ID from the Overview tab.

Graphical user interface, text, application, email

Description automatically generated

We will now paste this in the omnichannel pane. This will enable the Add your bot button. Click on it.

Graphical user interface, text, application, email

Description automatically generated

The bot has been successfully added

Graphical user interface, text, application, email

Description automatically generated

Setting up Omnichannel for Customer Service

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.

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.

Graphical user interface, application

Description automatically generated

Specify the environment in which you have the bot created and click on Install.

Graphical user interface, text, application, email

Description automatically generated

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.

Configure the Omnichannel Hand Over

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.

Graphical user interface, website, Teams

Description automatically generated

In the users section we can see the Bot added as a User.

Graphical user interface, text, application, email

Description automatically generated

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

Create the Queue

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.

Graphical user interface, text, application

Description automatically generated

Clicking on Create will provision the Messaging Queue

Graphical user interface, application

Description automatically generated

Thus the queue is created and now we need to add the Human Agent as well as the Power Virtual Agent to the Queue

Graphical user interface, application

Description automatically generated Click on Add users to add the agents to the queue.

Graphical user interface, text, application, chat or text message

Description automatically generated

Thus we have completed the setting up of the queue.

Graphical user interface, text, application, email

Description automatically generated

Create Workstream

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.

Graphical user interface, text, application, email

Description automatically generated

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.

Graphical user interface, text, application, email

Description automatically generated

Click on setup chat and give a name to the Chat Widget.

Graphical user interface, application

Description automatically generated

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.

Graphical user interface, application

Description automatically generated

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.

Graphical user interface, text, application

Description automatically generated

Add Ruleset

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.

Graphical user interface, text, application, email

Description automatically generated

Click on Create ruleset to define the routing. Give the ruleset a name and description

Graphical user interface, application

Description automatically generated

Click on Create to provision the ruleset. Now we can add the routing rule inside the ruleset

Graphical user interface, text, application, email, Teams

Description automatically generated

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.

Graphical user interface, text, application

Description automatically generated

The ruleset is created

Graphical user interface, text, application

Description automatically generated

Add Bot to the Worksteam

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.

Graphical user interface, text, application

Description automatically generated

Click on Add bot to select the Power Virtual Agent that we had connected to the Omnichannel.

Graphical user interface, text, application

Description automatically generated

It will list the available bots. Select the bot that we would like to add to this workstream and Click on Add.

Graphical user interface, text, application, email, website

Description automatically generated

Add Context Variable

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

Graphical user interface, text, application

Description automatically generated

Clicking on View Context variables shows the details of the variables

Graphical user interface, text, application

Description automatically generated

We can access these variables by defining them in the Context Variables section in the WorkStream

Graphical user interface, text, application

Description automatically generated

Click on Add Context variable to add the variables by the same name as provided by the bot and click on Create.

Graphical user interface, text, application

Description automatically generated

Thus we have completed the configurations within the Workstream .

Test the implementation

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.

Graphical user interface, text, application, chat or text message

Description automatically generated

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

Graphical user interface, text, application, chat or text message

Description automatically generated

Now lets type in a query which our existing topics cannot handle.

Graphical user interface, text, application, chat or text message

Description automatically generated

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

Graphical user interface, text, application, chat or text message

Description automatically generated

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

Graphical user interface, website

Description automatically generated

We can see that in the Open work items, it has come up.

Graphical user interface, text, application, email

Description automatically generated

The agent can based on his availability, assign it to himself

Graphical user interface, text, application

Description automatically generated

This will open the chat between the agent and the end customer.

Graphical user interface, application

Description automatically generated

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.

Graphical user interface, text, application, chat or text message

Description automatically generated

Summary

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.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles