Skip to content
Kunal Kankariya
  • Home
  • About
Search

Home » How to trigger a Power Automate flow from a Power Virtual Agent bot

Power Virtual Agent with Power Automate

How to trigger a Power Automate flow from a Power Virtual Agent bot

2 Comments / Power Virtual Agent, Power Automate / July 13, 2020 August 13, 2020

This is the second part of the three-part series of my blog where I detail the steps to build a Power Virtual Agent bot and use a Power Automate flow to extend the abilities of the bot. We will also look at the details of publishing the bot to a website.

In the first part we built a Power Virtual Agent Bot with a simple topic. We will build on the same bot and create a more complex topic.

  • Part 1 : Build a simple Power Virtual Agent bot
  • Part 2 : Integrate Power Automate with the bot
  • Part 3 : Publish the bot to a custom website

Here’s the scenario: The user asks for categories of posts present in this site to the bot. The bot responds with the list of categories (Power Virtual Agent Entities). Once the user clicks on a category, all the posts that are present in that category will be displayed dynamically to the user. I have deployed this bot in this site (bottom right–hand corner) if you want to see what it would look like.  

Let us get started. 

First, let’s create a new entity that we will use to display all the categories of posts. Navigate to the entity section of your bot and click on New custom entity. Choose a name, we will call it KK Blog Categories.

In the List Items section, add all the categories present. For instance, Power Apps, SharePoint etc., and click on Save. You can also add Synonyms which the bot will use to match the corresponding list item.  

new entity

Navigate to the topics section of your bot in the Power Virtual Agents portal and click on New Topic. 

Choose the title as Show all categories in the blog. 

Choose some trigger phases like Show me all the categories. Enter all the trigger phases relevant to your topic and click on Go to the authoring canvas. 

create topic power virtual agent

The step following the Trigger Phases will be Ask a question step. Click on the plus sign and add the step. In the Ask a question message box, type your message to show the categories. To present the user with options, in the Identify step, select the entity created earlier. In our case, KK Blog Categories. Click on Select options for user and select all the options present. Note that the response is collected in a pre-defined variable rename this to varCategory.

ask a question action step

We will now add a Power Automate flow as the next step and pass the categories variable as an input to our flow. 

Click on the plus sign and add Call an action as the next step. Click on create a flow. This will launch the flow editor in a new window. As you notice, a trigger Power Virtual Agents and the last step to return values to Power Virtual Agents are already added to the flow. 

The trigger can also take input from our PVA bot. Click on Add an input -> Text. Rename the input parameter as Category. 

call power automate flow

 

Note: Creating the flow to get all the posts from the site based on the category is out of scope of this blog post (I may write a new post about this). However, I will summarize the steps included in the flow until the new post is out. 

To get all the posts from the WordPress site, I have configured a custom connector with two actions one to get the category id based on the category and the other to get all the posts based on the category id using the WordPress Rest API endpoints. One can also use the HTTP actions to get this done without a custom connector. 

Power automate flow

Once you have the return value as a string variable (posts in our case), go to the Return value(s) to Power Virtual Agents action, click on Add an Output and select Text. Enter the title as Posts and select the variable as the value. Click on Save.

Power Virtual agent return action

Go back to the bot authoring canvas and select the input variable, varCategory, for the newly created flow in the Action step.  

Add Show a message step and select the message as the output variable from the flow.  

You can now choose to end the conversation by adding a End the conversation step to the flow. 

power virtual agent end conversation

In this part, we have learnt about creating new and using entities, author topics using variables and call a Power Automate flow in our Power Virtual Agent bot. 

In the next part of this series, we will publish this bot to a website. 

close

Oh hi there! 👋
It’s nice to meet you.

Subscribe to receive awesome content in your inbox, every week.

I don’t spam! Read my privacy policy for more info.

Thank you! Check your inbox or spam folder to confirm your subscription.

Spread the love

Related Posts:

  • Power Virtual Agent - Build and publish bot to your website
    Power Virtual Agent - Build and publish bot to your website
  • How To Publish Power Virtual Agent Bot to a custom website
    How To Publish Power Virtual Agent Bot to a custom website
  • Power Apps Build Tools - Automate ALM
    Power Apps Build Tools - Automate ALM
  • Community plan - Power Apps
    Community plan - Power Apps
  • Connect to a Secure Web API Using Power Apps Custom Connector - Part 1
    Connect to a Secure Web API Using Power Apps Custom…
  • Connect To A Secure Web API Using Power Apps Custom Connector – Part 2
    Connect To A Secure Web API Using Power Apps Custom…

Post navigation

← Previous Post
Next Post →

2 thoughts on “How to trigger a Power Automate flow from a Power Virtual Agent bot”

  1. Taylor Han
    December 15, 2020 at 4:07 pm

    Can you share the flow template for us? It would be very helpful. thanks

    Reply
  2. erotik
    January 12, 2021 at 3:23 am

    Regards for this post, I am a big big fan of this site would like to go on updated. Loralie Aube Prue

    Reply

Leave a Comment Cancel Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Connect

Categories

  • .Net (2)
  • Authentication (2)
  • Azure Logic Apps (1)
  • Information Governance (1)
  • Information Protection (3)
  • Microsoft Teams (1)
  • msal (2)
  • Power Apps (6)
  • Power Automate (1)
  • Power Virtual Agent (3)
  • SharePoint (5)

Tag Cloud

AAD ALM Azure Azure App Azure DevOps Azure Logic Apps Bot browserautherror Build Tools canvas app CDS Computer Vision container controls Custom Connector Excel group Information governance Information protection Lists m365 microsoft 365 Microsoft Information Protection MIP msal msal-broswer MS Teams oAuth Office 365 Plans Power Apps PowerApps Power Automate Power Platform Power Virtual Agent Pricing PVA Secure security & compliance Sensitivity Labels SharePoint Spfx Web API webinar webparts
Copyright © 2023 Kunal Kankariya
  • Privacy Policy
  • Home
  • About