We can integrate Microsoft’s Omnichannel for Customer Service with Power Virtual Agents. This is a great but what if you want the “BOT” to respond to the customer in context? Say by commenting on data entered in a pre-chat survey. In this post I will explain how to pass context values to the Power Virtual Agent.
In my Live chat workstream I have already configured a pre-conversation survey ….
A closer look at my workstream shows I have three questions (all of which are mandatory!). When a chat starts I ask for the customer’s name, email address and question type.
If a human answers this chat they will see the pre-chat responses in the customer summary form. (As shown below.) This is great because the agent can now engage with the customer effectively.
If no agents are available I route to a Power Virtual Agent. Imagine how annoying it would be for the customer if they needed to repeat their email address to the BOT!! I don’t know about you but I get very angry if I have to tell someone something twice …. Therefore I’d like my Bot to also have access to the same values as seen by the human agent.
Luckily we can define the pre-chat variables and other context variables in our Power Virtual Agent. We do this by adding a “Question” into any topic in our BOT. I have decided to add my questions into the “Greeting” topic. You could (for example) create a topic called “Context Variables” or something like that! As once defined in any topic the variables are available to all topics.
Tip: I found that making my pre-chat survey questions (if needed by the BOT) mandatory was essential. As if the BOT starts and it hasn’t got a response for a particular value it will prompt the customer for the “missing” information. @Microsoft, if you are reading this! Please alter this behaviour as I might have optional pre-conversation values that I want to pass to the Power Virtual Agent.
When you define the question it has to be done in a particular way! Firstly set the “Identify” field to “User’s entire response”.
Then click the “pencil” icon. For the name of the question enter the name of your pre-chat conversation question. (Exactly as you have defined it in your workstream.)
Also select “Bot (any topic can access)” and tick “External sources can set values”.
I now have my pre-conversation variables available in my BOT. These could be used in several ways. For example, below I have personalised a message by including the name the customer entered in the pre-chat conversation.
In a more complex examples you might be triggering a Flow from your Power Virtual Agent and you could pass the responses captured in the pre-conversation to the Power Automate Flow.
You can actually pass any conversation context value to the BOT like this! One value that I have found really useful is the GUID of the conversation. As within my BOT I can then call a Flow that queries the conversation and uses / updates the related information as required.
To “grab” the conversation GUID simple create a question as already described but this time add “msdyn_liveworkitemid” as the name.
There are other values you might want to use. “msdyn_contact_msdyn_ocliveworkitem_Customer”, “msdyn_account_msdyn_ocliveworkitem_Customer”, “msdyn_incident_msdyn_ocliveworkitem”. These will return a JSON string with the ID of the contact, account or incident associated with the conversation.
Tip: In my tests I found that my conversations could be linked to any one of these tables. So none were mandatory. Meaning if the information was “missing” my Power Virtual Agent started to prompt for it. So in my example the conversation ID was more useful, as I could query the customer on the conversation without using these values.
You can find out more information connected with passing context values to your Bot here!