The Bots Are Coming!

Bots. They are taking over, and I for one welcome our bot overlords!

Bots have been around for a long time, but recent advances in natural language processing are driving a resurgence. They are now being used to enhance experiences such as customer service, shopping, and toys.

If you’re not sure what you need a bot for, read “Seriously, what do I need a bot for?

So if you are thinking about building a bot, where do you start?

Do one thing well

Pick one use case and focus on that. It’s better to have a bot that is really good at one thing than a bot is not so good at many. You can always broaden its abilities later, but initially just start with one use case.

It’s important to provide guidance to the user at the start of the chat. Explain what the bot is capable of doing. That way they will know what they need to say, and users will be less upset if the bot can’t cope with some other random topic.

More than text

While it’s natural to think of bots as just providing textual responses, it doesn’t have to be like that. It can be much more powerful to provide additional information. Imagine asking a bot for directions, wouldn’t it be useful to show a map?

Always consider whether adding images, links, videos, maps, etc will provide value to your response.

More than just the chat

You are not limited to just the chat style interface, or responses back and forward. You can augment the experience with additional content around it. Imagine a pizza ordering bot, wouldn’t it be nice if you could see the pizza you are ordering as you say what you want? This could sit to the side of the main chat, and visually show pizza size and toppings. This provides confirmation to the user that the bot is understanding, and provides visual progress towards the goal.

Remember to make your interface responsive though, as there may not be space for this extra information on a mobile device. So you may need to fallback to providing more feedback within the chat in that case.

Expect the unexpected

Even if you set expectations of the bot’s capabilities at the start, users will always wander off topic, or try to interact with the bot as though it was a human. For these cases it is worth providing some chit-chat capability. Additionally you will likely want to catch topics related to your business which your bot can’t deal with yet, and direct users elsewhere.

Don’t repeat yourself

Being repeatedly told “I don’t understand” or being asked for the same information multiple times is annoying. Provide some variation in responses, and try to show what you understand when you don’t fully understand, e.g. if your bot helps people find places, and someone asks where something is, have the bot say “I don’t know where that is” rather than a general “I don’t understand”. Also remember important pieces of information the user has told you, so you don’t keep asking for them.

Guide the user

As I mentioned above, it is helpful to provide guidance at the start of the chat to help the user. The guidance shouldn’t stop there though. You can continue to guide the user throughout their conversation.

One simple way is to just change the prompt (e.g. placeholder text in input field) to be specific to what you are expecting, e.g. if your bot asks someone what their name is, then change the placeholder text to “Enter your name”.

You can also guide in other ways such as providing shortcut buttons for common responses, e.g. if the bot asks what size of pizza do you want, then you can have some buttons for “small”, “medium” or “large”. This saves typing and helps the user to understand how to respond.

Common Patterns

There are a number of common patterns that are used when building bots, so let’s look at a few.

Gather information

Often you need to gather a set of information, e.g. payment details, or pizza toppings, or name and address. The bot should be able to handle both taking all that information in one go, and taking some and prompting for what is missing.

Follow up questions

After a user response, it is often necessary to follow up, e.g. to confirm something, or to provide more information, or to deliver the punchline for a joke. The bot should be able to continue the conversation knowing what was previously asked.

Business processes

A bot can be a useful way to implement certain business processes. Imagine having a bot that can help people who have lost their credit card:

Specific fallbacks

As I mentioned earlier, when you don’t understand what has been said, it’s good to show that you understand some of it. This can be done by having fallbacks specific to parts of the conversation, and not simply relying on the top level fallback.

Help

If users get stuck the bot needs to be able to help them out. Providing a response to a request for help should result in the bot providing some extra guidance about what the user can do. It’s even better if the bot can help them with specific guidance for that part of the conversation

Feedback

Collecting feedback for when you bot is doing well or not doing well is useful for improving it. This may involve detecting when users are insulting or complaining at your bot, or when they say thanks or give compliments. A bot telling the user that it’s sorry it can’t help but will take feedback helps to keep the user engaged.

Memory

Remember important pieces of information that the user has told you, e.g. their name, the last topic you were discussing, etc.

Here the bot remembered that they were discussing Luigi’s restaurant, and could answer a follow up question about it with it being explicitly mentioned again.

Don’t talk about…

There may be certain topics that you want to ensure your bot doesn’t give an embarrassing answer to, such as political questions. To avoid this, you can create a list of topics to avoid, and provide a safe response.

Tone

Understanding the tone of the user’s input can allow for better management of the experience, for example if a user is getting angry then you may want to use different language or redirect them to a human.

The IBM Watson Tone Analyzer service can enable this.

See Santa’s Little Twitter Bot for an example of using Tone Analyzer in a bot.

FAQ

A FAQ (Frequently Asked Questions) bot is one which can answer lots of different commonly asked questions, but it doesn’t tend to go into any depth or further interaction. Of course an FAQ bot could be extended to have follow up questions or additional interactions, but it’s primary aim is to provide simple quick answers.

Long tail

Long tail is how you handle topics that your bot hasn’t been trained to deal with. For example, if you have a bot that is used for controlling things in your car, and the driver asks about how to check the oil level, then the bot could pass that onto a system that is loaded with the car’s manual and can search through it for relevant information.

The IBM Watson Retrieve and Rank service can help with this.

Test, test and test again

Once you’ve built your bot, you need to get people to try out it out. This is the only way to see how well it works. As much as you might think you know what people will say, they will always ask things you didn’t expect.

Innovate!

Don’t be afraid to use your imagination and remember that the technologies that enable you to build a chat bot can be used for other use cases where natural language processing is needed. As a fun example I created a text adventure game using IBM Watson Conversation. This was written in just a couple of hours and so is far from perfect but gives an idea of something different you can do.

If you want to have a go, then take a look at “Getting Chatty with IBM Watson” which takes you through the basics of writing a bot. After that there is “Conversation Patterns with IBM Watson” which discusses implementing these patterns with Watson.

Right, time to go build some bots…