How can I make my ChatBot more efficient?


In a digital world in perpetual evolution, ChatBots are very popular. Many people have heard about them, but it's not easy to understand their uses and issues. I'll try to explain how a ChatBot works and why it is necessary to add external elements to the ChatBot to make it more interactive.

But by the way, what is a ChatBot?

A ChatBot is a computer program ("Bot") capable of answering questions asked by a user via an online chat. The user asks his questions in the chat in natural language (language spoken by a human being like French or English, as opposed to computer language) and the ChatBot answers him in this same chat in natural language. The ChatBot is not the chat itself, but the computer program that will analyze the user's question and return a relevant answer in the chat.

We can distinguish two types of Chatbots:

  • Simple ChatBots: a simple ChatBot is a computer program that will take the user's question as incoming data, perform some processing related to this data and finally send a message back to the user.
  • Complex ChatBots: A complex ChatBot consists of more than just a computer program. Third-party APIs (programming interfaces) are added to this program.

Several common examples of APIs that can be integrated into a ChatBot:  

Natural Language Understanding API

This is, in my opinion, an essential component for the development of a ChatBot. The idea is simple, the API provides an AI (Artificial Intelligence) to be parameterized which will be able to "translate" a user question into an "intention" (which at the end of the process will correspond to an action of the ChatBot) with a probability score.

The administrator of this AI defines a list of "intentions". The administrator must then "train" the AI, i.e. he must associate a list of questions to each intention. This may seem quite complex, but I will give you an example to illustrate the principle.

Let's imagine that we develop a ChatBot that gives information about the user's agenda. The user will want to consult his appointments of the day. To do this, he may have a multitude of questions: "What is my schedule for today?", "Give me my appointments for today", "What are my appointments today?

A ChatBot without a language understanding API must handle all these possible cases by itself. The API allows to link the potential questions of the user with the intentions. The training of the AI consists in associating a series of "typical" questions for each intention. In our example, we will assign these three questions to the intention "Give agenda of the day". If the user asks a question that resembles one of the questions defined in the intent, then the API will respond with the intent and a high probability score.

LUIS from Microsoft Cognitive Services

For my part, I used LUIS (Language Understanding Intelligent Service) which is part of Microsoft Cognitive Services, the set of AI libraries from Microsoft. In my opinion, LUIS has several advantages. It is easy to set up (definition of intentions and utterances that correspond to typical questions). For each sentence, it returns a JSON answer with the intentions and their score. It works in the cloud and does not require any specific installation. Last but not least, it can handle several natural languages such as French and English.

Specific display API

Depending on the question asked by the user, we can imagine answer scenarios that do not work in the form of a simple text.

A common and very simple use case is an answer offering a choice. The bot must be able to provide a value selection mechanism to guide the user. Other use cases may arise: sending a file, specific input.

These APIs are very useful, however, this raises another issue. A ChatBot, like any other computer program, must be generic. The ChatBot must be deployable across multiple channels without altering functionality.

Here is an example to illustrate the problem. We have a ChatBot that is deployed on a WebChat and that can also be used by SMS. If the ChatBot proposes a selection of values in response to a question, the display must be adapted to the broadcast channel. In our case we will have for example a drop-down list for the WebChat and a number to enter for the SMS (1: value 1, 2: value 2, etc...). I used AdaptiveCard for the Microsoft BotFramework. It has the advantage of automatically managing the display according to the communication channel. The developer just defines a "Card" for example of type "Choice" and the display is adapted according to the communication channel as described in the previous example.

Integration with third-party applications

Considering that a ChatBot only allows to answer questions asked by a user is quite reductive. The ChatBot can also interact with third-party applications (reading and editing). In the example of appointments, the ChatBot will fetch the information from the company's calendar tool (reading data). Another example, a ChatBot on a sales site can feed a database (edition) by integrating statistical data (number of ChatBot interactions, user satisfaction).

You now know how a ChatBot works. However, before launching, it is essential to ask yourself other questions: What are the use cases? What are the advantages of using a bot? What are its limits? How to secure my ChatBot? How to measure the added value of my ChatBot?

Damien CELLE

Damien CELLE

Office 365 Consultant



An article by

Damien CELLE

Damien CELLE

Office 365 Consultant

Want to go further?