CaaP with Microsoft Bot Framework and Cognitive Services

Microsoft has recently released their Bot Framework, enabling you to build your own bots with ease and connect them to the main messaging applications and platforms.

The framework is mainly composed of 2 components: the bot connector and the bot builder.

The bot connector is used to connect the bot to the different messaging services (Slack, Skype, SMS, Facebook). All you need to do is implement a MessagesController with the POST method to retrieve the messages (/api/messages). The bot connector wraps the messages from all of the different sources for you, so you only have to deal with one object independently from the source.

The bot builder is a set of tools that provide common functionality when you create a bot. It includes dialogs and forms for you to easily keep track of the conversation flow.

The Bot Framework comes with support for C# and NodeJS.

The development environment is also a major plus. Microsoft provides a template for you to create bots in Visual Studio ( and a chat emulator to test the bot without having to upload it to production.

Once you feel good about the bot, you can create an Azure WebApp to deploy it. Once it’s deployed, go to to register the bot and start adding channels (Skype, Slack, SMS, email).

That being said, here comes the cool part - LUIS and the cognitive services.

LUIS stands for Language Understanding Intelligent Service. It's a platform that allows you to enter utterances and assign them to intents (it has a lot more functionality but those are the basics). It uses machine learning to train itself and understand what users are saying based on the intents created.

Bot builder provides a built-in connection to LUIS. All you do is annotate some methods and they will be called automatically when the user sends a message that matches the intents. By doing this, you are building smarter bots that respond to natural language and not to specific commands.

This is an example of how easy you can connect LUIS to your bot:

blog post.png

And that's just the tip of the iceberg. Along with LUIS, Microsoft also released several very useful services for AI. Most of these APIs have a free quota for you test them if you have a Microsoft account. Below are some of the cognitive services:

  • Text Analytics API: Tells you what the sentiments are on a text by giving it a score between 0 to 1 where 1 is positive and 0 is negative. It also has key phrase detection, topic detection and language detection.

  • Recommendations API: Retrieves item recommendations based on purchases history. You can get recommendations based on a user or items.

  • Computer Vision API: Reads text on images and analyzes photos.

Imagine the bots you can create by integrating all of these services. For example, you could use Text Analytics API to detect if a user is getting annoyed by the bot and transfer the conversation to a real person.

Some tips for building your own bots…

  • Don’t use the emulator to test the production bot. When you do, all the async messages are routed to localhost:9000 and it stops working.

  • To test the bot in production, use the web control. You have to enable that channel, create a webpage and put the snippet they give you in the page.

  • For use in Skype, the Bot Framework supports cards and carousels. Try it out!...

Happy building!