How to build and deploy a Chatbot using IBM Watson Assistant
September 16, 2020 - 20 min read
"A computer would deserve to be called intelligent if it could deceive a human into believing that it was a human" — Alan Turing
You have certainly visited a site at least once and been automatically greeted by a chat or interactive pop-up that asked "How we can help you?" and was smart enough to answer almost any question. This type of interaction defines a chatbot, and is a trendy technology that has managed to change the business perspective and relationship with potential customers that a company has.
Why this method? How complicated is it to create a chatbot?
In the following, we hope to answer these and other questions, because we will present, both technically and practically, what are the steps to create a simple and useful chatbot, using one of the most powerful platforms in the industry, IBM Watson Assistant.
Table of Contents
2.1 What is exactly a chatbot?
2.2 How to create a chatbot?
- IBM Watson Assistant
3.2 Design a hierarchical flow
3.3.Interact with your chatbot
Let's start by defining what a chatbot is, even if intuition already tells us everything. A chatbot is a program/application/agent that is able to conduct a conversation, through voice or text, in a natural language closely to the entity at the other end, namely human being (although it would be interesting to see a discussion between two chatbots ).
Thus, the main purpose of a chatbot is to represent a bridge between people and the services/interests represented by the entity that created that bot. Among the most important skills wherewith a bot can be designed are:
- marketing tool
- the possibility to schedule meetings/calls
- providing support for various user issues
- system for recommending internal products
- facilitating payments/reservations
- recruitment and management of human resources
Therefore, developing a chatbot can increase a company's productivity in a short time, bringing many benefits. Let's not forget, once the bot has been developed, it will be available 24/7 (assuming that the site or service hosting the bot will have no problems).
So let's say we want a chatbot. How exactly do we build it? What would be the options? First of all, we have to agree on what kind of chatbot we want to have.
Basically, there are two types of chatbots:
Chatbots that work based on well-established rules - This type of bots are very limited. They are programmed to respond to extremely specific commands without understanding the context of the requirement from the user.
Chatbots that work based on an automatic learning process - This type of bot tries to build a small neural network through artificial intelligence methods. You don't need to be very specific to interact with these bots, and often you don't even need to write grammatically correct. This category of chatbots can become smarter as they communicate with more people.
Certainly, the best option would be the second one, because we want a bot as efficient as possible, which manage to replace as well as possible all the processes that a person could do.
Great, so we want a chatbot with artificial intelligence! How we will create it? There are also, two approaches.
The first would be to build it from scratch, through a deep learning model, using an appropriate dataset and appropriate machine learning methods, with a focus on classifying and understanding the text. A Python library known and often used is ChatterBot, representing a good starting point in the development of a bot through a custom implementation. We recommend the following article: How To Create A Chatbot with Python & Deep Learning In Less Than An Hour
It would definitely be a solution! However, the development time and resources used could be quite large, given the outcome of the process. It worth? Definitely it worth. The question is: "Isn't there an easier and faster method?" The answer is "Yes, there is!"
And so, let's talk about the second approach. Using a platform that allows the creation of chatbots with artificial intelligence is a viable solution. These types of platforms are, for the most part, extremely intuitive, and provide interactive tools and components for the user, in order to develop a chatbot. It does not require programming knowledge (except in some cases), but just a lot of imagination!
The best known and used platforms are:
- IBM Watson Assistant
The downside is that developing a chatbot through these platforms is free, but using them in products costs money! Not all platforms are willing to offer the service for free, or if it offers it for free, it offers it with certain limitations.
This limitation was an important criteria in choosing the development platform. After an analysis and attempts to use several platforms, we chose to build our chatbot through IBM's platform, called IBM Watson Assisant.
Watson Assistant is at the head of the tech industry of conversations through artificial intelligence. Platform is simple and intuitive, with extremely well-created documentation. In terms of costs, it offers a free plan (Lite plan), which allows 10,000 messages per month via chatbot, and the ability to integrate the bot with web services.
For more information we recommend the official documentation: https://www.ibm.com/watson/how-to-build-a-chatbot
To access the Watson Assitant platform, but also other services, you need to create an account on IBM Cloud: https://cloud.ibm.com/registration. After you have created your account and logged in, select "Watson" from the side menu, and in the dashboard displayed you will find in the "Getting Started" section, the option "Build a chatbot".
From here you will be directed to the initial configuration page of the chatbot (pricing plan, region, service name).
When you're ready, click "Create" and that's it! The bot is created and ready to be configured as you wish, through the dedicated platform.
The process of learning for chatbot involves the development of several dialogue skills (up to 5 in the Lite version). A dialogue skill consists of Intents, Entities and Dialogs, these 3 components being the basis for learning of virtual assistant, through the IBM Watson Assitant platform.
An intent is a purpose or intention expressed by the user, such as asking a question - "How do I schedule a call?", or expressing an intention - "I would like to pay the bill".
By recognizing the desire of the user, the virtual assistant can choose the appropriate dialogue flow, and can formulate an appropriate response. Most of the time, the user's intention is cataloged by the bot in several categories, giving a probability to each option.
In the image below you can see several intents defined for the first dialog skill of the bot:
An advantage of using this platform is that it puts available a predefined range of intents, which can be used for free. (check Content Catalog section). Thus, the Bot Control category, and all associated intents, were added and learned by our assistant.
How exactly does an intent look like on the platform? You can see in the image below how an intent was defined for the flow of data responsible for information about AFM (Autonomous Fleet Management).
It is noticed that an Intent consists of name, description and user examples.
An entity is a class of data/information that is relevant to a user's purpose in expressing intent. By recognizing the entities, the virtual assistant can choose specific actions, in acomplish an intention.
For example, a user may want to know more about CodexWorks ("Tell me more about Codexworks"). At the same time, he may want information about the history of CodexWorks. ("Tell me more about Codexworks's history"). There is a difference between the two answers that must be provided. History is an entity, changing the context of the intention provided. For the user, the history becomes relevant, not the general information about CodexWorks.
In the image below you can see some entities defined within the platform:
A dialog is the component that uses discovered Intents and Entities based on inputs provided by user, in order to find and provide an appropriate response. The dialogs have a linear tree structure. Thus, a branch is created for each intent (or group of intents), together with the associated entities. Each dialog offers the possibility to prepare several answers, being provided only one answer (chosen sequentially, or randomly).
The image below shows a part of the tree structure of the dialogues for our bot, in which a well-established order of them can be observed. On the right you can see how the dialog for the Greetings use case is defined, and the possible answers that the bot can offer, if it recognizes in the user's input a form of greeting.
After defining a few dialogues, the bot can already be successfully tested! His training is done in real time, immediately after adding a new element, of any type.
In the upper right corner you can see the Try it button that opens the chat for the bot you created, with which you can interact and see in which category maps the input (question or intention) provided by the user.
An extremely valuable advantage of these platforms is that the deployment process is very simple. To create a deployment channel, go to the main panel of the platform and select Integrations. From there you will be able to create a new integration, with whatever service you want. The most common is Web chat.
In the panel that represents the chosen integration you can customize your bot with other services, or style it at the design level. When you are ready, in the Embed section you will find a js code section which is ready to be integrated in your page/site/service, from where it can be used as you wishl.
We integrated the chatbot in the code related to our site, www.codexworks.com, and the corresponding chat icon appeared immediately, the bot being ready to use
- Watson Assistant, URL: https://www.ibm.com/cloud/watson-assistant/ (accessed in 14/09/2020)
- How to build a chatbot for your business, URL: https://www.ibm.com/watson/how-to-build-a-chatbot (accessed in 14/09/2020)
- Build an IT support chatbot by using IBM Watson Assistant, URL: https://www.ibm.com/cloud/architecture/tutorials/watson_conversation_support (accessed in 17/09/2020)
- Designing a chatbot with IBM Watson Assistant, URL: https://medium.com/ibm-garage/designing-a-chatbot-with-ibm-watson-assistant-7e11b94c2b3d (accessed in 14/09/2020)
- Chapter 4 — Step by step guide to creating a Chatbot using IBM Watson, URL: https://medium.com/@DIGIOTAI/chapter-4-step-by-step-guide-to-creating-a-chatbot-using-ibm-watson-3fb0cca9a44f (accessed in 14/09/2020)
- Ce este un chatbot?, URL: https://www.todaysoftmag.ro/article/2645/ce-este-un-chatbot" (accessed in 10/09/2020)