Use GPT in a Power Automate cloud flow

Completed

In this exercise, you learn how to create text from blank with text generation in a cloud flow.

Your task is to create an automated flow when a new email arrives that summarizes the email, and sends the response to Microsoft Teams by using the AI Builder action Create text with GPT.

  1. Go to Power Automate.

  2. On the left pane, select Create > Automated cloud flow.

  3. Name your flow, for instance, Summarize emails.

  4. Select When a new email arrives (V3) as a trigger.

  5. Select Create.

  6. Select Next step.

  7. Select Html to text (Preview).

  8. Select Body from the Dynamic content list.

    Screenshot of the flow HTML to text with focus on the Body and the Body option selected in the Dynamic content list.

  9. Add a Create text with GPT using a prompt action below Html to text.

    Screenshot of the Create text with GPT action highlighted.

  10. Expand the Prompt drop-down and select AI Summarize.

    Screenshot of the Create text with GPT action's prompt drop-down expanded with AI Summarize highlighted.

    Note

    Make sure that AI-generated content is accurate and appropriate before you use it.

  11. In the AI Builder action Create text with GPT using a prompt, add the The plain text content option from the Dynamic content list into the Input text box.

    Screenshot of Create text with GPT with the Dynamic content list open and focus on The plain text content option.

    Important

    To ensure safe practices, make sure that you exercise caution when sharing AI-generated content due to the possibility of errors and biases. Using human oversight before posting on platforms like Teams, internally and externally, is highly recommended.

  12. Add a new action below the Create text with GPT using a prompt action.

  13. Select Start and wait for an approval and then complete the following actions:

    1. In the Approval type field, enter Select Approve/Reject - First to respond.

    2. In the Title field, enter Review summarized email.

    3. In the Details box, select Text from the Dynamic content list.

    4. In the Assigned to field, enter the email alias of the approver.

    Screenshot of the Start and wait for an approval step filled in and the Dynamic content window showing.

  14. Add a Condition action below the Start and wait for an approval action.

  15. In the Condition box, add Outcome from the Dynamic content list from the approval step as the condition to check.

    Screenshot of the Condition step with focus on Outcome from the Dynamic content list.

  16. In the Condition box, set Approve as the positive response to validate.

    Screenshot of the Condition step with focus on Approve as the positive response.

  17. Under the true condition (which is Approve in this case), select Add an action then search for and select Post message in a chat or channel.

  18. Use the AI-generated Text from the Dynamic content list as the content to post on a desired Teams chat or channel.

    Screenshot of the If yes side of the condition filled in with focus on the Dynamic content Text field.

  19. Select Save in the upper right and then select Test to try out your flow.

Congratulations, you created a flow that uses AI Builder to create text with the AI Summarize capability.

Observe the approvals in action

To observe the approvals in action, after you receive an email:

  1. On the left pane, select Approvals.

  2. Select the Review summarized email request.

  3. On the right pane, you can review the details of the Email summary that was generated.

  4. Choose your response as Approve.

  5. Select Confirm.

    Screenshot of the Power Automate Approvals page, showing the Review summarized email request selected and the Respond: Approve pane filled in with details.

The post message should show as having been sent to Teams.

Screenshot of the message in Teams.

Note

If you send the Email to yourself using the same account that has the Approval flow running, you may fall into an endless loop of the flow summarizing each new Approval flow. Also make sure that after you have finished testing the flow, to either turn it off or disable it if you don't plan on using it further.

Important

Make sure that AI-generated content is accurate and appropriate before you use it.