AIIntermediate

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.

Prerequisites

  • Power Automate with Dataverse
  • AI Builder capacity or credits in the environment

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
On this page
  1. Write the prompt
  2. Call it from a flow
  3. Make it reliable
  4. Where else to use prompts

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:

TEXT
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

  1. Trigger: When a new email arrives in the shared support mailbox.
  2. Action: Run a prompt (AI Builder) — choose your prompt and map the email body to EmailBody.
  3. Action: Parse JSON on the prompt's text output, with this schema:
JSON
{
  "type": "object",
  "properties": {
    "category": { "type": "string" },
    "sentiment": { "type": "string" },
    "summary": { "type": "string" }
  }
}
  1. Action: Add a new row to your Case table using category, sentiment and summary.
  2. Condition: if sentiment is Negative, 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.

J / K next or previous article

Jagadeesan P

Found this useful? I share new guides on LinkedIn.

Follow