Leveraging AI for email management not only saves time but also reduces the risk of human error. By automating the evaluation process, businesses can ensure that important emails, such as orders, are promptly and accurately identified, allowing for quicker response times and improved customer satisfaction. Embracing AI in email workflows is a smart move towards greater productivity and operational excellence.
In this article, I explain how to create an AI prompt model using Microsoft GPT to streamline email processing. By integrating Power Automate, the flow sends the content of each new email to the AI model, which then determines if the email is an order. If identified as an order, the AI responds with a JSON output indicating a positive result. This approach enhances the efficiency and accuracy of order processing through intelligent automation.
Create an AI model
For this blog I create a simple AI prompt to evaluate if a incoming email is a request for an order. The actual prompt is more complicated but confidential.
- Open the AI hub aka AI Builder and select the Create text with GPT using a prompt.
- Give the prompt a name.
- Create three input parameters.
- EmailSubject
- Attachments
- Select by Output JSON (preview) and click on Edit.
- Add the following JSON code.
{
"Order": "true"
}
- Set the Model to either GPT 3.5 (cheaper but less accurate) or GPT 4 (more expensive and more accurate).
- Set the Temperature to 0.
- Set the Prompt as follows or make your own prompt.
- Save the prompt.
Create a Power Automate Flow
The Power Automate flow will start for every incoming email and will send to the AI model, the email body, subject and names of the attachments. The model will return its determination in JSON form.
- Create a new Power Automate flow with an outlook/email trigger, When a new email arrives in a shared mailbox.
- Add an Initialize variable action to create a variable called All attachment names.
- Add an Append to string variable and select by the name the All attachment names variable.
- Set for the value the attachments of the email, with the following code. This will automatically add a Apply to each action.
items('Apply_to_each_-_Attachment')?['name'] -
- Add the Create text with GPT using a prompt action.
- Select your created AI Prompt.
- Set by attachments the variable All attachment names.
- Set by Email the Body of the email.
- Set by EmailSubject the Subject of the email.
- This will start the AI model and it will return its results to the flow.
- Form here on you can add in the requered steps for your specific process and test the process.