//End Google Tag Manager

How does a chatbot work?

By Botpress Team

If you don't know what is a chatbot, you should first read the whats and why of chatbots.

It’s amazing to see a well designed chatbot in action, but it’s even more powerful when you understand how a chatbot actually works.

We are going to give you the full picture of how a chatbot is made. From the components used in making a chatbot to the actual flow of information in the chatbot. 

Obviously, the exact components required for a given chatbot will depend on the type of chatbot you are building, but this will give you some idea of the components available.  

Connecting your chatbot to a channel

Every chatbot needs a channel to allow the user to interact with it. The channel is in fact a messaging platform such as Facebook Messenger, Slack, Telegram, Microsoft team or an embedded web chat.

You need at least one messaging platform, but you can also connect multiple messaging platforms and allow users to choose whichever they prefer.

The channel is the user interface of the chatbot, the same way a web page is allowing you to interact with a software with clicks. 

Decrypting the input with Natural Language Processing

Natural language processing (NLP) engines are capable of identifying the intentions hidden in a sentence in natural language. It’s important to precise “natural language” because unlike less intelligent bot requiring clear instructions, chatbots can understand human-like types of conversations.  

For example the following phrases all have the same intent, which is to book a flight:

1. I want to book a flight
2. I want to go from Dubai to Moscow
3. I need a flight

For a chatbot to be able to understand text or speech in natural language, it needs to access NLP engines.

The NLP engine can take a sentence and extract what is the intent behind it with a certain level of confidence. Natural Language Processing is a field of artificial intelligence and it requires a certain training. 

This is why in Botpress, we ask for what we call utterances. They are an important part of understanding. Utterances are variations of a sentence, different ways of formulating the same intent. 

NLP engines will use that to train.

Dialog Manager / Visual Conversation Builder

This is also a major part of a chatbot because this is where you design the experience. Once the chatbot has understood the intent, it needs to make a decision. 

There are 3 very common things that can happen; take action, ask for information or handling an unsupported intent.

Your visual conversation builder allows you to design what’s going to happen, how it’s going to happen and the language used to make it happen. 

If I say “Book me a flight tomorrow for Paris”. The NLP engine will detect my intent of booking a flight. It will extract tomorrow as the time of departure, Paris as where I want to go, but my departure city is missing. The visual conversation builder will allow you to handle that you need to ask for a departure city and then take the action of booking the flight.

This is a very simple example, but you can understand that in some cases the complexity is higher and therefore designing a great experience can be crucial to the success of your chatbot which is why the dialog manager is an essential piece of the puzzle.

Analytics

Analytics is needed to monitor and measure the chatbots’ performance. They provide metrics on the chatbot such as the number of users and the type of engagement. It’s obviously critical for chatbot developers to gather these types of metrics.

It gives you valuable insights on your users engagement to understand what might be missing and what are the key areas to improve. 

Content Management System

The content such as text in the user’s language and media files needs to be managed independently from the conversation flow. The language, the media files and implementation may change depending on who the user is, the context, and the messaging platform.

Content like code needs to be professionally maintained and source controlled. It allows you to decouple the content from the rest of the chatbot making it reusable and most importantly easier to maintain.

It’s very simple, yet very important to manage your content independently. 

Human in the Loop

Human in the loop is the ability of the human to take control of the chatbot. Some might think this is not a must have feature, but in fact it is. 

There are many reasons why a human might want to manually take over the chatbot conversation, the most common being that the chatbot did not understand what the end user said.

We would be lying to ourselves believing a chatbot will be right 100% of the time. Even if we make constant progress on the matter, it can’t be perfect at handling everything. When a user goes out of scope, human in the loop becomes essential to maintain a great user experience.

Architecture

While architecture is not a component, like any software, every chatbot has an architecture.  If the software architecture is not of a high standard the chatbot will not be extensible and easily maintainable.

The greatest advantages of using a conversational AI platform to build your chatbot is that everything is already architectured in a way that allows for scalability and maintainability. 

All you need to do is spawn up a server locally or in the cloud, and you are ready to build & automate.

Botpress has a modular architecture which makes it easy to activate or deactivate some module that are not core components.

On top of that, you can build your own module to extend the capabilities of the platform and, of course, your chatbot.

How data flows through the chatbot

These elements are all very key to making your chatbot work as smoothly as possible. Remove one of these elements and you won’t get the same experience.

From a macro perspective, here is how the information flows.

There is a user input via the channel. The first thing that information does is enter the Dialog Manager to be evaluated by the NLP engine. The NLP engine will try to decrypt the sentences to find an intent and return that information to the Dialog Manager. 

If an intent is detected, it’s up to the DM to decide where to go next according to the decision tree. If a third party needs to be involved the dialogue manager will make the request.

Everything is then sent back to the user through the same channel he used. 

While this is a simplified version of how a chatbot works, you can certainly appreciate the complexity of building such experience from a UX and technical standpoint. 

Using an open source conversational AI platform reduces drastically the time spent on building the infrastructure to make sure you swiftly get value out of your chatbot.


Download our open-source conversational AI platform and
start building chatbots in minutes.

Download Now


Disclaimer: We encourage our blog authors to give their personal opinions.  The opinions expressed in this blog are therefore those of the authors. They do not necessarily reflect the opinions or views of Botpress as a company.