Add actions to a bot using Power Automate in Teams
Select the version of Power Virtual Agents you're using here:
You can enable your bot to perform an action by calling a Microsoft Power Automate flow. Flows can help you automate activities, or call backend systems. For example, you can use flows to send messages to a Teams channel, or access files in a SharePoint folder.
Flows typically use variables to input and output information. The variables can then be used in other nodes within the topic.
For example, you could record someone's answer to a question in one place in the bot, then have a flow that "outputs" a special message based on the "input".
Create a new flow from the Power Virtual Agents authoring canvas
Go to the Topics page for the bot you want to edit.
Open the authoring canvas for the topic from which you want to call a flow.
Select the plus (+) button below an existing node to add a new node.
In the node selection window, select Call an action, and then select Create a flow.
Using the Create a flow option opens a template selection screen.
Save your topic before creating a new flow, as you will be taken to Power Automate for this operation.
You will find a list of templates which helps you quickly get started creating Power Automate flows. For this example, we will pick the basic "Power Virtual Agents Flow Template".
After that, you'll see a blank flow template.
Input and output parameters
See the Power Virtual Agents web app documentation on flows for details on inputs and outputs and restrictions.
To specify a flow to accept input parameters from a bot, select the Add an input option in the Power Virtual Agents trigger user interface, and then select the type: a
For example, you can select Text and Number to add the following input parameters to the flow:
- String_Input of type
- Number_Input of type
To return output parameters to the bot that can be a
number, or a
boolean, select Add an output option in Power Virtual Agents response user interface, and then select the type for the output.
For example, you can select Text and Number to add the following output parameters to the flow and assign return values for them.
- String_Output of type
- Number_Output of type
This example creates a fully functional flow that accepts two parameters, a
string and a
number, and returns them to a bot as outputs.
Select Save to save your new flow.
Now when you go to call an action and choose Flow, you'll see the flow you created. You can select View flow details to edit the flow, save it, and make other changes.
Create simple flow
In this flow, we're going to provide a special message and email when someone asks about conference rooms.
Create a new topic with the trigger phrase "Is there a conference room available?".
Add a Question node that asks "How many people are in the meeting?". By default, it will be set to accept ("identify") multiple choice options - change that to Number. At the bottom, click on the variable called "Var" and change it to "Numberguests".
Add a Question node that asks "Do you have any requirements". By default, it will be set to accept ("identify") multiple choice options - change that to User's entire response. At the bottom, click on the variable called "Var" and change it to "Requirements".
- Insert a Call to action and choose the flow you created. Set the
String_Inputto Requirements and the
- Now insert a message node with those variables. You can now add another flow that emails the information.
- Add a Call an action node, and select a new flow.
- Pick the first flow template (Power Virtual Agents Flow Template).
- In the flow template, enter a string input called Input_Requirements and a number input called Number_Attendees.
- Add an Outlook connector after the input to send an Outlook message, and enter the variables in the body. Save the flow and return to the Power Virtual Agents authoring canvas.
- Add the flow you just created, and select the two variables as the inputs for the flow.
Now when the bot user tells the bot how many people, and any requirements, an email will be sent with that information.
See the Power Virtual Agents app documentation on using Flows for more detailed and complex scenarios using flows.