Fashion Magazine

Everything You Need to Build A Chatbot

By Trendytechie @theTrendyTechie

Chat bots are all the rage in the dev world. They represent the face of a new era of computing, one where we will not just use our computers, but communicate with them. Conversation is increasingly integral to our interactions with technology – most tech companies are adopting digital personal assistants, and many companies outside of the tech space are adding chat components to their sites to streamline customer service. But bots go way beyond these use cases, and are in fact part of a bigger story: the democratization of AI.

What is a chat bot? What is AI?

Artificial Intelligence is not a new idea, but until recently it has been reserved for advanced researchers and big-dollar-backed computer scientists. In the last two years, tech giants have released cloud-based services to expose the rich capabilities of artificial intelligence to the average developer, in the form of SDKs and APIs. These tools have enabled devs like me to build intelligent chat bots without having to learn deep machine learning techniques. Here are the tools I use to build my bots, teach them, and deploy them to the public!

Build It

Microsoft Bot Framework  |  Language: C# or Node.js

At their annual developer conference in 2016, Microsoft announced its commitment to Conversations as a Platform, and along with it a suite of new tools to develop apps that fit this movement. The Bot Framework is an open source SDK for bot development that allows developers to easily implement conversational capabilities into their apps, like dialog, context, and prompts. Here is a simple bot that prompts the user to enter their name and says “Hello <NAME>” to the user.

Everything You Need to Build A Chatbot

For more code samples of the Bot Framework at work, check out and star my botdemo project on GitHub (see the full repo here).

Teach It

A bot without brains is just a series of automated processes. In order to develop a bot that can seem human, you have to implement components of intelligence that will allow your bot to perform smarter tasks and gain a richer understanding of the user so it can provide better results. To do this I use Microsoft Cognitive Services, a set of APIs that expose rich machine intelligence capabilities under five different categories: Vision, Speech, Language, Knowledge, and Search. I like to think of these as the five sense of intelligent computing, because each category tackles a different form of interaction or capability. Here are some of my favourites:

LUIS – Language Understanding Intelligence Service. Leveraging machine learning, LUIS is an API that lets your app determine user intent, and is an absolute must for bot developers. LUIS has a web portal where you can build a model of your own customized intents and entities, and train it on specific utterances that a user might use. Each intent represents a user action, and each entity is a potential user input that relates to those actions. For example, if you’re building a bot to make travel plans, your user might want to book a car, book a hotel, or book a flight. These would each be separate intents, and the city name, travel dates, and other key bits of information would be the entities. You would then train the model using different phrases that the user might enter – “I want to book a flight to Munich,” “Book me a hotel in Tokyo next week,” or “I need to book a car to drive from Toronto to Ottawa on May 3rd.” The more you train the model, the more it will understand the different ways a user might initiate the dialog. This will allow your bot to make an educated guess and guide the conversation correctly even when the user inputs a sentence in a way it has never seen before.

In the below screenshot, a simple intent matching is demonstrated. Using a LUIS recognizer (an element of the botbuilder SDK), and depending on which intent it recognizes, we trigger a different corresponding dialog.

Everything You Need to Build A Chatbot

Emotion API. With face detection, this API detects the landmarks of the face and identifies the emotion that the identified face is displaying.

Text Analytics. This API serves a variety of purposes, exposing information about the text, most likely in this case the user input. This includes sentiment information, which gives a score of the user’s positive/negative sentiment; key phrase extraction, which returns key “talking points” in the input string; topic detection, which returns the main topic of the input, and the language of the input.

There are currently 25 APIs available in the Cognitive Services suite, which makes for a lot of brainpower for your bots!

Deploy It

One of the biggest benefits of bots over other apps is they allow you to truly meet your users where they are; instead of having users download a new app, you can make your bot available on platforms that users are already on, like Messenger, Kik, Slack, Skype, and so on.

The Bot Framework offers great connectivity to these platforms through the Bot Connector Service. It guides you through the process of obtaining all the keys and components necessary to publish your bot to each platform, and helps you submit it to be published.

For more code samples of the Bot Framework at work, check out and star my botdemo project on GitHub (see the full repo here).

Everything You Need to Build A Chatbot

. . . . . . .

Note: although I work at Microsoft, this post was not incentivized by the company in any way. I use these tools at work and in my personal projects, because I genuinely find them to be effective tools for developing great bots!

. . . . . . .

Everything You Need to Build A Chatbot


Everything You Need to Build A Chatbot
Everything You Need to Build A Chatbot
Everything You Need to Build A Chatbot
Everything You Need to Build A Chatbot

Back to Featured Articles on Logo Paperblog