Microsoft Bot Framework - Bot Builder SDK

Microsoft Bot Framework – Bot Builder SDK

Bot Builder is an open source SDK hosted on GitHub that provides developers with the basic building blocks for writing bots that are interactive and connect to multiple conversational platforms.

Bot Builder includes native libraries in both C# and Node.js, and it also provides a RESTful API that can be used from any other programming language.

Microsoft has divided the Bot Framework into several components because, as you will see, it’s one thing to write a bot and quite another to write a great one.

Being able to write a great bot requires being able to manage conversational state in a relatively easy way.

One of the goals of the Builder SDK is to act as a conversational logic provider. In other words, when you build a bot, you’ll have logic that is directly related to the actions that your bot will execute and you should have logic that handles the state of the conversation.

Handling the state of a conversation is not a trivial task, and this is the main issue this SDK solves—making it easier for developers to achieve conversational state awareness.

So, the logic of your bot should be divided into two sections—one section that contains the bot’s own logic and another section that manages the state of the conversation and is handled by this SDK.

A Bot’s Own Logic and Conversational Stat

A Bot’s Own Logic and Conversational Stat

In its most basic form, a bot should be able to get an input text string, process it, and return an output response. However, a bot that does only this is not really managing any conversational state at all.
Not handling state is fine for very simple bots, but really interesting ones—especially ones that handle multistep navigation, collect data, or require permissions—need a certain degree of complexity, to the point that if you want to manage on your own (inside your bot’s own logic section), doing so can become extremely difficult and cumbersome.
Therefore, it is quite important to separate conversational state management from the rest of the bot’s logic, and here is where this SDK comes in handy.
As the SDK also includes features for handling dialogs and form flow, the subset of the SDK focused on handling conversational state is often referred to as the Bot State service.
At a very high level, the SDK provides these features:
• A flexible dialog system.
• Built-in dialogs for simple things such as Yes/No, strings, numbers, and enumerations.
• Built-in dialogs that utilize powerful AI frameworks such as LUIS.
• Built-in statelessness that helps bots scale on demand.
• FormFlow: Being able to generate a form flow-based conversation from a C# class.
To get started with the SDK, first we must have a good understanding of the other major component of the Bot Framework, called the Bot Connector.

Bot Connector

As its name implies, the Bot Connector is a service that allows you to connect your bot with multiple communication channels.
When you write a bot using the Bot Framework and publish it on the Internet using Azure App Services, the Bot Connector’s role is to forward messages from your bot to a user and from the user back to your bot by using any of the communication platforms you might have chosen that are available and supported by the service.
In order to use the Bot Connector, you must have a Microsoft Account (Hotmail, Live, Outlook.com) so that you can log into the Bot Developer Portal, which will be used to register your bot.
You must also have an Azure-accessible RESTful endpoint exposing a callback for the Bot Connector service—this can be accomplished by deploying the bot to Azure App Services with Visual Studio (which we will explore later).
Finally, you must also have a developer account with at least one conversational platform (e.g., Skype) that will be used by the bot to communicate with users.
To get a better visual understanding of the Bot Connector, think of it as the central node in a graph that links all other nodes together. Each other node within the graph is a conversational platform supported by the Bot Framework that your bot can communicate with (i.e. send and receive messages).

The Bot Connector and Conversational Channels

The Bot Connector and Conversational Channels

These conversational platforms are channels (services) that the Bot Connector is able to connect in order to route messages and keep track of sessions that your bot will be using.
In other words, your bot is nothing more than a web service exposed through a public URL that relies on the Bot Connector to access various communication channels.

 

How the Bot Connector Binds Bots to Channels

How the Bot Connector Binds Bots to Channels

So, this gives us a clear indication of how the Bot Connector acts as a glue and ties channels to bots. It behaves as a sort of central communication hub between all parties.

Leave a Reply