Featured image of post Connecting LUIS & D365 (part 1)

Connecting LUIS & D365 (part 1)

As Microsoft wants us to consider using AI in all aspects of our developments, I wanted to see if I could use one of the cognitive services available to life in a real life scenaro.

This post & it’s other parts will

  • Give you an understanding of a real-life scenario where we could implement LUIS
  • Introduce you to the concepts of LUIS
  • Discuss the Microsoft Flow to connect LUIS to D365
  • Give you some next steps on how you can try to bring LUIS into your organisation

The Scenario - Big Energy Co

Imagine a busy helpdesk or contact centre at one of the big electricity or gas companies. They are inundated with calls, emails & chats from their customer base to request numerous changes or additions to their account, provide meter readings, complain or numerous other concerns.

Email is one of the biggest mediums for support when the matter is not urgent. The standard email to case conversion is commonaly used to bring these support requests into D365 CE.

But that is traditionally where it stops. A 1st line support user would have to read the content of the case, decide on the appropriate subject for the new case & select save and route. This takes time, upto a couple of minutes, of invaluable time of an educated, talented member of your team.

LUIS - Language Understanding

LUIS is Microsoft’s cloud-based API which tries to understand the meaning behind phrases. LUIS could take a paragraph of text and categorise it to suggest what the writer of the paragraph is trying to say. Bringing machine learning into your app can drastically reduce the time spent scouring tet for meaning .

In a 1st line support scenario, an email comes into a support mailbox and D365 will create a case with it’s auto-creation rules to allow a 1st line support person to read the email, decide what the email is concerning, then route the case to the relevant team.

Using Flow and LUIS, we can automate this step, reducing the time taken to get the case to the right people, improving SLAs and reducing costs.

LUIS Configuration

For all of this, I am using a trial environment, Microsoft makes it easy for you to play with all it’s tools, and LUIS is no exception. The free licenses gives you 5 text requests per seconds, definetly adequate for development and trial purposes. It is then £1.11 per 1000 transactions above this, with a max of 50 transactions a second.

By going to luis.ai & logging in, you will be allowed to create an app. This is the starting point. As you can see my app has been created already.


Intents are the term for meaning within the app. Each app will have several intents, what are the likely short description or categories of why an email would come into the environment?


Each intent has several utterances, which are phrases from which LUIS will learn and define the intent of the text passed to it. It is very simple to add utterances and you should aim to get 15 or so for each intent as a starting point.

You can add as many utterances as you like, try to keep your utterance count consist between intents as a higher utterance list on one of the intents will lead to it be chosen more, in effective giving you false results. When you get into a near production scenario, you need to keep adding them from feedback from your users. You could enact a process which, when LUIS fails to assocaite an intent to a case or gives a false classification, this is highlighted for a BA to analyse & apply to the model.

The next thing to do is train LUIS. This brings any changes you have made into the AI so they also can be used to understand the conversation.

Training is complete when you get a green bar across the top.

Now we have a model, let’s test it, using the inbuilt Test functionality available from the top right.

If you type a string in the box provided & hit return, you are calling LUIS and the text will be analysed and LUIS will reply with the highest intent & how likely the phrase enters matches it.

I have entered the phrase “can you help me transfer my account”, which wasn’t part of the utterances I created earlier, but closely matches one of the Account closure utterances.

Looking at the response, LUIS is stating that he thinks this phrase is about Account Closure and he is 58% sure that this is correct. If you click on the Inspect link you can use this to train LUIS if the response is not correct by using the Edit link, adding an utterance to one of the other intents or reenforcing the entered text was in the correct intent.

Publishing LUIS

My LUIS app is ready, it is trained and raring to go. Now we need to allow access from the publicly available API. The Publish button steps you through the process, ensure you go to Production. Don’t worry about costs for now, you get 5 requests a second for free, which is great for trialling & developing

In Application Information, there 2 key bits for connecting LUIS to Flow. Firstly, the Application ID is the key we want later. Secondly, we need to ensure anyone with the Application ID can access our endpoint & use the app we have configured, so ensure the Make this app public is checked.

This is a little less secure than you would want in production and there are details about LUIS security available to ensure only the proper users can access fully documented here.

That’s it, ready to go. In the next part, I will configure D365 and Flow to complete the scenario

comments powered by Disqus
My views, nothing to do with anyone else
Built with Hugo
Theme Stack designed by Jimmy