Call a flow as an action
Learn how to use a cloud flow in Copilot Studio by giving a copilot the ability to produce a weather forecast on request. In the previous example, you created a flow that fetches a weather forecast. In this example, you'll use a Call an action node in a copilot topic to call the flow when a customer asks about the weather.
If you haven't already created the weather forecast flow, do that now.
Prerequisites
Call a flow from a topic
In Copilot Studio, go to the Topics page for the copilot you want to edit.
Create a new topic, and name it Get weather.
Add the following trigger phrases:
- will it rain
- today's forecast
- get weather
- what's the weather
A message node is created.
Enter I can help you with that in the message node, and then select Add node (+) under it to add a new node.
Add two Ask a question nodes for the City and Zipcode inputs the flow needs, as shown in the following example.
Note the names of the variables associated with each response,
Var1
for City andVar2
for Zipcode. You can leave them as-is or select the pencil icon and give them a more meaningful name such as "City" and "Zipcode."Select Add node (+) under the Zipcode question node.
In the node selection window, select Call an action, and then select the flow you created earlier, Get weather forecast.
Assign the flow inputs to the output variables from the question nodes. City (text) gets its value from
Var1
and Zipcode (number) gets its value fromVar2
. If you changed the names of the variables, enter the new names instead.Under the flow node, add a Message node, and then enter a message that uses the flow's outputs. For example:
Today's forecast for
(x)location
:{x}day_summary
. Chance of rain is{x}chance_of_rain
%Select Save.
Manage a flow used in a copilot topic
After you've called a flow from an action node in a copilot topic, you can use the node menu to manage the flow. The Copilot Studio authoring canvas gives you three options:
Delete: Select to permanently delete the node, and the flow, from the topic.
Refresh flow: If you've made changes to the flow in the Power Automate portal, select to reload and validate the flow in the topic. You'll need to fix any problems with the flow before you can save the topic.
Replace flow: Select to open the action picker, where you can select or create a different flow.
Test your flow and topic
It's a good idea to test the flow and the topic that calls it.
In the Test copilot pane, type one of the topic's trigger phrases to start a conversation with the copilot. Enter your city and zip code when the copilot asks for them. Make sure the copilot returns today's weather forecast and your message looks the way you expect.
Troubleshoot your copilot
Test your copilot when you make changes to topics and flows to make sure everything is working. If the copilot encounters a problem during a conversation, it responds with an error message.
Find most flow-related issues in the Flow Checker. Any issues on the authoring canvas appears in the topic checker.