TL;DR
Developing with LUIS is easy but slightly tedious. This post shares some tips for developing with LUIS and provides links to get started.
In part 1 I talked about my experience getting started with the Microsoft Bot Framework and getting responses from simple keywords. Which is great; but I want users to be able to have a conversation with my Bot, ALIE (another The 100 reference). In order to get my bot to understand natural language I used Microsoft’s LUIS, part of their cognitive services suite, and integrated it into my bot.
LUIS
LUIS (Language Understanding Intelligent Service) is a service in Microsoft’s extensive cognitve services suite. It provides extensive models from bing and cortana for developers to use in their application. LUIS also allows developers to create their own models and creates http endpoints that can be pinged to return simple JSON responses. Bellow is a Tutorial about how to use LUIS.
LUIS – Tutorial
Things to note
Video differences

LUIS has been updated since the release of this video so some differences:
The Model Features area on the right has been changed to reflect more of the features you can add:
Working with Intents
https://www.luis.ai/Help is a great resource. LUIS has very detailed documentation.
LUIS supports only one action per intent. Each action can include a group of parameters derived from entities. The parameter can be optional or required, LUIS assumes that an action is triggered only when all the required parameters are filled. These will be the main driving force of your bot responses, and actions come into play when publishing.
Publishing Model for Bot Framework and SLACK
Here is the link to how to publish your model: https://www.luis.ai/Help#PublishingModel.
What they neglect to mention is that when publishing for the Bot Framework or SLACK you need to be in preview mode to access those features since they are still in Beta. To get to the preview of LUIS click the button on the top right of the page, it takes about a minute to regenerate the page.

Publishing – Action needed
Now, this might next part might change soon since the beta keeps being improved upon. When I first wanted to publish the model with Bot Framework the service required me to make at least one of my Intents return an action.
Adding Action
In preview select an Intent. A window will popup. Select Add Action.

Next check the Fulfilment Box.

The fulfillment type determines what type of response will be included in the JSON object. I’ve selected Writeline since all of the actions that I have on ALIEbot so far do not use the integrated services, like weather or time.

After you select a fulfillment type you can add parameters and an action setting (which is what will be returned in the JSON object).

In my application I returned the parameter XName which is the name of the character that was in the users response.
Integrating LUIS Code
Setting up LUIS class
Before you can receive responses from LUIS you need to import the appropriate LUIS libraries, and create a class that extends the Luis Dialog. This class must also include the serializable and Luis Model tags.


The LUIS model ID and Key can be found when you are publishing your Application:
LUIS Intent Methods
Your class must now have methods that act upon the specific LUIS intents.

//This needs to match the Intent Name from JSON [LuisIntent("XName")] public async Task XNameResponse(IDialogContext context, LuisResult result) { var entitiesArray = result.Entities; var reply = context.MakeMessage(); foreach (var entityItem in result.Entities) { if (entityItem.Type == "Character") { switch (entityItem.Entity) { case "raven": reply.Text = "Raven the Best"; reply.Attachments = new List<Attachment>(); reply.Attachments.Add(new Attachment { Title = "Name: Raven Reyes", ContentType = "image/jpeg", ContentUrl = "URL_PIC_LINK", Text = "It won't survive me" }); break; case "clarke": reply.Text = "Clarke is the main character"; break; default: reply.Text = "I don't know this character"; break; } await context.PostAsync(reply); context.Wait(MessageReceived); } } }
Summary
Once you have set up a LUIS model, you need to publish it. After it has been published your bot can then connect to it via the LUIS Model tag. Connecting the bot to LUIS will enable the bot to understand natural language your users will use, however you still need to code the responses with LUIS Intent tags for your Task or Post methods in the Bot Framework.
So that should be everything to get LUIS working. Remember that this content is all in Beta and is subject to change, but I’ll keep it updated as much as possible.
Happy Hacking!
-TheNapping Kat