Deli z drugimi prek


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

  1. In Copilot Studio, go to the Topics page for the copilot you want to edit.

  2. Create a new topic, and name it Get weather.

  3. Add the following trigger phrases:

    • will it rain
    • today's forecast
    • get weather
    • what's the weather

    Screenshot of trigger phrases in a new topic.

    A message node is created.

  4. Enter I can help you with that in the message node, and then select Add node (+) under it to add a new node.

  5. Add two Ask a question nodes for the City and Zipcode inputs the flow needs, as shown in the following example.

    Screenshot of City and Zipcode question nodes in a topic.

    Note the names of the variables associated with each response, Var1 for City and Var2 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."

  6. Select Add node (+) under the Zipcode question node.

  7. In the node selection window, select Call an action, and then select the flow you created earlier, Get weather forecast.

    Screenshot of a Call an action node with the Get weather forecast flow highlighted.

  8. 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 from Var2. If you changed the names of the variables, enter the new names instead.

  9. 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%

    Screenshot of the flow inputs and outputs and the outputs used in a message node.

  10. 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.

Screenshot of flow options in the Copilot Studio authoring canvas.

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.

Screenshot of testing a copilot.

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.