9 March 2018

Chatbots – The virtual assistants of the future

Chatbots are computer programs that simulate conversations with people using artificial intelligence mechanisms.

Although it is still a recent technology, currently chatbots are used in the most varied business areas, if each area has the sensitivity of how to use this technology correctly. Tourism, Banking & Insurance and even Health sectors, are examples of how this technology can be used.

There are several types of chatbots, from the most basic to the most complex.

The most basic chatbots use forms to communicate, such as, the user asks a question and a chatbot returns a list of possible answers. In more advanced models there are natural language interpretation layers, in which a chatbot can interpret naturally written sentences instead of small word commands. In these more advanced models, training is required for learning models, and so the artificial intelligence behind the chatbot is becoming more enriched and prepared to return answers.

 

This way, when we talk about chatbots, we have 3 main layers to consider:

  1. CLIENT – The user will send a direct message to the chatbot, being frequent in webchats through a site, mobile applications that support conversations, such as Slack, Facebook Messenger, Skype and many others. For this practical case was considered Skype.
  2. BOT An event that “listens” to messages coming from the CLIENT, understands the message and invokes appropriate HTTP POST requests to handle the message in order to send a response back to the CLIENT.
  3. INTEGRATION – Depending on the type of application that is made to the chatbot, we can enrich the response given to the client through the integration of different systems. Such as machine learning/cognitive services, as well as access to external systems.

 

Practical case - Chatbot integration with a WEBAPI

For this particular case, let us consider only the most basic chatbots.

The core of this bot consists of the following modules:

• Message Handler: Handles the messages that are sent to the chatbot and redirects to the correct dialogs.
• Dialogs: dialogs are divided by type of conversations, for example: contacts, simulations, support.
• Forms: forms are used by dialogs, they offer various hypotheses to a particular theme and depending on the chosen action, they execute the corresponding methods.

Although there are currently different frameworks, the case presents the operation of the Microsoft Bot Framework.

For this proof of concept, a customer support system (credit support) was created which, after submitting personal data, will simulate a particular loan.

The diagram below represents the bot’s behaviour whenever it receives a message.

 

  1. The user initiates a conversation with the Bot by sending a "Hello" message in order to "activate" the Bot. Since it is listening for a specific event, it verifies the user's message. Being this channel intended to make simulations, the Bot asks the personal data to the user so that it can do the simulation. The data is requested sequentially: date of birth, amount of credit and number of months of contract. Whenever the data is entered by the user, these elements are validated by the Bot according to its type and format.

  2. The user sends the data to the Bot, as requested sequentially.

  3. The Bot communicates to a WEB API, through an HTTP POST request, the personal data of the user, being responsible for providing the result of the calculation of the simulation to the Bot.

  4. The Bot, having the simulation result, returns the simulation value to the SKYPE client.

In the following image you can see the behaviour of the Chatbot in action:

 

According to Gartner, chatbots should be considered by all, since in the very near future (pointing to 2021) companies will spend more on chatbots development than on application development, being these the “face” of the artificial intelligence of the systems.