Dialogue Cloud

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:

  1. Open Outlook (web) client.
  2. Open "Rules, Create New".

  1. Click "Advanced Options...".
  2. Click "Next".
  3. Check "Move it to specified folder".
  4. Select the folder where you want to move it to, for example "Pre-Process".
  5. Click "Finish".

Step 2: Create a Microsoft Power Automate Flow

  1. From your Office Portal, go to your Power Automate App.

  2. Click "My Flow".

  3. Click "New" and "Create from Blank".

  4. Select connector "Office 365 Outlook, When a new email arrives".

  5. Select the folder you used for the pre-process.

  6. Add the step "Content Conversion, Html to text".

  7. Use "Body" as Content.

  8. Add the step "LUIS, Get prediction":

    1. Enter the (LUIS) App id.

      Note: If you already added LUIS before, you can select the application.
    2. Use "The plain text context" as Utterance Text.

  9. Add the step "Initialize variable":

    1. Set "Intent" as name.

    2. Set "Sting" as Type.

    3. Set "Top Scoring Intent Name " as Value.

  10. Add the step "HTTP":

    1. Set "Patch" as method.

    2. Add the following uri:

      Copy
      Expression
      https://graph.microsoft.com/v1.0/users/[user id]/messages/[Message id]
    3. Add the following body:

      Copy
      Expression
      {
         "Categories":[
            "@{variables('Intent')}"
         ],
         "IsRead":true
      }
    4. Change Authentication to "Active Directory OAuth".

    5. Tenant = Directory (tenant) ID, found in the App Overview

    6. Audience = https://graph.microsoft.com

    7. Client ID = Application (client) ID, found in the App Overview

    8. Credential Type = "Secret"

    9. Secret = Secret, can be created in Azure under "Certificates & Secrets"

  11. Create a new step "Office 365 Outlook, Move Email":

    1. Set "Message id" as Message Id.

    2. 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.

  1. Login on https://www.luis.ai/

  2. Open your app

  3. Open Build

  4. Open Improve app performance > Review endpoint utterances

In here you can add previous utterances if the match the right intent.