Before you build your chatbot
Ask yourself, Should you even build a chatbot?
That’s a funny question to start with, but yes you should ask yourself if you even need to build a
chatbot. Chatbots are not a perfect solution to everything. If the task is very complexe, requires your
users to fill out a form or your target audience doesn’t use a chat, then perhaps you should consider
something else.
Determine your goal
Your is essentially your grand vision. It will give a direction to your project and allow you to make
decisions that are consistent when it comes to building your chatbot. It can be as simple as creating a
new
digital experience for a new generation of customers or improving operational efficiency for a
department.
Identify your audience
Your audience is the people you build your chatbot for. If you are building for a majority of men or
women,
for people of a certain age or a specific social background, there are some moving parts you’ll want to
adapt.
Define your use case
Make a list of everything your chatbot could do that would create value for the end user. It’s important
to have
a use case, something you want the chatbot to be able to do. It will be easier for you to get started if
this is
precise and small. Don’t try to solve all your problems at once. You’ll have plenty of time to add new
skills
and most importantly improve existing skills.
Craft a personality for your chatbot
This is the part where you use the information gathered from identifying your audience. You don’t always
have to
craft a personality, but you would be leaving aside a great opportunity to differentiate your
organization. Your
chatbot’s personality could crack jokes randomly, could be very formal or very casual.
Determine if the languages you need to serve your audience
This one forces you to think mid-term for your project. Perhaps you are starting only with English, but
eventually will you need other languages? Spanish and French are widely supported by various platforms,
but
languages like Arabic can be more difficult to find. Don’t get locked in a platform that can’t grow with
you.
List the channels and integrations required
If you are building a simple Q&A, it might be not be necessary, but if you want to expand the
capabilities of
your chatbot to self-service and automation of processes. You might want to connect a database to store
and
retrieve information about customers or perhaps you want to connect it with a Shopify store to fetch
order
status and allow order cancellation. It’s important to evaluate what you will need from your chatbot
platform in
order to make these integrations. Are you proficient with the programming languages proposed by the
platform?
These are all questions to think of.
Figure out the tech stack (Platform vs Framework)
Now the fun part. Platform? Framework? Damn it, I’ll build it from scratch. I think in our modern world
building
it from scratch would be a mistake. There are just too many tools out there that exist to help you. You
basically need to choose between a framework or a platform. A framework will make your life easier with
a lot of
functionalities already built-in, but you will need to code. A platform on the other end will require
less
coding or even no coding at all. Depending on your needs and your skills, you should narrow down
already. There
are hundreds of frameworks and platforms out there, you just have to pick the one for you.
Establish KPIs for success
The last, but not the least. Key Performance Indicators will help you understand how your chatbot behaves
with
your end users. The tracking of these KPIs will help you improve and most importantly show the value
created by
the chatbot and your team.
Natural Language Understanding:
Building your dataset
Make a list of all the questions and intents for your project
First thing first, you need to know that you should use questions only when you can provide a
straighforward answer. Otherwise, you might want to use an intent. Intents also have the advantage of
allowing information extraction.
Make sure there are no duplication or overlap between the different questions
This is very important to avoid creating confusion in your NLP model. You can avoid duplication easily
with a simple spreadsheet where you check for duplicate. The overlap is a bit more difficult because
it's subject to interpretation by the person doing the dataset.
Don’t add more than 200 questions to start with
200 seems like a big number, but for some organization FAQs add on pretty fast. Limiting yourself to 200
will allow you to better manager the previous guidelines and will provide you with speed of delivery.
Determine a naming convention for your intents.
Aim for consistency and low ambiguity. You can create a naming convention custom to your need, but here's
a proposition
- QnA: qna_[topic]_[attribute] ex: qna_library_location
- Intent: intent_[verb]_[noun] ex: intent_book_flight
- Provide information / slot filling: provide_[context]_[slots] ex: provide_ein_credentials
- Affirm something, like a choice or a fact: affirm_[group] ex: affirm_yes_no
This will make your life easier when searching as your chatbot and your dataset gets bigger and more
complicated.
Determine what you need to extract from each intent. (entities and slots)
The really cool thing with AI chatbot is that you can extract information from the users input. This will
allow you to save that information for later or use it to complete an action.
- Entities are information that is extracted either because it's a built-in entities or because you've
created entities to extract from a list or regular expression. Those are useful for short list or
pattern you can express in the form of a regEx.
- Slots are tagged in your intent at the creation. It's best to use slots when you have a dynamic list
or a very long list of items. By tagging your slots in your intents, you will allow your NLP model
to train itself to extract them.
Create enough utterances for each question and intent
How much is enough right? Best case scenario would start with at least 10 utterances (examples /
variations) per QnA or intent. This should give the NLP engine enough data to build a good model. Your
first try won't be perfect so focus on improvement after your first draft.
Avoid duplication of utterances within and across questions
I know we said that already, but this one is different. Earlier we said, no duplicate for questions and
intents. Now, it's about the utterances. Make sure you don't have the same utterances in two different
questions or more. This will confuse the model.
Use synonyms in your utterances
Using synonyms will make your model stronger and more resilient. Because not everyone uses the same words
to describe actions or things, using synonyms will help cover a broader ranger of conversations.
Use various different sentence structures
Similar to the aforementioned guideline, move the subject and the verbs around in the questions or
sentences. Try using different interogative words.
Create a Mix of keyword-only, natural language and fluff utterances.
Example: “Reset password” and “I want to reset my password” and “Can you please help me to reset my
password for my emails”
Never make a dataset based on natural language generation
Some people think they will save a massive amount of time by leveraging NLG to make their dataset, but in
fact they are shooting themselves in the foot. Your dataset will make or break the performance of your
chatbot so it shouldn't be taken with a grain of salt. NLG will not create the quality of data you need.
Avoid spelling and grammar mistakes
You just don't need to bother yourself with that. Most engine will take that into account by themselves
when the training is done.
Mix abbreviations with written-out concepts in utterances.
At this point, it's almost like we are repeating ourselves, but make sure to use the different
abbreviation and lingo of your domain. Example: “I have a problem with a po” and
“Purchase order issue”
Create your utterances with slots fully filled, partially filled and empty
You want to prepare your chatbot to handle the different situation because it would be silly to believe
that the end-user will always provide all the information you need from the get-go. Make sure your have
intent with fully filled slots, partially filled slots and empty.
Vary the positions of your slots in your utterances
If you don't do this, you will end up with an AI model who will recognize the position of the words in a
sentence and will extract based on this variable. By swithcing around the slots, you make sure the
chatbot will get an accurate understanding of what to extract.
Add at least 5 more utterances by slot
Simply put, 3 slots is 15 utterances minimum plus the 10 utterances per intent for a grand total of 25
utterances minimum. I suggest going even higher than that, the upper end would be something around 50.
No more than 3 slots per intent
The more slots you add to your intent, the more difficult it gets to train and maintain accuracy.
Conversational Design:
Making people love your chatbot
Give the user the shortest path to resolution.
Avoid making covnersational detour. Always provide the users with the shortest route to their
destination. How can you help them get there in fewer steps?
Keep in mind the limitations of the channel you are using
Chatbots can be accessible on a wide variety of channel, but they might support different components and
they might have a context that needs to be taken into account. For example, a chatbot embedded on your
pricing page versus a chatbot on Facebook will get very different messages.
Craft messages that fits with your chatbot personality and company brand
Building a chatbot with a personality that is consistent with your brand can make a big difference on the
experience users will have. If you usually have a friendly approach, building a chatbot with a very
professional language can feel weird.
Use native rich elements to enhance the user experience
Some of the channels have components you can leverage for better experience. Rich Elements such as
carousel and cards can be useful to display certain type of information. Use them when appropriate to
make it more interesting for the end users.
Create a solid greeting message
Your greeting message is super important. This is the first impression and it sets expectations. It must
contains the following elements: Say hi; Mention that it is a chatbot and not a person; State the
purpose. By doing the latter, you make sure the end users undersand the capabilities of the chatbot. If
they can speak with a live agent as well, do mention it!
Don’t create an unnecessary hurdle for the user to use the chatbot
If you want to collect the email or the phone number of your user before they start, it's fine! However,
it shouldn't block from using it. These hurdles are not only bad for the experience, but they also
reduce adoption for a solution you spent time building.
One sentence per message
It's a chat, so don't write email format. In fact, if it's longer than a tweet (240 characters) it
shouldn't be a message. Perhaps they should be sent to a page or in most cases it can be simpler.
Guide your users through the conversation
There should never be a blank cursor moment (where the user has to think what to do next), always try
to guide the user to the next step. The chatbot can ask if it can help with something else for example.
Map out the possible outcomes
There are three possible outcomes to the chatbot saying something: User answers correctly, user asks for
more info or user cancels. Knowing that, you should preparer for each case.
Anticipate potential clarifications and act accordingly
You can't possibly think of everything, but at least prepare a few. As you learn more, you will be able
to add things that you didn't think of when you started.
Always confirm with the user when the action requested have consequences
It would be very annoying if Microsoft Word didn't ask to save your changes before you quit the app. Well
kind of the same thing here. If the action the user is about to take have ireversible consequences, you
should ask for confirmation. Are you sure you want to quit without saving?
Always create an option for action failure
Sometimes it fails. You need to make an API call, the request times out. Let the user know something
happened and that you will need to try again now or later.
Create a feedback loop to help improve your chatbot
Create a feedback loop in your chatbot to measure if the conversation is helpful for the user. You can do
this by asking the question simply or some platform have a built-in system for that.
Prepare a fallback when your chatbot fails.
You probably know your chatbot won't be doing the job 100% of the time. How will you handle those
situation to avoid frustration among the users? You can use a live chat system to take over the chat
session when the chatbot isn't capable of helping anymore. You could also use the chatbot to send an
email and notify the users that someone will get back to them.
Use context to drive the conversation
For example, the chatbot can use information from the user’s interaction with a website. If the user has
visited the pricing page, you might want to ask if they have questions about pricing.
Make sure the chatbot leverages interaction data and human agent data to become smarter.
Some platform will have a built-in system for this. If that's not the case, you should find a way to
leverage this to imrpove your chatbot. You can use the conversation data to understand what topics your
chatbot is not covering or if there are existing topics that it doesn't understand very well.