Building Your First Bot using Microsoft Bot Framework

By | September 7, 2016

Microsoft Bot Framework is a comprehensive  suite of tools and offering to build and deploy the conversational chat bots for your app users.  You can build and publish your intelligent bot that interacts naturally wherever your users are talking – from Skype, Facebook Messenger, Office 365 mail and other conversational medium. Read more about Bot framework over here..  In this post we will explore how to get it started.

First things first, Tools :

  • Download the Bot framework template from – Visual Studio Template – C#  and place the downloaded zip folder inside Visual Studio Project template folder (“%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#” ) .
  • Followed by template placement, download the Bot Framework Emulator (Windows) and install it.

Creating New Project

Start the new instance of Visual Studio and create a new project by choosing the “Bot Application” template as shown in below screenshot.

Bot Application Template

Bot Application Template

Once the project creation is successful, if we explore the “Solution Explorer” of the created project, it is nothing but Web API project.

Bot Application - Solution Explorer

Bot Application – Solution Explorer

Before taking look inside a code, Run the application from Visual Studio.  This will launch in a browser  mode and we can then test it using the emulator which we had just downloaded.

Bot Application - Running

Bot Application – Running

Once your Bot is running, Launch the Emulator for Bot Framework, and set the Bot URL to the same port where your app is running.

Bot Application - Launch Emulator

Bot Application – Launch Emulator

That’s it. The default Bot which comes with template is nothing but an Echo Bot, which just each what you type along with length of the text provided.

Bot Application - Running on Emulator

Bot Application – Running on Emulator

“Hello Bot” and “This is my first Bot” were two different set of input from user and you can see the output received from the Bot.

Yes ! this is as simple as what you can see it over here.

Let’s take a step back and see what is inside. The MessageController.cs  which defines all the methods and properties to control your Bot. The MessageController Class is derived from the ApiController class, which is an abstract class.

For this Bot Implementation, the Post() method actually takes care of this request received from the user and replying the response by calculating the length of the message.

Bot Application - Message Controller

Bot Application – Message Controller

That’s it from now. We will explore more details on this implementation aspect in other post !

Hope this helps !

2 thoughts on “Building Your First Bot using Microsoft Bot Framework

  1. Pingback: Szumma #057 – 2016 37. hét | d/fuel

Leave a Reply

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

Verify Captcha *