651.288.7000 info@intertech.com

Hello Bot using Microsoft Bot Framework

by | May 16, 2017

Microsoft Bot FrameworkBots are essentially apps with no interface. The ability of bots to help faster access and availability across most platforms, less friction to build and deploy makes them so unique. Bots also allow natural interaction with the users. They are already here! Most bots available today, however, help us get to what we want. They will maybe help in finding an app on your phone or that beautiful picture you have taken.

While machine human interaction was attempted before, the purpose of Bots is not to solve the interaction (Turing Test), but to use the interaction to narrow down to user specific needs. In this post, I will use the Microsoft Bot Framework to build a “Hello” bot as a demonstration.

The Code

Using Microsoft Bot Framework, bots can be built with C#/.NET or JavaScript/Node. Let’s take a look at a simple bot using JavaScript and Node in 3 easy steps:

  1. Install bot builder.
  2. Connect the bot target.
  3. Build the bot (Add logic and Communicate)

So, to install bot builder, we need to run:

Installing Bot builder using a .NET application is as simple as finding the Nuget Package ‘Microsoft.Bot.Builder’ in Manage Nuget Packages, click install button and accept changes.

Bot Connectors

The Bot connector represents a single point of communication between your bot and multiple services such as Skype, email or Slack. This is a service consisting of a REST API and JSON schema for communication between user and the Bot.

The example code below uses a Console Connector, the same can be easily switched to a Chat Connector or another BotConnector.

Hello Bot!

The next step is to add the logic and instructions to handle all communication with the user. Our hello bot also uses the Universal Bot class and it represents the core intellect of our bot. It manages all of the conversations our bot has with the user.

Two-way Communication using Dialog Handlers

Our universal bot also offers a waterfall way of cascading function calls where one function succeeds the execution of another function as shown below. The session object again, is transmitted from one function call to the other, in addition to a results object.

As you see here, most of this communication is facilitated using the dialog class and its underlying session object. Microsoft’s Language Understanding Intelligent Service (LUIS) offers an effective way of adding understanding of applications. Bot builder allows us to use LUIS to add natural language understanding using the LuisDialog class.

 

Real World Scenarios

Most of the real-world scenarios would include hosting the bot, setting up authentication with chat applications, such as Slack or Skype or any other chat service using a App Key / Password. Testing of your Bot before deploying to real world use, is possible by using the Microsoft Bot Framework Emulator.

If you or your company is looking to build a chat bot or need other development services, talk to Intertech’s Windows consulting team. We will help you build the development solution you need!

Follow Us

Categories

Pin It on Pinterest

Share This

Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!