Use GPT in a Power Automate cloud flow
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.
Go to Power Automate.
On the left pane, select Create > Automated cloud flow.
Name your flow, for instance, Summarize emails.
Select When a new email arrives (V3) as a trigger.
Select Create.
Select Next step.
Select Html to text (Preview).
Select Body from the Dynamic content list.
Add a Create text with GPT using a prompt action below Html to text.
Expand the Prompt drop-down and select AI Summarize.
Note
Make sure that AI-generated content is accurate and appropriate before you use it.
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.
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.
Add a new action below the Create text with GPT using a prompt action.
Select Start and wait for an approval and then complete the following actions:
In the Approval type field, enter Select Approve/Reject - First to respond.
In the Title field, enter Review summarized email.
In the Details box, select Text from the Dynamic content list.
In the Assigned to field, enter the email alias of the approver.
Add a Condition action below the Start and wait for an approval action.
In the Condition box, add Outcome from the Dynamic content list from the approval step as the condition to check.
In the Condition box, set Approve as the positive response to validate.
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.
Use the AI-generated Text from the Dynamic content list as the content to post on a desired Teams chat or channel.
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:
On the left pane, select Approvals.
Select the Review summarized email request.
On the right pane, you can review the details of the Email summary that was generated.
Choose your response as Approve.
Select Confirm.
The post message should show as having been sent to 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.