AI Builder prompts: using GPT inside Power Automate
Create a reusable AI Builder prompt that classifies and summarises customer emails, then call it from a cloud flow and use the structured output.
What you'll learn
- Write a prompt with input variables
- Ask for JSON so flows can use the answer
- Call the prompt from a cloud flow
- Keep costs and accuracy under control
AI Builder prompts let you wrap a GPT instruction into a reusable component. Write it once, then call it from any flow or app — no API keys, no HTTP calls.
In this guide we build a prompt that reads a customer email and returns its category, sentiment and a one-line summary.
Write the prompt
Create a new prompt in AI Builder (you will also find it from the AI hub in Power Apps or Power Automate). Add an input variable called EmailBody, then write the instruction:
You classify customer emails for a support team.
Read the email below and return ONLY valid JSON in this exact shape:
{"category": "Billing | Technical | Account | Other",
"sentiment": "Positive | Neutral | Negative",
"summary": "one sentence, max 20 words"}
Email:
{EmailBody}Test the prompt with two or three real (anonymised) emails before you use it anywhere.
Call it from a flow
- Trigger: When a new email arrives in the shared support mailbox.
- Action: Run a prompt (AI Builder) — choose your prompt and map the email body to
EmailBody. - Action: Parse JSON on the prompt's text output, with this schema:
{
"type": "object",
"properties": {
"category": { "type": "string" },
"sentiment": { "type": "string" },
"summary": { "type": "string" }
}
}- Action: Add a new row to your Case table using
category,sentimentandsummary. - Condition: if
sentimentisNegative, post an alert to the team's Teams channel.
Make it reliable
- Validate the output. Wrap Parse JSON in a scope with error handling — models occasionally return extra text.
- Keep inputs small. Strip signatures and long reply chains before sending the email; shorter input is faster, cheaper and more accurate.
- Watch capacity. Prompts consume AI Builder credits. Check usage in the Power Platform admin center before rolling out to a busy mailbox.
Where else to use prompts
The same pattern works for extracting order numbers from text, drafting replies for review, or translating case notes — anything where you need text in and structured data out.