Use your prompt in Power Automate

A prompt can be added as an action in a Power Automate flow so it's possible to generate text from it inside an automated process.

Important

Use an existing prompt in a flow

Prerequisite: You've created a prompt named Task Identifier that has one input called Text, as described in Create a custom prompt.

  1. Sign in to Power Automate.

  2. Select +Create > Instant cloud flow.

  3. Name the flow Task ID.

  4. Select Manually trigger a flow > Create.

  5. In the designer, select manually trigger a flow.

  6. On the Parameters tab to the left, select +Add an input.

    Screenshot of adding 'Text' as an input.

  7. Select Text, and then enter a name.

    Screenshot of adding an input.

  8. In the designer, select +Insert a new step after Manually trigger a flow.

  9. On the left pane in the Search field, enter GPT and select the action Create text with GPT using a prompt.

    Screenshot of a prompt test.

  10. On the left pane in the Name field, choose your custom prompt from the dropdown menu.

    The following example uses Task Identifier as the custom prompt. Task Identifier is a custom prompt that has been previously built.

    Screenshot of the 'Task identifier' custom prompt.

  11. On the left pane in the Input Text field, select Input Text from the Dynamic content list to the right.

    Screenshot of selecting the 'Input' text from the Dynamic content list for the 'Input Text' field.

Create a new prompt in a flow

  1. Sign in to Power Automate.

  2. Select +Create > Instant cloud flow.

  3. In the designer, select +Insert a new step after Manually trigger a flow.

  4. On the left pane in the Search field, enter GPT and select the action Create text with GPT using a prompt.

  5. On the left pane in the Name field, select New custom prompt from the dropdown menu.

    Create a new prompt

  6. Follow the instruction from the Create a custom prompt documentation to create your prompt instructions.

  7. Save your prompt and follow the instructions to use your prompt in a flow.

Use the output of the GPT action

The Create text with GPT using a prompt action generates a flow variable called Text, which represents the output of your prompt generated by the GPT model. You can use this variable at your convenience in downstream actions.

For example, let's send a Teams message that encompasses the Text variable:

  1. In the designer, select +Insert a new step after the Create text with GPT using a prompt action.

  2. Search for the action Post message in a chat or channel and select it.

  3. Fill in the parameters, making sure you select the Text variable in the body of the Teams message.

    Use the prompt output

  4. Once you're satisfied with your flow, you can save it and select Test on the top right corner.

  5. Make sure to enter values for the input variables that would be used in your flow, and then select Run flow.

  6. Visualize the message received in Teams.

    Screenshot of outputs.

Incorporate human review

Having humans review the output generated by the GPT model allow an organization to ensure that this output is of high quality, aligns with ethical standards, and meets specific requirements. This combination of AI and human oversight optimizes processes and enhances overall outcomes. Learn why human review is important.

This section explains how to add a human review step after the prompt action in a flow.

  1. In the designer after the Create text with GPT using a prompt card, select +Insert a new step.

  2. On the left pane in the Search field, enter Approvals.

  3. To the right of the Approvals heading, select See more.

    Screenshot of the 'See more' button to get a list of all approval actions.

  4. Select Start and wait for an approval of text.

    Screenshot of the 'Start and wait for an approval of text' action.

  5. Fill in the following Approval parameters:

    1. In the Title field, enter a title.
    2. In the Suggested Text field, select Text from the dynamic content list.
    3. In the Assigned To field, enter an email address.

    Screenshot of adding an action, suggested text, and an email address.

  6. In the designer after the Start and wait for an approval of text card, select Add an action.

  7. On the left pane, search the control Condition and fill-in the following parameters:

    1. In Condition Expression, select Outcome from the dynamic content list.
    2. Next to Outcome, select is equal to from the dropdown list.
    3. Next to is equal to, enter Approve.

    Screenshot of selecting the condition expression parameters.

  8. In the designer under Condition in the True branch, select +Insert a new step.

  9. On the left pane, search Teams and select Post message in a chat or channel.

  10. On the Parameters tab, do the following:

    1. In the Post as field, select Flow bot.
    2. In the Post in field, select Chat with flow bot.
    3. In the Recipient field, enter an email address.
    4. In the Message field, select Accepted text from the dynamic content list.
  11. Select Save.

    Screenshot of adding parameters for 'Post message in a chat or channel'.

Once the flow runs and an approval is generated, the assigned reviewers can check the text generated by the GPT model from the Approvals menu in the Power Automate portal:

  1. From the left pane, select Approvals, and then select the Received tab.

  2. Open the approval to review and edit the text if needed.

  3. From the dropdown menu, choose your response.

  4. Select Confirm.

    Screenshot of configuring human oversight approvals.

See also

Human review for automation with a prompt