Example configuration Microsoft Power Automate to categorize email subject based on Microsoft Azure Machine Learning Studio
Prerequisites
-
A Microsoft Azure Machine Learning Studio project, with web service
-
Azure Graph API, with the following permission:
-
Type = Application
-
Permissions = Mail.ReadWrite
-
Introduction
In this guide you will create a Microsoft Power Automate solution, in which you create a Flow that will set a category on an email based on the subject. This category can be used my the Anywhere365 Text handler to route the dialogue Learn More
Step 1: Create Outlook rule
The Anywhere365 automatically processes a new email as soon as it enters the Inbox. Because of this reason you first need to create an Outlook rule to move the email in a pre-process folder. Below on how to move all email to a folder. Of course you can create your own rules:
- Open Outlook (web) client.
- Open "Rules, Create New".
- Click "Advanced Options...".
- Click "Next".
- Check "Move it to specified folder".
- Select the folder where you want to move it to, for example "Pre-Process".
- Click "Finish".
Step 2: Create a Microsoft Flow
-
From your Office Portal, go to your Power Automate App.
-
Click "My Flow".
-
Click "New" and "Create from Blank".
-
Select connector "Office 365 Outlook, When a new email arrives".
-
Select the folder you used for the pre-process.
-
-
Add the step "Content Conversion, Html to text".
-
Use "Body" as Content.
-
-
Add the step "HTTP":
-
Set "POST" as method.
-
Add the Request URI of your model. (Found in WebService, REQUEST/RESPONSE API Help page).
-
Add the following Header:
- Key = Authorization
- Value = Bearer [API Key]
-
Add the following body:
Note: Body can differ based on your modelCopyJSON{
"Inputs":{
"input1":{
"ColumnNames":[
"Description"
],
"Values":[
[
"@{body('Html_to_text')}"
]
]
}
},
"GlobalParameters":{
}
}
-
-
Create a new step "Data Operations, Parse JSON".
-
Content:
-
Schema = Use sample payload to generate schema
-
-
Add the step "Initialize variable":
-
Set "TopScoring" as name.
-
Set "Sting" as Type.
-
Set the following Value:
-
-
Add the step "Initialize variable".
-
Set "Intent" as name.
-
Set "Sting" as Type.
-
Set the following Value:
-
-
Add the step "HTTP".
-
Set "Patch" as method.
-
Add the following uri:
-
Add the following body:
-
Tenant = Directory (tenant) ID, found in the App Overview
-
Audience = https://graph.microsoft.com
-
Client ID = Application (client) ID, found in the App Overview
-
Credential Type = "Secret"
-
Secret = Secret, can be created in Azure under "Certificates & Secrets"
-
-
Create a new step "Office 365 Outlook, Move Email":
-
Set "Message id" as Message Id.
-
Set "Inbox" as Folder.
-
Step 3: Make it smarter
When using Azure Machine Learning Studio your model is normally already based on a rich amount of data. This information can be expanded with more live data. Below an example on how to create more data.
-
Make sure the intent out of Azure Machine Learning Studio matches the Skill Name.
-
Add 2 Classifications:
-
Intent Correct
-
Intent Incorrect
-
-
Create a sub option on the incorrect intent options with all the possible intents.
During the conversation the Agent classify if the intent is correct or else provide the correct intent.
-
This information can be exported and imported to further train your model.