Chatbot Architecture in a nutshell

Chatbots are software that enables machines to communicate with humans in a natural language. Chatbots have numerous uses in industries as they answer FAQs, communicate with customers, and provide better insights about customers’ needs.

In this article, we explore how chatbots work, their components, and the steps involved in chatbot architecture.

Chatbot purpose

In simple words, chatbots aim to understand users’ queries and generate a relevant response to meet users’ needs.

Simple chatbots crawl users’ input for general keywords, look through their predefined list of answers, and provide a response to the user’s query. You can extend your bot with AI and natural language processing (NLP) to recognize users’ intent from the context of their input and generate correct responses.

In your game, Chatbot can be leverage in several ways like:

  • Emulate characters discussion
  • Provide in game support with the ability to connect to helpdesk
  • Assist player with documentation extract

Of course, chatbot is only relevant when you create an online game.

Chatbot Types

Chatbots can be divided into 3 types based on the response-generation method

Rule-based chatbots

Rule-based chatbots rely on if/then logic to generate responses based on predefined conditions and responses. These chatbots have limited customization capabilities but are reliable and are less likely to go off the rails.

You should consider this approach as the primary step. Of course, this kind of chatbot is dump, as player are, because its understanding and ability to adjust are low, but it’s also the easiest way to create your first one.

AI-based chatbots

AI-enabled chatbots rely on Natural Language Processing (NLP) to scan users’ queries and recognize keywords to determine the right way to respond. Additionally, some AI-based chatbots self-improve by using users’ data as new training data in order to expand the knowledge database and improve their responses.

At this stage, you really have a conversational bot. If you connect this engine to your backend, documentation, knowledge base, you have a powerful tool that can assist your players in games.

Hybrid chatbots

Hybrid chatbots rely both on rules and NLP to understand users and generate responses. These chatbots are easier to tweak, become they rely on a database, but have limited conversational capabilities compared to AI-based chatbots.

Often, you will escalate to human to address uncovered answers.

Chatbot components

We now know what a chatbot is but want to dive deeper and see what it is made up of. What components does it need to operate intelligently and give an outstanding digital experience to your users?

Let us divide the components in 2 groups (Essential and Optional) then discuss each of their functionalities.

Essential Components

Bot Middleware

The Bot Middleware is the heart of the bot’s implementation. It’s implemented and deployed as your game backend, in a serverless compute on demand solution.

It acts as the central controller that handles the following tasks:

  • Receive messages from voice and messaging channels
  • Check the context of the message in the overall conversational dialog
  • Interact with the NLP Engine to extract Intents and Entities from user’s message
  • Integrate with Backend Systems to retrieve user-related information
  • Log conversations to an analytical store for future analysis

Channel Connector

The Channel Connectors bind together the bot’s backend with the user interfaces.

These channels, offer ability to land on a single Bot Middleware (but you can off course rely on several) from multiple sources like Facebook Messenger, Teams and others. The connectors provide the channel supported method of integration along with mapping capabilities that allow a standard generic message format to be used by your middleware while still supporting multiple channels.

Channel Connectors allow player to start an in-game conversation that can be followed on your website and finish at home through a voice assistant.

See how to rely on Direct Line API to connect Chatbot to Unity

Natural Language Processing

Natural Language Processing (NLP) enables chatbots to convert users’ text and speech into structured data to be understood by a machine. NLP consists of the following steps:

  • Tokenization: also called lexical analysis, is the process of splitting the string of words forming a sentence into smaller parts “tokens” based on its meaning and its relationship to the whole sentence.
  • Normalization: also called syntactic analysis, is the process of checking words for typos and changing them into the standard form. For example, the word “tmrw” will be normalized into “tomorrow.”
  • Entity recognition: the process of looking for keywords to identify the topic of the conversation.
  • Semantic analysis: the process of inferring the meaning of a sentence by understanding the meaning of each word and its relation to the overall structure.

The Natural Language Processor helps to extract user’s intent and any possible entities from their message. This helps the bot’s decision tree to identify what action needs to be taken in the conversation.

Natural Language Understanding

Natural Language Understanding (NLU) is an AI service that applies custom machine-learning intelligence to a user’s conversational, natural language text to predict overall meaning, and pull out relevant, detailed information. It is a subfield of NLP which focuses on understanding the meaning of human speech by recognizing patterns in unstructured speech input.

NLU solutions have 3 components:

  • Dictionary to determine the meaning of a word
  • Parser to determines if the syntax of the text conforms to the rules of the language
  • Grammar rules to break down the input based on sentence structure and punctuation

NLU enables chatbots to classify users’ intents and generate a response based on training data.

Knowledge base

A Knowledge Base (KB) is a library (or several) that the chatbot relies on to fetch the data used to respond to users.

Knowledge bases differ based on business needs and that the reason why, each has a specific purpose.

For instance, the knowledge base of a Tycoon game chatbot will contain information about products, store, and prices, whereas a support KB chatbot will have information about devices, bugs, gameplay.

State storage

You may choose to store conversations state for many reasons.

  • Maintaining state allows your bot to have more meaningful conversations by remembering certain things about a user or conversation.
  • Storing state (such as where the conversation left off or data previously received about the user) is necessary for the bot to have a useful conversation when player is not focus on discussion, or when you segregate your bot in several to ensure maintenance or simplicity.
  • Training or testing a new release of your NLP/NLU
  • Providing insights tor customer service, marketing or operations to maximize player experience.

Dialog manager

Dialogs are a central concept, providing ways to manage a long-running conversation with the user. A dialog performs a task that can represent part of or a complete conversational thread. It can span just one turn or many and can span a short or long period of time.

Dialog Manager is the component responsible for the flow of the conversation between the user and the chatbot. It keeps a record of the interactions within one conversation in order to decide how to respond. Several types of dialogs can be used like a waterfall sequence, to guide a player through a linear process, or a QnA dialog, that automates access to a QnA knowledge base.

Enterprise Backend

Technically this is not needed for a bot to operate, but for a bot to be successful, it is absolutely critical. Bots feel shallow and generic when they lack the connectivity to the enterprise.

A bot that understands who you are and what your preferences are is so much better than one that just understands English.

This may be the best reason to implement a bot in your game. When a player has an issue, leaving gameplay to rely on smartphone to find the answer on a website or forum is un inconsistent way to manage engagement. Through the bot, he will be able to crawl knowledge base then rely on operator if an escalation is needed.

User interfaces

Conversational User Interfaces are the front-end of a chatbot that enable the physical representation of the conversation. They are classified into text-based or voice-based assistants. And they can be integrated into different platforms with Channel Connectors, such as your game in Unity, your website, Facebook Messenger, WhatsApp, etc.

Your User Interface should offer a great way to maintain engagement with your customers.

Optional Components

The following components are optional but help to add immense value to the experience your bot provides.

Cognitive Services

While using an NLP itself is a cognitive service, there are always other things that you can do to enhance the end user’s experience. Here are a few,

  • Image Recognition – Use images to search for similar products, process insurance claims, and more right through your chatbot
  • Sentiment and Tone Analysis – Analyze your user’s messages to understand them better, respond in a personalized way and ensure that they stay happy
  • Language Translation – Convert your chatbot to a global hero in a few clicks by adding a language translation service on top of your NLP layer

Identity and Authentication

Bots are just like applications and to gain from your investment, you need to be able to authenticate users and validate their identities.

Multiple mechanisms can be implemented to achieve this including standard login, oAuth tokens, and Multi-Factor Authentication with mechanisms like SMS One Time Passwords and Image Recognition.

Bot Insights

Just as performance insights is important for applications, analyzing your bot’s performance and constantly improving it is just as important.

Through conversational logging, you can apply a number of actions such as,

  • Analyze user adoption and bot performance
  • Visualize the abandonment rate and critical errors the bots are making
  • Understand new areas for training the bot to respond to user’s queries

Agent Escalation

Bots cannot answer every question, that is not what they are meant to do. They are meant to answer the most frequently asked questions and handle those for the majority of users. So how do you handle those one-off requests that need a human’s touch?

Bots can escalate conversations to agents so that your users can continue in their messaging channel and speak with an agent, either on request (or) through a trigger mechanism such as angry tone. The agent can visualize the previous conversation with the bot and continue on from there.

Share for immortality
Default image
Laurent LEFEVRE

I'm a Microsoft employee, working on Technology Strategy for large Enterprise account.
I focus on industry business trends and explain how you can leverage Azure Game Stack & Xbox services.
I assume that I don't know anything. This is a great habit to do a full knowledge refresh and avoiding bias.