e-Zest members share technology ideas to foster digital transformation.

Building a Skype for Business bot with Microsoft Bot Framework and LUIS

Written by Anuj Singh | Dec 5, 2018 7:47:13 AM
With the steady growth of chatbots, platforms like Skype, Facebook, Kik, Line etc. have all started supporting chatbots. The launch of the Microsoft Bot Framework provides an easy process for the development of bots on several such platforms.

Skype for Business is the Instant Messaging (IM) platform for thousands of businesses worldwide. However, as a platform primarily for messaging, Skype for Business does not support bots out of the box.

There’re several reasons why we’re increasingly depending on chatbot. Here are a few just in case you need.

  • They help us get work done more easily and efficiently
  • We like getting fast answers to questions. And finally, it leads to an easier daily routine

Here, we are using LUIS and Microsoft Bot framework to build a Chatbot. So, let’s see what LUIS is.

LUIS (Language understanding) is a cloud-based service that analyzes the user’s conversation, natural language text and makes the predictive meaning of the sentences along with taking out the relevant data from the sentence. LUIS analyzes the sentence to take out the intention behind the sentence and the entities that the user is pointing to. In a simpler way, we can say that it gives you the ‘subject’ and ‘object’ from a sentence.

Thus, while integrating the LUIS with BOT frameworks, the user request is passed to the LUIS as a text. Microsoft has exposed the LUIS API which can be integrated with different platforms. Consequently, it has removed restrictions to use LUIS with Microsoft technologies only. The LUIS returns the response in the JSON format describing the details about the intent, entities, and the accuracy of the prediction made for a particular intent.

For example, consider the LUIS app has been written for analyzing the employee information in an organization. While writing a LUIS app, the probable utterances are mentioned.

Say, "what is the employee information of a user, what are the projects that employee is working on, tell me about leaves applied by an employee" are the utterances mentioned in LUIS app.

What is Microsoft BOT Framework?

According to dev.botframework.com, the Bot Framework is built to be intelligent and learn from user interaction. User interaction can be processed from inputs via chatting or text/SMS to Skype, mail, telegram, SMS etc. If you want to learn more about it, you can learn from the following link. 

Microsoft Bot Framework Documentation

If you’re looking for a way to create a chatbot with the help of Microsoft Bot framework and LUIS then you’re at the right place!

How to build your own simple bot application?

The following steps will explain to you how to build your own simple bot application using Microsoft Bot Framework.

Step 1: Firstly, you must install some prerequisite software and updates given below

  • Visual Studio 2017
  • Also Update your all Visual Studio extensions through tools > Extensions and Updates > Updates.
Step 2: Download the Bot Application Template from the following link: Bot Application Template

Step 3: Above link will download a ZIP File. Just save that ZIP file in “%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#"

Step 4: Now open your Visual Studio
Step 5: Now create a new bot project in Visual Studio. To create a new bot project, here are the steps:

  1. First of all, go to File -> New. Then Project or press CTRL +SHIFT + N
  2. Now a dialog box will open. From that, select Visual C# Project and you will find an option Bot Application, choose that and give the name of the project.

Step 6:
After creating a project you will get some files in solution explorer as you can see here in the following figure:


Open Web.Config file and give the AppId and AppSecret keys for your project. If you are running this project locally then you can give any AppId and AppSecret.

After Adding the AppID and AppSecret, just write the message in the MessageController.cs file.

For example, “Hi, welcome to the team member information bot. How can I help you?” and test it on an emulator.

Now, the next step is to create a LUIS app for the bot.

Let’s create a chatbot from scratch using C# and LUIS deploying it on Azure.

  • To start with LUIS, go to luis.ai
  • Click on sign in and log in with your Microsoft account. You can see 'My Apps' tab as the default selected. ‘My Apps’ tab will list down all the LUIS apps you have created earlier.

To create a new LUIS app, click on 'New App' button. It will pop up the following page.


Here, you can specify the Name, Culture, and Description for your LUIS app.
You will be redirected to applications page again and will see your application listed there.


Click on an application and it will redirect to the dashboard. Here, it shows an id of the app along with counts of intents, and entities.


Three different things are there in LUIS that are important:

  1. Utterances
  2. Intent
  3. Entities

For more information about these things, kindly refer this link:

https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-concept-utterance.

Once you have created your LUIS app you can integrate it with Microsoft Bot framework.

After testing your bot on an emulator, your next step is to deploy it on Azure and integrating the bot with any of the messenger application such as Skype, and Skype for Business.

More information about deploying your Bot on Azure using Bot state service can be found here -

https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-csharp-tutorial-build-bot-framework-sample.

Here you have completed your Skype for Business Bot. This post is written based on documentation provided for Microsoft Bot framework portal.

Hope my blog sheds some insights on how to build a Skype for business bot with Microsoft Bot Framework And LUIS. If you have any questions, please leave in the comments below.

References: https://www.c-sharpcorner.com/article/creating-a-simple-bot-application-using-microsoft-bot-framew/