Structure and Architecture of a chatbot

Chatbots are designed from advanced technologies that often come from the field of artificial intelligence. However, the basic architecture of a conversational interface, understood as a generic block diagram, is not difficult to understand.

Programmers use Java, Python, NodeJS, PHP, etc. to create a web endpoint that receives information that comes from platforms such as Facebook, WhatsApp, Slack, Telegram.

In that sense, we can define the architecture as a structure with presentation or communication layers, a business logic layer and a final layer that allows data access from any repository.

In a chatbot design you must first begin the conversation with a greeting or a question. Then, the user is guided through options or questions to the point where they want to arrive, and finally answers are given or the user data is obtained.

Let's see below how a common structure with elements would be, and how a reference architecture would work.

ChatBot architecture elements

Presenters

This layer is responsible for making a call on the channel (Messenger, Web, Slack, etc.) to show text, a button, image or video.

Flow

Executes the operations and logic of the chatbot. In its development, it uses data, interacts with web services and presents repositories to store information.

Quick Replies

It controls the quick replies that arrive from the channel by which different bot actions are executed by making use of functions declared by the Flow.

Postbacks

Get the user input to trigger actions from the Flow module or repositories.

Repositories

This layer contains the most common operations to access our data and templates from our database or web services using declared templates.

Templates

They are the predefined actions or intents our chatbot is going to respond. They are usually defined with NLP and have some sort of data validation.

Voice ChatBots and Phonebots

This architecture may be similar to the one for text chatbots, with additional layers to handle speech.

First of all we have two blocks for the treatment of voice, which only make sense if our chatbot communicates by voice.

Speech recognition

It takes care of recognizing what the user says.

Speech synthesis

Lets the bot speak.

Conversation manager

It is the module that decides the flow of the conversation or the answers to what the user asks or requests. Basically this is the central element that defines the conversation, the personality, the style and what the chatbot is basically capable of offering.

Natural Language Understanding

The NLU module, Natural Language Understanding, takes care of the meaning of what the user wanted to say, either by voice or text.


Integration with the Backend

Since chatbots rely on information and services exposed by other systems or applications through APIs, this module interacts with those applications or systems via APIs.

Thus, the bot makes available to the user all kinds of information and services, such as weather, bus or plane schedules or booking tickets for a show, etc.

Channels

It is the medium that the chatbot inhabits and where it communicates. On platforms such as ChatCompose for example, the integration channels are usually Facebook Messenger, Telegram, Slack, Web, CMS, Salesforce, etc.

Reference architecture

An intelligent bot is one that integrates various artificial intelligence components that facilitate the different functions that optimize processes. Under this model, an intelligent bot should have a structured reference architecture as follows.

Master Bot (Multichannel Integration)

The Master Bot interacts with users through multiple channels, maintaining a consistent experience and context. This type of system understands the user's questions, answers frequently asked questions and directs the rest to the slave bot (based on recovery or generative) to answer and facilitate the required intelligence services or capabilities.

AI capabilities

Artificial intelligence capabilities include a series of functions by which the chatbot is trained to simulate human intelligence. The bot should have the ability to decide what style of converation it will have with the user in order to obtain something.

Likewise, the bot can learn new information through repeated interactions with the user and calibrate its responses. 

Another capacity of AI is to manage conversation profiles and scripts, such as selecting when to run a script and when to do just answer questions.

External Integration services

These services are present in some chatbots, with the aim of collecting information from external systems, services or databases.

This is a reference structure and architecture that is required to create an chatbot. 

Although the use of chatbots is increasingly simple, we must not forget that there is a lot of complex technology behind it. There is also a lot of design and work in what has to do with defining the personality of the chatbot and the conversation flow and, finally, a lot of functionality and information that we normally access as third-party services via integration.

A good use of this technology is determined by the balance between the complexity of its systems and the relative simplicity of its operation. The architecture must be arranged so that for the user it is extremely simple, but in the background, the structure is complex, and deep.

Would you like to know more?

Get more information