Chatbot Development

Building Bots with Microsoft Bot Framework

Microsoft Bot Framework is a sophisticated framework for building chatbots. It’s especially powerful when combined with other Microsoft tools and services, such as Azure Bot Service, Cognitive Services, and BotBuilder. Explore all the details of Bot Framework, including web services, development SDKs, and use cases.

May 21, 2019
Building a chatbot with Microsoft Bot Framework tools

From basic chatbots to intelligent virtual assistants, you can build pretty much anything with Microsoft Bot Framework. Microsoft, like several other big tech companies, offers a comprehensive bot development framework and adjacent services that streamline the creation of a highly capable, full-featured chatbot.

If your organization already uses Microsoft enterprise tools and services, Bot Framework might be the best place for you to get started with bot building. And if you aren’t already using Microsoft products, there’s still a lot to love about Bot Framework.

What is Microsoft Bot Framework?

Microsoft Bot Framework is a suite of tools you can use to build a chatbot. To get a sense of what it’s like, this Bot Framework tutorial from the documentation is an excellent place to start. It shows you how to create a bot, teach it to interact with users, and deploy it on the platform of your choice.

What might be confusing, however, is how Bot Framework fits within the more extensive menu of Microsoft services. The Microsoft documentation is somewhat unclear in this regard, since most of it focuses on Azure Bot Service. Bot Framework, Bot Builder, and Azure Cognitive Services also receive coverage, but it can be hard to decipher what’s what.

Here’s a rundown of the different Microsoft tools and services available to bot developers:

  • Microsoft Azure. As the Microsoft cloud computing ecosystem, Azure contains a wide array of services. It’s the company’s enterprise platform that’s similar to Google Cloud, among others.
  • Bot Framework. As its name implies, this is the company’s actual chatbot development framework. However (and this is kind of confusing), it’s not what you actually use to define your bot’s behavior. Rather, it’s a matrix of tools that connects the bots you build to other platforms and services.
  • Bot Builder. This is the primary toolkit you use to define the attributes of your bot. Bot Builder is an open source product and includes SDKs for different programming languages, debugging and visualization tools, CLI tools, and webchat.
  • Azure Bot Service. A component of Microsoft Azure, this service provides a comprehensive environment for building your bot, in addition to testing, hosting, and deploying it around the web, plus applying AI features. Bot Framework itself is distinct from Azure Bot Service; however, developers using this service build their bots using Bot Framework within the Azure environment.
  • Azure Cognitive Services. Also part of Microsoft Azure, Cognitive Services contain tools that make your bot “smart.” It’s the Azure AI engine, and it’s what you use to give your bot natural language understanding (NLU) and machine learning capabilities.

So can you build a chatbot using Microsoft Bot Framework without using Azure Bot Service? Sure. You don’t have to use Azure. You can host your bot elsewhere and still call Cognitive Services APIs to take advantage of AI features. However, doing it that way would be like building most of your house on one side of a lot and constructing the kitchen as a separate structure on the other side. You’d still have a kitchen, but making coffee in the morning would be very inconvenient.

In much the same way, it almost always makes sense to use Bot Framework in conjunction with Azure Bot Service. That way, you can centralize all aspects of bot development, including NLU and machine learning, without a clunky workaround.

Use cases for Microsoft Bot Framework

Although you can use Microsoft Bot Framework to build pretty much any sort of bot, data retrieval and customer service make up a large percentage of use cases.

Data retrieval bots

As we discovered when we explored Amazon Lex, large companies are using chatbots to help employees query information from internal resources. Without the bot at their disposal, these workers would spend additional hours performing research. The bots save time, which improves operational efficiency.

And data retrieval bots aren’t limited to enterprise. The NAVITIME bot, built with Bot Framework, connects travelers to unique experiences that align with their interests based on their destination. Users can ask the bot questions, such as, Where can I find the best Pad Thai? or Where can I rent bicycles by the hour? NAVITIME digs into its backend travel resources to deliver an answer—and to help users enjoy their trip.

Another example is the Super Brand Mall chatbot. A luxury shopping mall in Shanghai, Super Brand Mall uses WeChat, China’s most popular messaging app, to interact with customers. Using Bot Framework, the organization built a WeChat bot that helps shoppers find information about mall services. For example, you can ask the bot which stores are at the mall, get parking information and fees, and learn about upcoming mall events.

Customer service bots

By now, nearly all of us have communicated with a bot associated with a company, be it a bank, telecom provider, or a retailer. San Francisco-based SMS management company Instaply built a bot on Bot Framework that helps users interact with businesses through text messages. Consumers can get answers to basic questions, such as, What’s the minimum balance requirement for a checking account? They can even make more complex requests, like scheduling a reservation.

However, customer service bots aren’t all about business. One example is Unibot, which is a customer service bot for students communicating with universities. You might even call it a student service chatbot.

Unibot helps non-English–speaking students seek out information about university services in their native language. A French speaker, for example, can ask questions, like, Will the library be open after my last class today? or What’s the last date I can withdraw from a course?—in French. The bot finds an answer to the question, presumably in English, translates it back to French, and responds to the student.

Why use Microsoft Bot Framework? The pros and cons

If you’re wondering how these bots understand nuanced questions about retail services, travel opportunities, and library schedules, the answer is actually a name: LUIS. It stands for Language Understanding Intelligent Service, and it’s the NLU engine that comes as a standard component of Azure Cognitive Services.

When you use Bot Framework in conjunction with Azure Bot Service, you can pull in LUIS to interpret user intents and to extract salient details from any request. LUIS also learns as it goes, allowing you to continuously improve the quality of your bot’s conversations.

Access to LUIS is one of the most significant advantages of using Microsoft bot-building tools, but it’s actually just one of several options in Azure Cognitive Services. The Translator Speech API, another available tool, is what gave Unibot its translation capability. It’s also at your immediate disposal, should you choose to build a bot with Bot Framework. Other Azure Cognitive Services include the Bing Spell Check API, the Text Analytics API for analyzing text for information, speech-to-text technology for speech recognition and transcriptions, and more.

As for the disadvantages, there aren’t many. The Bot Framework/Azure Bot Service combination has a lot to offer, in terms of features. That being said, there could be a learning curve for anyone not accustomed to Microsoft enterprise technologies. If, for instance, your organization already uses AWS for other aspects of your business, Amazon Lex might be a more straightforward choice.

Key features and integrations

Aside from integration with Azure Cognitive Services—one of the framework’s greatest assets—Bot Framework offers seamless integration with platforms like:

  • Facebook Messenger
  • Slack
  • Cortana
  • Skype
  • Twilio
  • GroupMe
  • Kik

The presence of Skype and Cortana on this list underscores the benefit of using this framework if you already work within the Microsoft sphere. There’s probably no easier way to create a Cortana bot than to build it through Azure Bot Service, apply NLU via LUIS, and deploy it immediately using the same set of tools.

When integrating your bot with any of these channels, it’s a good idea to also deploy it on a platform you control. By deploying your bot on your own .BOT site, it remains discoverable even as different communication channels evolve and user demographics shift. The Bot Framework documentation includes very straightforward instructions on deploying your bot to a website.

A .BOT domain name is a smart choice for your chatbot because anyone can tell, right away, that that’s where your bot lives. Your audience can always find it there, even if they’re not using Facebook, Slack, or Kik anymore.

Microsoft Bot Framework pricing model

Pricing is for the current Azure Bot Service, and there are two tiers:

  • Free Tier. Unlimited messages on standard channels; 10,000 messages/month on premium channels
  • S1 Tier. Unlimited messages on standard channels; $0.50 per 1,000 messages on premium channels

Standard channels, by the way, include Microsoft services, like Skype and Cortana. Platforms with publicly available APIs (Slack, for example) are also considered standard. Premium channels would include your own website or app.

Other tools, such as those available through Azure Cognitive Services, are priced at separate rates with their own fee schedules. What you pay ultimately depends on which services you use, what your bot does, how capable it is, and how frequently users engage with it.

Just want to experiment with Microsoft tools? You can download Bot Builder from GitHub or start using Azure for free. There’s a $200 service credit that allows you to try the service for 30 days.

Supported programming languages

Since Bot Framework is a Microsoft product, you probably won’t be surprised that C# is supported. Relative to other languages, the .NET SDK documentation for Bot Builder has by far the most contributors on GitHub.

However, Bot Builder also includes SDKs for JavaScript, Java, and Python. Whether you’re a Microsoft veteran, a generalist developer, or a web app aficionado, at least one of these SDKs ought to fit your skill set.

How machine learning works in Microsoft Bot Framework

Microsoft offers various machine learning products, but you’ll likely be using the prebuilt models available with Azure Cognitive Services. Since your bot is both an app (Azure Cognitive Services are essentially APIs for apps) and a tool that directly communicates with humans, it can learn new things as it continuously engages in new interactions. Azure Cognitive Services in general—and LUIS in particular—are best suited to machine learning of this sort.

The LUIS model contains prebuilt intents, utterances, and entities. Using LUIS, you can also define custom intents and entities to be associated with certain utterances. The LUIS authoring API is where you build out your model. Examples of utterances-intent-entity combinations might include:

red shoes you have in stock

  • Intent: BrowseInventory
  • Entity: shoes, red

locations in Chicago

  • Intent: BranchLocations
  • Entity: Chicago

book conference line with sarah + aaron at 3:30 on wed

  • Intent: ScheduleCall
  • Entity: 3:30pm, Wednesday, Sarah, Aaron

So how does LUIS handle this information, from a workflow standpoint? Every chatbot is different, but the process essentially unfolds like this:

  1. The LUIS endpoint receives each utterance as an HTTP request.
  2. LUIS applies the model, whether prebuilt or custom, and returns a JSON response with whichever intent received the top score for that utterance.
  3. Your bot uses this response to make a decision about how to fulfill the request. This could involve sending the user a follow-up inquiry, calling other services, or simply answering a question in plain text.

How to get started with Microsoft Bot Framework

Start with the Azure Bot Service documentation, which includes five-minute quickstart guides for C#, JavaScript, and the Azure portal. There are also tutorials for creating a bot with Azure Bot Service and building one locally with .NET or JavaScript. Another tutorial covers how to build a very basic bot and deploy it to Azure.

Be sure to check out Bot Builder, which you can download for free if you want to experiment a bit before starting a big project. If you feel like you want to move forward with Microsoft tools and build your bot using Bot Framework, using one of the Bot Builder SDKs is a smart next step.

The main thing to remember is that Bot Framework is a very capable bot-building option when you make the most of all the integrated services. Azure Cognitive Services, in particular, can help you build an intelligent chatbot and enable all kinds of new and useful interactions with your audience.