How to build a chatbot in 10 steps

From defining your bot’s scope and writing sample dialogs, to testing and optimising.

Tess Tettelin
7 min readNov 16, 2020

With 44% of consumers preferring to interact with a chatbot over a human, one thing’s for sure: chatbots are here to stay. But how do you build a chatbot for your business — one that actually helps you solve problems instead of creating more?

Read along for a 10-step guide on how to build your own chatbot!

1 — Define the scope

Before you can start building your chatbot, you need to know why you’re building it. What’s the goal here? If you want to automate an existing service, what is the current experience like? And how could a bot help improve it? Take a look at your business goals: if one of your goals is to increase customer satisfaction, you might want to add a chatbot to your customer support team and let it handle the most common FAQs, so your team can focus on the more complicated cases.

Ask yourself: how is this bot going to benefit your customers?

2 — Define the use cases

After figuring out the why of your bot, it’s time for the what. What is your bot going to do exactly for its users? I cannot stress how important it is to figure this out before you start building your bot, otherwise you’ll try and build a bunch of things at the same time, spreading yourself too thin, not creating a good user experience. My advice? Pick the two or three most important use cases to get started, and add more later.

Here are some good examples of use cases:

  • Make a reservation
  • Play a song
  • Close an account
  • Recommend new products
  • Get directions
  • Book a flight
  • Show local promotions
  • Process a return

3 — Understand your tech

Now that you know the why and the what of your bot, it’s important to understand the where: where will your bot live? Will it be integrated with WhatsApp? Can customers engage with it via SMS, Facebook Messenger, or on your company’s website?

What are the restrictions of each channel? A bot that talks to your users via SMS won’t be able to use as many characters as a bot that only communicates via web. Whatsapp might not allow for buttons, whereas Facebook does. So make sure you understand your tech and its limitations before you start building to save yourself the burden of having to change the design later.

4 — Know your user

In order to design an experience that feels personal, you need to know who you’re designing for. Who is this user that will engage with your bot? It’s important to know what they want and how they are feeling during the conversation. What’s their backstory? Their challenges? Their motivations? How familiar are they with your business and using bots in general? I like to create a user ID that I keep close when writing the actual dialogues.

An example user ID for a company that rents out luxury hotel rooms

5 — Craft your bot personality

A chatbot without personality is like a bad Tinder date: they looked great online, but as soon as you start talking to them, you realise there’s nothing more. You just can’t understand each other!

So how can you make sure your users connect with your chatbot and that the conversation is engaging and representative of real human interaction? By giving your chatbot a clear personality.

If you can, use your company branding as a starting point and build on it. I’ve also explained in detail how to design your chatbot’s personality in part two of my Conversation Design series.

6 — Map out the happy flow

Now that you have a clear picture of who’s communicating (your bot persona and your user ID) and what they’re talking about (your use cases), it’s time to start designing the actual conversation.

A ‘happy flow’ is a conversation in which everything goes the way it’s supposed to go. The experience is natural and smooth, and the user reaches their goal in as few steps as possible. Many conversation designers start with mapping out the happy flow because it’s the flow of least resistance. It takes the least amount of effort to script because it doesn’t include many of the edge cases that can occur (more on that later).

An example of a short happy flow for ordering food

A great way to write a natural, human-like dialogue is by using the wizard-of-oz method. This is how you do it: have two people sit back-to-back and tell them to improvise a conversation around a use case, with one person playing the user and the other playing the chatbot. Record the conversation and transcribe it after to have a base for your bot’s dialogue.

7 — Think about edge cases

We humans are curious human beings and we say the darnest things. We have individual preferences and have endless ways of saying the same thing. We need to make sure that a chatbot can handle those quirks.

After writing the happy flows, write out the most likely ways a user might go off track and how you’re going to deal with that. Your wizard-of-oz testing will help you pinpoint those pain points, as well as some basic user testing.

What if a user asks your bot how it’s doing? What if they as for a gluten-free option? What if they want to know if your packaging is recyclable? What happens if the user wants to book a table for nine and one person is in a wheelchair? These are all questions that fall outside of your bot’s scope, but are not too odd to be ignored. So make sure that your bot can reply to them.

Adding edge cases (in green) to the happy flow (in blue)

Quick tip: If a user leaves the happy path, make sure your chatbot strategically guides the user back to it after answering an edge case question, like in the example below:

A good answer to an out-of-scope question that puts the user back on track

8 — Error management

AI is good, but still not as good as our human brains. The technology is not yet capable of understanding everything a person says well enough in order to reply in a correct way. No matter how well your chatbot is trained, it will most likely fail at one point and that’s okay. It’s all about how you deal with such errors that can make or break a user experience.

Here are my top tips for good error management:

  1. Pay attention to context, have your bot pick up on clues to help steer its reply in the right direction
The bot understood ‘hotel’ and can reply accordingly

2. Provide an alternative way of support for when the bot really can’t understand

On the left, the user is stuck. On the right, there’s another way for them to get help

3. At the end of an error flow, always ask for feedback to make a frustrated user feel heard​

How do both conversations make you feel?

9 — Testing your bot

When you’ve completed your dialogues and created your flowchart, it’s time to take a deep breath. You’re now gonna send your little baby bot to its first test! 🐣

To get some first feedback, you can share the bot with a few friends or colleagues and ask them to try it out. Don’t provide them with context because a real user won’t get that context either. After they’ve tested the bot and shared their thoughts with you, you can ask them some detailed questions about the overal experience:

  • Personality: do the bot’s replies feel consistent? Does its tone-of-voice fit your brand?
  • Onboarding: was it clear to you what this bot can help you with? Could you move from one question to another one without errors occurring?​
  • Understanding: did the bot understand your questions and answers? Did you get stuck at one point and if so, where and why?
  • Answering: did the bot give accurate, relevant and clear answers? Did it feel like an actual conversation?
  • Error management: how did the bot handle errors? What went wrong? How did it make you feel?
  • Overal experience: did you enjoy this experience? Did this bot match (or ideally exceed) your expectations?

Some platforms also allow you to do some quick testing, like chatlayer.ai. There you can see which intents and expressions were recognised (in)correctly, how long each user session was, and when the API plugins and code blocks returned an error.

An overview of the NLP testing area in Chatlayer.ai

10 — Optimising

Internal testing will already give you a lot of insight on how to improve your bot, but its your real users that you want to hear from. So after publishing your bot, make sure to keep monitoring its performance. Monitor the conversations, collect data, create logs, analyse the data, and keep improving the bot for an even better experience.

Phew, you made it till the end! Now it’s time for you to build your own chatbot. 🤖 If you need help getting started on chatlayer.ai, I recommend you watch our platform tutorial series on Youtube:

Hi there, I’m Tess, language lover and taco enthusiast! Currently Conversation Design Lead at Chatlayer by Sinch, I like to write about the things I learn when building voice and chatbots.

Interested in knowing more about conversation design? Follow me on Medium or head over to Twitter (warning: I love a good GIF and I’m not afraid to tweet them!)

Enjoyed this article? Please leave some 👏

--

--

Tess Tettelin

Conversation Design Lead at Sinch. Writing about technology, human behaviour and anything else that crosses my mind.