Kick starting with Bot Development

Introduction

Bots don’t need any introduction. They aren’t new and definitely are not unique to Microsoft. Bots are conversational agents. They’re meant to help users achieve and/or complete a particular task. Bots can help users interact with a particular service or application without having to download a separate app or go to a specific Web site. Personal digital assistants like Cortana, Siri and Alexa could be construed as bots.

The industry now is starting to turn its attention away from apps and instead focusing on a new interface to drive “conversational commerce”. It’s centered around “delivering convenience, personalization, and decision support while people are on the go, with only partial attention to spare.

Already there are quite a few services lined up to capitalize on this opportunity, including Path’s Talk, Kik, Telegram, Skype, WeChat, and Line. Many companies, including Facebook, are seeing messaging apps as the new frontier, something that they can build on top of.

It’s the new application layer: “It’s a product that you interact with without a fixed user interface where you have to push this button, swipe over here, and you don’t have to learn how to use it. You’re just interacting with it conversationally.”

Next is the era of Bots! Messaging is the new browser and bots are the websites!!

Understanding the importance of Bots, Microsoft recently released Bot Framework in its Build 2016 Conference.

Let us dive little deep into Bot Framework and see what is in it.

Microsoft Bot Framework

Bot Framework provides just what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.

The Framework consists of three pieces:

  1. Bot Builder software development kit (hosted on GitHub) – for those interested in building bots using C# or Node.js
  2. Bot Connector for registering, connecting, publishing and managing bots to text/SMS, Office 365 mail, Skype, Slack, Telegram, kik and more
  3. Bot Directory of bots developed with the Bot Framework

 

Following block diagram explains the different parts of Bot Framework.

Bot Framework Overview

Bot Framework Overview

 

How to start developing Bots?

Microsoft provided an easy to use Framework for building bots. The framework will handle all the I/O channels, message parsing and allows integrating with popular services like Skype, Telegram, SMS etc. seamlessly with few clicks. Apart from the core functionality, Bot Framework is phenomenal in integrating with services like LUIS (Language Understanding Intelligent Service), Translation Service powered by Bing, Natural Language Processing (NLP), Machine Learning and Artificial Intelligence.

Here are the steps to start development.

  1. You need to have Visual Studio 2015 Update 1 to develop bots. Community version is available for free at https://www.visualstudio.com/
  2. Download and install the Bot Application template
  3. Save the zip file to your Visual Studio 2015 templates directory which is traditionally in “%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#”
  4. Open Visual Studio
  5. Create a new C# project using the new Bot Application template.

That’s all! You’re good to go.

Now, go to web.config and give any AppID and AppSecret or just add some numbers to existing one.

To run it, we need an emulator. You can download it from here.

When you run the application, it will open a  web page. Copy the URL and open the Emulator. Enter your URL followed by /api/messages and enter the AppID and AppSecret from web.config file.

Emulator looks like this.

BotFrameworkEmulator.PNG  

You can type in the textbox at the bottom of the emulator and send it to Bot. On the right side, the messages (request and response) will be shown in JSON Format.

The default application takes any input and returns the no. of characters you entered.

Too much in a single blog post. Isn’t it?! Will share more about Message Types and how to handle them, LUIS Integration and other features in separate blog posts.

Till then… Happy Coding!

Leave a Reply

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