Introduction
One of the most transformative advancements in the Power Platform has been the introduction of
AI prompts. These intelligent prompts have redefined how users interact with data, automate processes, and design applications. While prompts can be used across Power Apps, Power Automate, and Copilot Studio, this blog specifically focuses on how they can be effectively leveraged within Power Automate to parse information from a given email or a text provided by a user.
What is an AI Prompt?
A prompt is an input or instruction to guide an AI system's response or output. Prompts are the foundation for how the AI interprets and processes your request, helping it to generate relevant and accurate results.
A well-designed prompt specifies what information you want the AI, such as a large language model (LLM), to extract or generate from a given text. You can also define the desired format for the output, such as JSON, XML, or any other structured format.
One of the core functionalities of Power Automate is extracting essential information from unstructured text. Below are some high-level examples:
- Automatically extracting customer details, invoice amounts, and due dates from scanned invoices or email bodies.
- Extracting names, phone numbers, or email addresses from email signatures.
- Pull specific answers or data points from forms or surveys for further processing.
- Extract keywords from customer support tickets to classify and route them to the appropriate team.
- Pulling specific details like order numbers or issue descriptions from customer queries to automate data entry
Traditional ways of parsing info
Traditional methods of extracting information using Power Automate involve leveraging built-in actions, expressions, and connectors. Here are some common techniques:
Using Text Functions such as split(), substring() or regex operators when the input text is well structured. These traditional ways of parsing information comes with several limitations:
- Traditional methods require input text to adhere strictly to a predefined format or structure. Any deviation—such as a change in field order or additional text—can cause parsing errors.
- When templates or formats are updated, the parsing logic often needs to be rewritten or adjusted, leading to ongoing maintenance challenges.
- Traditional parsing is limited to exact matches or rigid rules, which makes it ineffective for handling nuanced language or understanding intent.
- Typos, synonyms, or ambiguous language can easily break parsing logic, resulting in missed or incorrect data extraction.
- Accommodating edge cases and variations in text significantly increases the complexity of the logic, making it difficult to maintain and prone to errors.
Benefits of using AI Prompts
- AI prompts can process unstructured or semi-structured data without requiring a predefined format.
- AI prompts are also great in understanding context and semantics, which traditional parsing methods lack. e.g. Identifying the urgency of a support ticket from phrases like "Need immediate assistance" or "ASAP."
- AI-powered prompts adapt to changes in input patterns with minimal manual intervention. e.g. If an invoice template changes slightly, AI can still extract line items without requiring reconfiguration.
Building AI Prompts in Power Platform
Prompts are created and tested in AI Hub before they are used within Power Automate.
The AI Hub can be accessed from the Power Automate or Power Apps homepage.
To build a new prompt, click on Prompts -> Build your own prompt
Application of AI Prompt in extracting unstructured information from an email
In this blog, we will explore the process of retrieving key invoice information directly from the body of an email. Additionally, you can extend this capability to extract information from attachments included with the email.
Sample email
Dear Sudeep,
I hope this message finds you well. As per our recent agreement, I am writing to provide you with the invoice details for your reference. The contract number is 987654, and the invoice date is 15th October 2023. This invoice pertains to the services provided to ABC Corporation, with an invoice amount of $5,000. Please ensure that the payment is processed by the due date, which is 30th October 2023, to avoid any late fees.
If you have any questions or require further information, please do not hesitate to contact us. Thank you for your continued partnership.
Thanks
Create a custom prompt
1. Create a new input variable (e.g. InputText) for storing the natural language input.
2. You could also provide it with a Sample data to test your prompt.
3. Write your prompt as shown below. It should be descriptive and must specify the format of the desired output.
Extract Contract Number, Invoice Date, Customer Name, Invoice Amount, Due Date from InputText. Keep the output strictly JSON for example
{
"ContractNumber": "987654",
"InvoiceDate": "15th October 2023",
"CustomerName": "ABC Corporation",
"InvoiceAmount": "$5,000",
"DueDate": "30th October 2023"
}
4. Test your prompt with Sample data.
5. Finally remember to save your prompt by giving it a meaningful name (e.g. Extract information from Email)

Build your flow
Now that you have your prompt ready, build your flow. Our use case requires us to extract the information from an email, so:
1. Use the "When a new email arrives (V3)" trigger to detect incoming emails. Configure necessary filters to ensure it captures only specific emails relevant to your needs rather than the entire inbox.
2. To strip the HTML formatting from the email body, use the "HTML to Text" action.
3. Use the AI Builder action "Create text with GPT using a prompt." Provide the prompt you created earlier.
4. Add a "Compose" action to display the results returned from the AI Builder. For added simplicity, particularly when handling JSON data, you might include a "Parse JSON" action before the "Compose" action
5. Once the desired data is extracted and verified, use integration actions to either send this information to an API or populate metadata fields within a data source.
Note: The GPT actions using AI to create and interpret information, so you might receive a warning that your flow requires a content approval action. You may ignore it in this case.
Testing your flow
We will test the flow using a format different from the one we used to build our prompt.
Here is the flow output:
Conclusion
Prompts in the Power Platform provide an effective and streamlined method for extracting information from unstructured text, including emails, by utilizing AI models like GPT. This approach significantly reduces the labor-intensive task of manually parsing information through conventional techniques. By understanding context, these AI-powered prompts can extract relevant data even when synonyms or abbreviations are used, ensuring comprehensive and accurate data retrieval.