Example configuration Microsoft Power Automate to categorize email subject based on LUIS
Prerequisites
-
A LUIS App, filled with Intents and examples
-
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 Power Automate 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 "LUIS, Get prediction":
-
Enter the (LUIS) App id.
Note: If you already added LUIS before, you can select the application. -
Use "The plain text context" as Utterance Text.
-
-
Add the step "Initialize variable":
-
Set "Intent" as name.
-
Set "Sting" as Type.
-
Set "Top Scoring Intent Name " as Value.
-
-
Add the step "HTTP":
-
Set "Patch" as method.
-
Add the following uri:
Note: User id can be found in Microsoft Entra ID Formerly known as Azure Active Directory (or Azure AD, or AAD). -
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
While using LUIS, you can use the previous send requests to make your predictions even better. This can be done in the interface of LUIS.
-
Login on https://www.luis.ai/
-
Open your app
-
Open Build
-
Open Improve app performance > Review endpoint utterances
In here you can add previous utterances if the match the right intent.