Author avatar

Maciej Duraj

How to Build a Chatbot Using IBM Watson

Maciej Duraj

  • Apr 25, 2020
  • 10 Min read
  • 735 Views
  • Apr 25, 2020
  • 10 Min read
  • 735 Views
Data
Data Analytics
Aritifical Intelligence
Artificial Intelligence (AI)

Introduction

IBM Watson is a leading artificial intelligence (AI) and machine learning (ML) technology. It gained notoriety when Watson's predecessor, Big Blue, defeated a world champion in chess in '97. In 2011 it made its mark again in Jeopardy, proving how powerful its natural language processing is.

Watson is now leveraged for a wide range of uses across various industries, from machine automation and Industry 4.0 in manufacturing to finance analytics and cybersecurity.

The IBM Cloud platform will allow you to create a chatbot on the backs of possibly the most advanced machine learning system available to the public. Chatbots, as you may recall from another guide related to a rival service, are a useful way for your customers to ask questions and get answers right away. The bot can answer questions or direct the customer to another resource.

You can run the chatbot (or, as IBM refers to it, conversational instance) within a wide range of devices, channels, apps, or even car dashboards.

Imgur

Set Up an IBM Cloud Account

First, create an IBM Cloud account from the IBM Cloud website and log in. Keep in mind that the IBMid button will probably be the email address you registered with.

Imgur

Imgur

Imgur

Start Creating Your Chatbot

Click Get Started in the Build a Chatbot window.

Imgur

Next, choose a plan. The free Lite plan should be enough to get started for anyone not running a larger enterprise. It offers up to 10,000 messages per month with five dialog skills and 100 dialog nodes. You can upgrade to a paid plan any time and keep your intents, entities, dialog flows, and chat logs.

Additional plans include searchable indexes from external data (help desk), more than one user, more messages or APIs between the chatbot and customers, more dialog skills, and nodes.

To truly take advantage of the Watson AI, consider the Plus or Premium plans, which offer Intent Conflict Detection. This can detect when a user or site visitor is frustrated and needs their questions answered soon.

After choosing a plan, choose the name you want your chatbot to have and any desired tags.

Imgur

If you choose anything outside the free plan, click Add to estimate and Review estimate. Otherwise, go back to your IBM Cloud Dashboard. Your Watson Assistant instance should be available under resource summary>services. If your chatbot isn't indicated by a number "1" next to Services, click Create resource.

Imgur

You will see a list of service options available.

Imgur

If you do see a number 1 next to Services, click on Services to see your instance in a list.

Imgur

Click on your instance and then Launch Watson Assistant.

Imgur

Click My first assistant, then the Dialog window in the Skill section.

Imgur

Intents and Entities

Before you begin creating your chatbot's dialog, it's important to understand intents and entities. The way IBM defines them is that intents are the verbs or actions the user wants to do, while entities are the nouns like places or things related to your business. The chatbot puts them together to figure out the best ways to answer questions.

Intent Setup

Intent is the customer's purpose asking the question or the intention of their request. It could be something like finding basic information including hours of operation, or simply a greeting.

To set intents in your chatbot, click Create intent in the skill section and add the name of the intent and an optional description.

The name should reflect the intent, like "location," "operational hours," or "greeting." This example starts out with a greeting. Once you add this to the Intent name section, you will see another prompt called User example where you can input ways your customers may introduce themselves to the chatbot, such as “Hello,” “Hi,” or “Greetings.”

Imgur

Enter each example and click Add example to get a list. Watson AI will process this list and its variants into its system for future reference. Premium plans offer automated versions of user questions it deems appropriate for the given intent.

Imgur

Repeat this for other intents your customers may have, like "Operational Hours,” “Service Help,” “Sign Up to Service,” “Application Support,” “Definition of,” “Location,” and the like. A “ThankYou” or a “Goodbye” intent can be useful to leave the user with a good impression at the end.

Click the back arrow to add intents. The Content Catalog option within Skills has a wide range of automated, preselected options.

Imgur

Entity Setup

Next, set up some entities related to your business so the chatbot knows how to start answering questions.

In the Entities section, enter values related to the entity and synonyms for it. Values are used by the chatbot to find an entity based on synonyms a customer may use in their question. One customer may call the gallery a "showroom" while another may call it a "store," but if you list both of these as values under one entity the chatbot will recognize that they both suggest the same entity.

For example, if “ArtGallery” is the name of the Entity, then “Gallery” is the name of the Value, and “Showroom,” “Store,” “Showcase,” “ArtShow,” and “Display” are the synonyms. When everything you want is selected, click Add value. Imgur

After adding your values, click Try it to preview an instance of your chatbot and try to greet it. You will see the chatbot understand the intent when a # icon and the intent name appear next to it. However, the chatbot will not know how to answer until you create dialog.

Imgur

Dialog and Nodes

Dialog is how the chatbot responds to customers and jumps to new topics based on previous responses through the use of dialog trees. The dialog tree refers the customer to different topics using nodes.

A node deals with responses to specific entities or intents. There is a lot of variation here and over time you should get a hang of how to best give your audience the content they need. Watson will also use its machine learning algorithm to improve and adapt to changing conditions the longer it runs and more options you give it.

A node name should be descriptive and relate to the issue the chatbot will be dealing with because it may be shown to customers or coworkers.

To create dialog, click on the Dialog skill.

Imgur

“Welcome” and “Anything else” nodes are already set up for you. Click “Welcome” to modify it. You can give your chatbot various dialog options such as responses and variations of a response.

Imgur

It is good to create a welcoming message a bit longer than the default version and to set the variations of this response to random to make it less robotic.

Even though there is a "Welcome" node, the chatbot will still not be able to respond to customers until you set up a node for a greeting. This is unless you modify the section If assistant recognizes from the default "welcome" (which has not been set up as an intent) to "Greeting," because that is the intent it recognizes when a customer says "Hi" or "Hello".

Imgur

Here is an example of a response the chatbot will give as you set it up:

Imgur

Another thing to keep in mind about the nodes is that the chatbot analyzes them from the top down. So if the "Anything Else" node catches a question and answer before the "Greeting" node, the chatbot may get confused. "Anything Else" should be on the bottom of the list of nodes and "Greeting" should be on top.

Imgur

Head over to the Anything else node and modify the chatbot's responses to deal with any questions Watson may not understand or subjects you have no nodes for.

You can start to test these responses out by clicking Try it out. You can add a wide range of new nodes by clicking on the blue Add node button or the button next to it to add child nodes, or nodes within the main nodes that relate to them.

To modify your chatbot further, you can add custom Skills related to dialog or search with a premium subscription. A "Customer Care" sample skill is available to see the sort of options available to you within Watson’s arsenal of tasks and operations.

Imgur

Hover over the icons on the left to see the Skills options.

Imgur

Finally, go to the Assistants section and click on your instance to choose how to deploy your chatbot.

Imgur

Conclusion

It can be tricky at first to figure out the best way to set up an IBM Watson chatbot. But this is really due to how many options IBM gives you. Keep working with it and you may find that it is a comprehensive way for your customers to connect with your business whether employees are working or not.

11