Beginner's guide to creating an empathetic chatbot
Lisa Jung
Posted on July 10, 2020
"I am sorry, I didn't catch that. Please try again."
There is nothing more frustrating than talking to a chatbot that does not know how to help you. You find yourself repeating "let me talk to a human" multiple times before you get so frustrated that you leave the conversation.
Unfortunately, frustrations caused by chatbots happen too often and it could forever ruin customers' sentiment towards your brand.
If only we could build a chatbot to detect customers' negative emotions so we can take right measures to help the them...
Wait.. we can!
Dialogflow is a natural language processing platform used to build conversational user interface like chatbots.
With Dialogflow, you can give unique personality to your chatbot and analyze emotional tone of customers based on the words that they use.
By end of this blog, you will be able to:
- create an agent and intent
- perform sentiment analysis
Let's get to it!
STEP 1: Sign into [Dialogflow] with your Google account (https://dialogflow.cloud.google.com/#/login) then choose the standard edition(free).
STEP 2: Create an agent
Agent is a virtual agent that handles conversations with your end-users.
In the upper left corner of your console, click on create new agent.
Follow the red arrows to complete the following steps.
- Name your bot to SentimentBot
- Choose the default language of your choice
- Choose your time zone
- Click on create button
This process will create a new agent and a new Google project. You will see the following displayed in your browser.
STEP 3: Train the intent with example phrases for what customers will say
Intent is customers' motive for talking to a chatbot. For example, when customers say "I want headphones", their intent is most likely that they want to browse headphone selections.
We can train a chatbot to recognize customer's intent by providing variations of typical phrases a customer will say.
Click on the plus sign (red arrow 1) then click on add training phrase (red arrow 2).
In the image below, there is a section highlighted with a red arrow. Name the intent "refund policy".
Then, provide variations of phrases that a customer will say to learn about the refund policy(highlighted with red line).
Some of the phrases could be:
- "How much time do I have until I can return an item"?
- "Can I still get a refund after 30 days?
- "What is the refund policy?"
STEP 4: Train your chatbot with relevant responses for specific intent
Our chatbot would be useless if it recognized customers' intent but had no idea how to respond!
Let's train the chatbot with some of the responses we want it to say to our customers.
Scroll down to responses and click on ADD RESPONSE.
In the image below, there is a section highlighted with a red box. Add variations of responses that you would like your chatbot to display to the customer.
Some of the responses could be...
We have a 30 day return policy. All items returned in its original packaging with approved reasons for return will be given a full refund within 14 days.
Thanks for asking! As long as items are returned in its original packaging with approved reasons for return, we will give you a refund within 14 days. Make sure that your request is within 30 days of purchase.
Great question! As long as items are returned within 30 days in its original packaging with approved reasons for return, refund will be issued within 14 days.
Once you have added your sample responses, click save.
STEP 4: Test it out!
In the image below, look at the box highlighted in red. In the region highlighted with red arrow, copy and paste one of the customer example phrases you have trained your chatbot with.
You will see that our chatbot is responding exactly the way we trained it to do!
You can create as many intent and responses to fit your use case.
Now, let's move on to sentiment analysis!
STEP 5: Add sentiment analysis to your chatbot
To add sentiment analysis functionality to your chatbot, you need to upgrade to Enterprise Edition Essentials.
At first, I felt weary about upgrading to a paid version. But the cost is very low($0.002 cents/text request) so I thought it was worth trying out!
Once you upgrade, you will see that your plan has been changed to Enterprise Essentials, Pay as You Go plan.
Click on settings button next to SentimentBot
Click on Advanced tab(arrow #1) then enable sentiment analysis(arrow #2) then save(arrow #3)!
STEP 6: Test sentiment analysis
In the image below, you will see a box highlighted with a red arrow. Write something positive such as "Great customer service!"
If you look at the Sentiment section highlighted with a green arrow, it will show a query score of 0.9.
Positive 1 is the highest query score in the happiness scale you can achieve. Our chatbot senses that it is doing a great job and the customer is very happy.
What if we enter a negative comment by a customer?
A query score of -0.9. Ouch! Chatbot senses that the customer is not very happy.
There you have it!Try this out and integrate Dialogflow to your app. You can then determine how you want your app to take care of an unhappy customer based on sentiment query score!
Posted on July 10, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.