Power Virtual Agent is a member of the Microsoft Power Platform.
This guide is my “Power Virtual Agent in a Day” - Workshop Exercise Skript and a good starting point to explore PVA. Imagine not only giving your customers a text-based chatbot on your website, but with this guide, you could serve them in your phoneline before they reach your contact center agent. You can give them answers to their inquiries without making them wait for a free contact center agent. You can do more with less for them.
Bringing yourself up to speed
Create your first chatbot
Prepare the basics
Add some QnA topics
Add IVR replacement with conditions and custom entities
Optional: send an adaptive card to the Microsoft Teams channel
Optional: Integrate the bot into a website
Configure your bot in Audiocodes Voice.AI
Optional: AI Builder feedback system with sentiment analysis
Next steps: Application lifecycle management basics
Start with CI/CD and export the solution to a GitHub repository
Next steps: Analytic basics
Assets
Before starting with Power Virtual Agent, please ensure you meet the prerequisites. Using a trial subscription or a community plan is an excellent start.
or
Use GitHub for Application Lifecycle Management and AudioCodes Voice.AI Connect Cloud to give your bot a voice; consider using Voice AI connect enterprise for production.
Launch Power Virtual Agents editing canvas and create your first chatbot.
Microsoft installed some default topics and entities; as we want to begin from nothing, we will delete some of them.
Delete “Lesson 3”
Next, we go to the “Greetings” Topic and change the flow by modifying the first message.
Keep in mind would like to use the bot on the phone — this means no graphics, no emoticons, no links, and only short sentences.
Next, we need to create a new “Confirmed Success” topic named “Success”.
Can I help with anything else?
With answers:
Yes
No
This newly created topic will replace the last node, “Confirmed Success” in the “End of Conversation” topic. As “Confirmed Success” is not suitable for voice bots as there is a graphical feedback element involved.
Next, create a new topic, “transfer_agent_pva”. This topic will trigger a call transfer from the bot to a human. There are several ways to do so.
Here we will work with the third-party solution “Voice AI Connect” from AudioCodes.
Voice AI Connect is available in two flavors:
A cloud solution for trials and development purposes. This is what we use in this workshop. You can use your SIP Trunk & Phone Numbers or buy Numbers from AudioCodes.
An enterprise solution, you can host yourself on Azure and bring your Carrier or as a fully managed solution with phone numbers. You can ask me to get the insides.
Please hold the line; you will be connected to a human.
{
"activityParams": {
"transferTarget": "tel:+49000000000"
}
}
Finally, modify the “Escalation” topic to use the newly created “tranfer_agent_pva” topic as the end node.
With these modifications, our bot now has decent start- and end sequences and can act as a phone-enabled assistant.
To give you an idea of how to create topics for standard Questions, we modify “Lesson 1” and “Lesson 2”. Modifying saves you some work, as you do not need to start from a blank flow.
Let´s assume we want to answer questions, on the phone, regarding our opening hours.
We open “Lesson 1” and rename it to “Opening hours”
We modify both message nodes to reflect this.
I'm happy to help with our daily open hours.
The Munich and Stuttgart hours are:
Mon-Fri: 9am to 6pm, Saturday: 10am to 4pm, Sunday: Closed
The Frankfurt hours are: Mon-Fri:
9am to 6pm, Saturday: 10am to 4pm., Sunday: Closed
Let´s assume we want to answer, on the phone, questions regarding our store location.
We rename “Lesson 2” to “StoreLocation” and replace the options with
Which location are you interested in? We are in Frankfurt, Stuttgart or Munich.
Stuttgart
Frankfurt
Munich
and modify the answer in each condition (message node)
Our <variable.pva_StoreLocation> store located in Street Number, Postcode Stuttgart
Our <variable.pva_StoreLocation> store located in Street Number, Postcode Frankfurt
Our <variable.pva_StoreLocation> store located in Street Number, Postcode Munich
By integrating a custom entry, we make the dialog more natural. The caller can ask to get transferred to a human and can specify the target as an answer to the bot asking for details or go directly by asking for a specific target.
Create three items with three synonyms each.
Transfer Target 1
Item
human resources
with synonyms
personnel
workforce management
administration of human resources
Transfer Target 2
Item
sales
with synonyms
sales department
shop
store
Transfer Target 3
Item
support
with synonyms
technical helpline
service department
help
Rename “Lesson 4” to “IVRReplacement”
Please connect me to sales
I want to speak with sales
I want to talk to sales
Please connect me to supporr
I want to speak with support
I want to talk to support
Please connect me to human resources
I want to speak with human resources
I want to talk to human resources
We use the created custom entity “IVRTargets” as a switchboard; if there is no identifiable target, we route to the standard human escalation point “Escalate” with the redirect to “transfer_agent_pva”.
{
"activityParams": {
"transferTarget": "tel:+49000000000"
}
}
With an adaptive Card, e.g., to a Microsoft Teams Channel, you could give your human agents a chance to speed up their answering to the caller and make the caller’s experience personal.
Add questions to the “IVRReplacement” topic, e.g., asking for the transfer reason and a customer number.
The user’s response will be stored into a variable each, which we use as input for our power automate flow.
The flow itself is straightforward.
An example adaptive card could look like this, you need to edit the parts in “<>”.
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "Incoming Call",
"wrap": true,
"style": "heading"
},
{
"type": "FactSet",
"facts": [
{
"title": "Customer Number",
"value": "<your variable customer number>"
},
{
"title": "Call Reason",
"value": "<your variable reason>"
}
]
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "Open CRM",
"url": "<your link to your crm systems record matching customer number>"
}
]
}
The resulting message will look like the picture below. Please remember not to execute flows in a productive environment with a user’s account; always use service principal accounts.
To integrate your bot into your website, it is a good practice to use Microsoft´s bot framework web chat component. As Microsoft created the “Azure Bot Service” Bots component, we must change the integration code a little to make it work with Power Virtual Agent.
To use the component, you need to extract the bot id from the power virtual agent editing canvas and integrate it into the source.
var BOT_ID = "#{botidtoken}#";
var theURL = "https://powerva.microsoft.com/api/botmanagement/v1/directline/directlinetoken?botId=" + BOT_ID;
you can find the ID within the Settings/Channels/Custom Website(the red part between “/bots/new_bot_” and “/webchat” )
You can find a working example on GitHub. The example is prepopulated with configuration options; please see details on the configuration options within the defaultStyleOptions.ts file within the repository of Microsoft´s webchat component.
Please sign up for “Voice.Ai Connect Cloud” and acquire a Phone Number or configure your sip trunk by following the documentation.
Let´s give the bot a voice. Retrieve your Web channel Secret (in PVA: Settings/Security/Web Channel Security)
and go to your Voice.AI Configuration Interface.
Add the Bot
Figure 30: configure routing “inbound”
If you work in a trial environment, you will be asked to apply for an AI Builder trial during the flow creation. There are no cost implications.
With Power Virtual Agents, the use cases are limitless and based on the requirements, and we can keep pushing the boundaries of its abilities. By integrating Power Virtual Agents with Power Automate and AI Builder we can further expand the horizons of its usage by leaps and bounds. Here we will see how to leverage AI builder and make use of Sentiment Analysis to analyze the textual feedback from the user.
Create a new topic “Feedback
and add 2 Nodes,
Welcome to our Feedback System.
How was your experience with this virtual assistant?
Our solution should not run under a user account. This principle is a best practice for the power platform and allows the IT department to monitor and manage the virtual agents. It is the basis for application lifecycle management.
To create a service principal account, we need to set up an App Registration in Azure Active Directory.
In the Azure portal, select “Azure Active Directory” in the left pane and select “App registrations”, and click on “New registration”.
On the “Register an application” page, enter your application’s registration information:
In the Name section, enter a meaningful application name like “Botplatform”
Select “Accounts in any organizational directory” option from Supported account types section.
Click on “Register” to create the application
Upon creation of the application registration, please note and save the “Directory (tenant) ID” and the “Application (client) ID” of the application.
On the navigation panel of the Overview page, select “API permissions”.
Next, proceed to create a client secret. In the navigation panel, select “Certificates & secrets”:
To deploy solutions as part of a CI/CD pipeline, an "Application user" needs access to the environment. An "Application user" represents an unlicensed user that is authenticated using the application registration completed in the previous steps.
Navigate to your environment on Power Platform Admin Center
Navigate to "Settings" > "Users + permissions" > "Application User".
Select "+ new app user". A panel will open on the right-hand side of the screen.
Select "+ Add an app". A list of all the application registrations in your Azure AD tenant is shown. Proceed to select the application name from the list of registered apps.
Under "Business unit", in the drop-down box, select your environment as the business unit.
Under "Security roles", select System administrator, and then select "create". This will allow the service principal access to the environment.
With the "App registration" and the "Application User", we can use "GitHub Actions" to manage our environments. Yes, environments as we need several to work safely and professionally. Please register this Application User in every environment you deploy (dev, staging, testing, and production).
A solution is a kind of “application container”. In this “box”, you will find everything related to your project.Within the solution, you will find all your bots, flows, connector references, and other stuff a developer produced.
GitHub actions can export your bot environment (as an unmanaged solution) from a development environment to a GitHub Repository.
Replace the solution name, in the example, with the name of your solution.
name: export-and-branch-solution-universal
# Export solution from DEV environment
# unpack it and prepare, commit and push a git branch with the changes
on:
workflow_dispatch:
inputs:
# Change this value
solution_name:
description: 'name of the solution to worked on from Power Platform'
required: true
default: DemoEnvironment
#Do Not change these values
solution_exported_folder:
description: 'folder name for staging the exported solution *do not change*'
required: true
default: out/exported/
solution_folder:
description: 'staging the unpacked solution folder before check-in *do not change*'
required: true
default: out/solutions/
solution_target_folder:
description: 'folder name to be created and checked in *do not change*'
required: true
default: solutions/
DEV_ENVIRONMENT_URL:
description: 'Development environment url.'
type: string
required: true
CLIENT_ID:
description: 'Client ID.'
type: string
required: true
TENANT_ID:
description: 'Tenant ID'
type: string
required: true
jobs:
export-from-dev:
runs-on: windows-latest
# or you can say runs-on: ubuntu-latest
env:
RUNNER_DEBUG: 1
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: who-am-i action
uses: microsoft/powerplatform-actions/[email protected]
with:
environment-url: ${{inputs.DEV_ENVIRONMENT_URL}}
app-id: ${{inputs.CLIENT_ID}}
client-secret: ${{ secrets.PowerPlatformSPN }}
tenant-id: ${{inputs.TENANT_ID}}
- name: export-solution action
uses: microsoft/powerplatform-actions/[email protected]
with:
environment-url: ${{inputs.DEV_ENVIRONMENT_URL}}
app-id: ${{inputs.CLIENT_ID}}
client-secret: ${{ secrets.PowerPlatformSPN }}
tenant-id: ${{inputs.TENANT_ID}}
solution-name: ${{ github.event.inputs.solution_name }}
solution-output-file: ${{ github.event.inputs.solution_exported_folder}}/${{ github.event.inputs.solution_name }}.zip
- name: unpack-solution action
uses: microsoft/powerplatform-actions/[email protected]
with:
solution-file: ${{ github.event.inputs.solution_exported_folder}}/${{ github.event.inputs.solution_name }}.zip
solution-folder: ${{ github.event.inputs.solution_folder}}/${{ github.event.inputs.solution_name }}
solution-type: 'Unmanaged'
overwrite-files: true
- name: branch-solution, prepare it for a PullRequest
uses: microsoft/powerplatform-actions/branch-solution@v0
with:
solution-folder: ${{ github.event.inputs.solution_folder}}/${{ github.event.inputs.solution_name }}
solution-target-folder: ${{ github.event.inputs.solution_target_folder}}/${{ github.event.inputs.solution_name }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-empty-commit: true
The action is triggered manually — event: workflow_dispatch. Go to Actions, select the Workflow on the left sides' menu, click “Run Workflow”, no need to change the options, and then click on the green “Run Workflow” button.
and create a merge request to the master branch If this is the first time you are using this feature, you can rename the imported solution to “main”. If this is the first + x time, create a merge request to the main branch.
Create additional actions to export the solution as a managed solution to your test environment. Create additional actions to deploy the solution to your production environment after a release.
Link to my GitHub Repository — ALM for PVA
A curated link list
Download a copy of the bot in this article as a solution from GitHub.
Also published here.