How To Add Action To A Bot Using Microsoft Power Automate

Introduction

 
In this article, you will see how to create a bot using Power Virtual Agents and how to call an action using Power Automate. I have created a SharePoint list named “Request Lists” which contains the following information.
 
How To Add Action To A Bot Using Microsoft Power Automate
 
How To Add Action To A Bot Using Microsoft Power Automate 
 
User can check the request status by entering the request ID using the bot. Bot calls the Power Automate in the background to retrieve the information from SharePoint list using SharePoint connector.
 
How To Add Action To A Bot Using Microsoft Power Automate
 

Power Virtual Agents

 
Power Virtual Agents allow us  to easily create powerful bots using guided, no-code graphical interface without the need for data scientists or developers (coding or AI expertise). You can do the following using Power Virtual Agents,
  • Empower your teams
  • Reduce costs
  • Improve customer satisfaction
To learn more about Power Virtual Agents and to get started refer to this link.
 
Flow Design
 
How To Add Action To A Bot Using Microsoft Power Automate
 
Topic Design
 
How To Add Action To A Bot Using Microsoft Power Automate
 
How To Add Action To A Bot Using Microsoft Power Automate
 

Create a bot

  1. Navigate to here.
  2. Create a new bot as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Enter the name for the bot and click Create.

    How To Add Action To A Bot Using Microsoft Power Automate

    How To Add Action To A Bot Using Microsoft Power Automate

Create a new topic

 
A topic defines how a bot conversation plays out. It consists of trigger phrases and conversation nodes.
 
Trigger phrases - phrases, keywords, or questions that a user is likely to type that is related to a specific issue.
 
Conversation nodes - to define how a bot should respond and what it should do.
  1. In the newly created bot (refer above section), click Topics in the left navigation.
  2. Click New topic.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Enter the name, description and trigger phrases as shown below. Click Go to authoring canvas.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Delete the message as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Click + Icon and then click Ask a question.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Enter the question, select User’s entire response for Identity and rename the variable as var_requestID.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Click + icon and then click Call an action. Click Create a flow.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. In the Power Automate portal, update the JSON schema in “When a HTTP Request is received” as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Delete Initialize variable – String and Initialize variable – Number
  2. Add Get Items SharePoint action and configure the Site Address & List Name.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Add Filter array action and configure the values by adding dynamic vales from previous actions as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Add three Initialize variable actions and configure it.
  2. Initialize variable – Request Title action: value - json(string(first(body('Filter_array'))))?['Title']

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Initialize variable – Comments action: value - json(string(first(body('Filter_array'))))?['Comments']

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Initialize variable – Status action: value - json(string(first(body('Filter_array'))))?['Status']?['Value']

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Update the Body and Response Body JSON in Respond to Power Virtual Agents action as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Update the flow name as Request Status and save the flow.

Create a new solution in Power Automate

  1. In the Power Automate portal, click Solutions. Click New solution.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Enter the details for the new solution and then click Create.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Go to newly created solution, click Add existing. Click Flow.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Click Outside solutions, select the newly created flow Request Status and then click Add.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Flow added to solution successfully.
  2. Navigate to Power Virtual Agents, go to Get Request Status topic which was created in the previous section. Click + icon and click Call an action. Newly created flow will be available click that flow.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Select the variable from the drop down as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Click + icon and click Show a message. Add the text and output variable values as shown below.

    How To Add Action To A Bot Using Microsoft Power Automate

    How To Add Action To A Bot Using Microsoft Power Automate
  1. Save the topic.

Test the bot

  1. In the left navigation, click Test your bot. Enter request status and wait for the bot response.

    How To Add Action To A Bot Using Microsoft Power Automate

Summary

 
Thus, in this article, you saw how to add action to a bot (created using Power Virtual Agents) using Power Automate.


Similar Articles