How to create a chatbot using Microsoft Bot Framework

How to create a chatbot using Microsoft Bot Framework

How to create a chatbot using Microsoft Bot Framework

In this tutorials we will learn all the steps and basic idea for how to create a chatbot using Microsoft bot framework .A chatbot is a computer program or an application that you interact with in a conversational way via a chat or a voice interface. A chatbot can communicate using text, images, visual card like interfaces and speech. It can either be powered by a fixed set of rules where it relies on pattern matching also known as rule based approach or use artificial intelligence to mimic a conversation with a real person.

Introduction to Microsoft chatbot framework?

Microsoft Bot Framework is a software framework that helps you easily build, test and then
deploy a chatbot to multiple messaging channels. The framework is available in C# and
Nodes. It provides powerful tools to solve a lot of the common challenges involved in chatbot

How do Microsoft Bot Framework chatbot work?

The two basic types of chatbots, rule-based and AI-based, work in different ways. Rule- based
chatbots generally use a decision-tree based structure. This type of bot is very limited as it
only understands a few specific commands, and the bot is only as smart as it is programmed
to be. These bots generally use buttons to guide the user through the conversation. Chatbots
that use Artificial Intelligence can understand language–not just specific, defined commands.

The core parts of Microsoft bot framework

Microsoft bot framework has 2 core parts that make it a great tool to build chatbots. They are

  • The Bot Builder
  • The Bot Framework Portal

The bot builder is the set of language libraries or SDKs that will help you build the chatbot.
The SDKs are available in Node.js and .NET platforms. Bot builder also provides an emulator
which we can use to test and debug the bot locally before deploying to the messaging
applications. The SDK is open source and is hosted on GitHub at

The bot framework portal at is the admin panel to register
and manage your chatbots. The portal lets you configure your chatbot to make it work with
multiple channels or messaging applications. The bot framework portal currently supports the
following channels.

  • Facebook Messenger
  • Slack
  • Skype
  • Skype Teams
  • Telegram
  • Twilio
  • Email
  • Bing
  • Cortana
  • Kik
  • Web

Creating a simple echo chatbot  

We will build an echo chatbot which will basically echo or reply with the same
message that the user sends it.

First, we will create a folder called “Stay_Fit” where we will put the code for our chatbot.
Next, we will change our directory to “Stay_Fit” and initialize npm by running

npm init

The next step is to install all the required libraries. For the simple echo bot, we will be using
two libraries.

1. botbuilder – botbuilder is the bot framework library that provides you tools to build and
manage conversational flows.
2. restify – restify is a node.js module that lets you easily run a http web server.

3. Run the following command to install the libraries
npm install –-save botbuilder restify

Once the packages get installed we are ready to build our echo chatbot. We will be using
the ES2015 coding standards to build our chatbot.
Microsoft Bot Framework

Coding our bot:

The first step is to create a “src” directory where our source code will live and add a file called
index.js in the directory. This will be the main entry point to our chatbot application. Inside
the file add the following code.

How to create a chatbot using Microsoft Bot Framework How to create a chatbot using Microsoft Bot Framework
Now run the code by running the following command in the terminal npm run start.
This will transpile the code and store the ES5 transpilation in the “lib” directory and run it.

To test the functionality of the bot we will need to install the Bot Framework Emulator from and install the latest release.

Once you have the emulator installed, open it and put in the URL, http://localhost:3978/api/messages
and leave the AppId and AppPassword fields blank for now.

How to create a chatbot using Microsoft Bot Framework

See my other post : Robotic Process Automation (RPA) with Blue Prism (PDF)

Conslusion :
  • Chatbots are applications that you can interact with via a chat or speech interface.
  • Microsoft Bot Framework is an SDK to build chatbots and it supports node.js and .NET
  • Microsoft Bot Framework has two core parts the bot builder and the bot framework
  • The bot builder is a set of language libraries with powerful tools to manage
    conversational flow and respond to users.
  • The bot framework portal is an admin panel to register and manage your chatbot.

2 thoughts on “How to create a chatbot using Microsoft Bot Framework

  1. I抦 not that much of a internet reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back in the future. Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.