This post demonstrates how easy it is to build a Bot using Power Virtual Agents. The Bot will call a Power Automate Flow to return data from CDS and display it to the user. Power Virtual Agents is part of Microsoft’s push to democratize AI and it allows Bots to be created using a Flow like designer without any code.
Step 1: Create Topics with Power Virtual Agents
Power Virtual Agents is incredibly easy to use and you create Topics for you Bot to interact with users. A Topic is a conversation path that is triggered when the user entering a phrase. In my case I created a Topic called Order that gets triggered when users enter phrases such as “where is my order”. The Topic editor can be used to design the conversation flow and in my conservation I prompt the user to enter their Order No and save it in a variable called OrderNo. I can then pass the OrderNo variable to a Flow to return the order details from CDS and display it to the user.
Step 2: Call a Flow from your Topic
To call a Flow from your Topic you first need to add your Flow to the Common Data Service Default Solution in the CDS environment that Virtual Agent is configured to use. Select + Action option to call a Flow from your Topic.
Step 3: GetOrderDetails Flow – returns order details to Virtual Agent
Only Flows that have a response object are displayed can be called from the Topic designer. My GetOrderDetails Flow has a request schema that accepts a single parameter called OrderNo and a response schema that returns a Json object contains the OrderDetails and DeliveryDate. The Flow use the CDS connector to search the orders entity for an order with the orderNo and populates the response object with the retrieved details.
Step 4: Take the output from the flow and display it to the user
Once the flows complete I can take the output from the flow and display it to the user. I did try and use a collection of objects so I could show all orders for a user but I could not get this to work.
Once your Topic is complete you can test it directly from the designer window making sure your select the “Start Over with Latest Content” option first. You can also select the Deploy option to generate the HTML code to embed the bot in your own web site. When I trigger my Bot I can now enter a valid Order No returning the order details.
Power Virtual Agents has simplified the creation of Bots without the need for any technical skills. Using Power Virtual Agents in combination with Power Automate allows you to build Bots that interact act with back-end platforms without any code. Virtual Agent is currently in preview so there is not pricing information available yet. You can sign up for the preview here.