Guide to Creating A Chatbot

Nirali Shah
6 min readMar 15, 2018

--

Photo Credit: WordStream

What are chatbots?
Chatbots are computer programs that help with automated, repetitive tasks. They can assist with everything from checking the weather, getting news updates, ordering food, making travel arrangements, answering general customer service questions, and so much more. Chatbots make sense of our complex requests, learn our personalities, and iterate to become more intelligent over time. And all of this is done via text with the help of natural language processing and artificial intelligence.

Why are they relevant?
Say you’re looking to make dinner reservations for tonight — the process may look something like this:

1. Pull out your phone and go to the Open Table App to search for available restaurants and check the available time slots

2. You might cross-reference that short list with the Yelp App to see the ratings, reviews, and pictures to help make your decision

3. Switch back to Open Table and make the reservation

4. Open Google Maps to see how far away the restaurant is

5. You decide it’s too far to walk, so you open Uber to call a car to take you to dinner.

With the future of bots, instead of downloading and utilizing all these different apps, this small task will be managed seamlessly with one message to your chatbot.

What does this means for the future?
We spend over five hours a day looking at our smart phones. There’s been a shift in how we spend time on our phones. Currently, at least 65% of that time is spent communicating via texts, emails, social media, etc. Messaging platforms have become more popular than social networks and other apps, with over five million monthly active users. Meaning, if you’re trying to reach consumers where they are, you need to get within these messaging platforms. And chatbots have become increasingly popular on these platforms, including Facebook Messenger, Slack, WhatsApp, and Skype. For the first time ever, with the help of chatbots, you can now video chat with your friend, make appointments, call an Uber, order takeout, and check-in to your flight all without leaving your messaging app.

Could I build a chat bot?
With all the capabilities that chatbots provide, it might sound like building a bot is a little intimidating, but it’s actually pretty simple. Here are the steps for you to build a bot:

1. Define purpose: Chatbots are built to carry out very specific tasks. Define the purpose of your chatbot — what problem is it going to solve?

2. Decide on a platform: After you’ve figured out its purpose, decide which platform (Facebook Messenger, Skype, Slack, etc) it’ll live on to interact with its users.

3. Decide on which resources you want to utilize: Do you want to go the readymade route or build your bot from scratch? Readymade bots are easy to create and integrate into a platform, though they come with more limited features. They’re great if you’re looking for a simple solution without wanting to code. If you’re looking for something more customizable, building from scratch is the way to go. If you do decide to build from scratch, set up your server and determine which service(s) to utilize to build your bot.

4. Build your conversation tree: Creating and evolving the conversation tree is the most complicated step in the process. Determine what information you’re looking for from the user and in what order. Start by asking about the most important variable first. Follow up with additional questions and option buttons to get the context needed from the user.

5. Test your bot for kinks and errors

6. Release your bot into the wild for use!

What are the challenges?
The biggest challenge with building a bot is the conversation piece. Dialect and speech can vary depending on region, industry, age, socioeconomic background, politics, current events, pop culture, mood, weather, and much more. Training a chatbot to understand everything the user is saying requires a lot of effort. The current AI technology is in its infancy, though there has been progress in the last couple years.

My experience building bots
When building my first bot, I did plenty of research. There are a lot of great resources to help you get started and help you figure out exactly how to create and implement a great chatbot. See below for a few resources to help you get started! My project, Kaibot, was created to assist in ordering ice cream. I utilized the IBM Watson Conversation API, Twilio, Express, and redis. The interaction would begin with a text from the customer to my Twilio number. The message was forwarded to the Express server to be parsed and forwarded to IBM Watson. Within the Conversation API, I had created a conversation tree where the bot would ask if you’d like a cup or cone, which flavor of ice cream you’d like, let you know if your selection was a viable option, and what toppings, if any, you’d like to include all via text. I utilized redis to cache the key responses (ex: “cup”, “chocolate”, “sprinkles”) and at the end of the interaction, KaiBot would repeat your full order and decide it was better if he kept the ice cream creation for himself and ghosted you instead.

Photo Credit: Twilio

The conversation tree was the most intensive part of the project as the bot needed to account for all kinds of responses, retain key information, and was able to learn from it’s mistakes. Within a few days I was able to release KaiBot for my friends and family to try and they all got a kick out of him. Overall, it was a really fun project to learn how to utilize new technologies for the first time (IBM Watson, Twilio, and redis), and create a fun and entertaining chatbot.

Meet KaiBot

Ready to create your own bot? Here are some great resources to help you get started:

Examples of chat bots:
· Botlist.co, an app store for bots
· Insomnobot3000
· Endurance bot
· MedWhat
· Allo

Popular resources for readymade chatbots:
· Chatfuel
· Beep Boop
· ChattyPeople
· Botsify
· Smooch.io

Resources for building your bot from scratch:
· I built a chatbot in 2 hours and this is what I learned by Shival Gupta
· The Secret To Building Your Own Facebook Chat Bot In Less Than 15 Minutes by Jerry Wang
· Sketch UI Kit For Messenger Bots by Mockuuups
· Botkit.ai: Building Blocks for Building Bots
· Create a bot of yourself with Watson by Adam Benvie
· How To: Build a Santa Bot with Twilio Studio by Donnie Wang

Platform documentation:
· Facebook Messenger
· How To Build Bots For Facebook Messenger by Facebook
· Go Library for Facebook Messenger Bots by Harrison Shoebridge
· Slack
· Slackbot Tutorial by Michi Kono
· Discord
· Telegram
· Kik

Other Resources:
· The Complete Beginners Guide to Chatbots by Matt Schlicht
· How Bots Will Completely Kill Websites and Mobiles Apps by Matt Schlicht
· What is a Chatbot and How to Use It for Your Business by Anadea
· What are bots? by Jim Martin

--

--