Content Classification on Office 365 SharePoint using MS Flow and LUIS

In this post, let us look how the Office 365 SharePoint list content can be classified using Microsoft Flow with the help of LUIS text prediction techniques. Text added to Office 365 SharePoint list are classified and saved back to SharePoint using Microsoft Flow and LUIS.

Consider a scenario of having queries list, and admin wants the queries to be auto classified before routing the queries for solution. Microsoft Flow provides a LUIS connector, which helps in predicting and classifying the text being saved to SharePoint.

Note: In a layman scenario on LUIS portal, categories will be intents and queries will be utterances.

Connecting SharePoint and LUIS using Flow

The solution consists of three steps.

  • Query is created on SharePoint: Flow is triggered, whenever a new item is created in the SharePoint list.

  • Query category is predicted using LUIS: Flow uses LUIS Get Prediction action for classifying the item created. The action predicts the data using the trained app created on the LUIS portal. The output of this step will be matching intents (predicted scores) with the relevant scores.

  • Query is updated with the category predicted: After classification, the top scoring intent from the above step is saved to the respective SharePoint list item’s category field.

Note: Initially app needs to be created on the LUIS portal, which will have necessary intents (categories) with few sample utterances (queries). Admins can train the LUIS app with necessary intents and utterances whenever required. Let us look at the solution, with screenshots.

LUIS App for Content Classification:

Create the app on LUIS portal with necessary data trained. For example, in this case let us create a category (an intent) called “socialmedia”. And we will add some sample queries (utterances) to the category created.

  1. Create new app with some meaningful name “contentClassification”

  2. Create new intent with the name “socialmedia”

  3. Add some utterances to the intent for training.

The following snapshot shows the intent created on the LUIS portal with some utterances.

Go to publish tab, and copy the key string for later use.

Microsoft Flow connecting Office 365 SharePoint list and LUIS App:

Go to the Microsoft Flow portal and create a new flow with blank template. The following steps to be configured on Microsoft Flow portal.

  1. Select SharePoint connector and pick a trigger (In this case “when an item is created”).

  2. Pick the site and list details (If SharePoint connection is not already added, the flow will ask for Office 365 SharePoint credentials. Provide the credentials).

  3. Add new action.

- Search for LUIS connector.

- Select “LUIS - Get Prediction” action.

- Fill in the connection name and API key (Key should be copied fro