paint-brush
I built a chatbot in 2 hours and this is what I learnedby@shivalgupta
64,899 reads
64,899 reads

I built a chatbot in 2 hours and this is what I learned

by Shival GuptaJuly 16th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<span>We</span> spend about 5 hours on our smartphones every day as per this study from <a href="https://techcrunch.com/2017/03/03/u-s-consumers-now-spend-5-hours-per-day-on-mobile-devices/" target="_blank">Flurry</a>. Not only is this statistic surprising in its own right, <a href="https://hackernoon.com/how-much-time-do-people-spend-on-their-mobile-phones-in-2017-e5f90a0b10a6" target="_blank">about 65%</a> of this time is spent on communication related activities like social media, texting, emailing and phone calls. <strong>That’s 3 hours and 15 minutes. Every. Single. Day.</strong>

People Mentioned

Mention Thumbnail
Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - I built a chatbot in 2 hours and this is what I learned
Shival Gupta HackerNoon profile picture

Is the next paradigm shift here already?

We spend about 5 hours on our smartphones every day as per this study from Flurry. Not only is this statistic surprising in its own right, about 65% of this time is spent on communication related activities like social media, texting, emailing and phone calls. That’s 3 hours and 15 minutes. Every. Single. Day.

What it means is that the tables have turned at an angle acute. The mobile app that you were building for your kickass startup idea? It’s going to compete with millions of other apps for just 35% of the user’s daily attention. And not to forget the discovery costs associated with it.

So if you’re not going to make an app, what are you going to do? You have to setup your business, right? Most experts believe that the evolution of apps are chatbots that live inside the app. They extend the functionality of bigger platforms like Facebook or Telegram and user doesn’t need to install an extra app on their phone. Win win for both parties. Except for the developer, maybe. My personal suspicion in this play was two fold:

  • Building a bot is useless from a business perspective
  • Building bots is crazy tough from an engineering perspective.

To get to the bottom of this conundrum, I started some research. It took me around one month of passive reading, talking with experts, tinkering with toolkits, and procrastinating to finally coding a functional bot in about 2 hours. This journey is my quest to find if both my suspicions were valid and having some fun doing it.

The journey begins

Photo by Casey Fyfe on Unsplash

It is believed that often inspiration knocks the door at odd hours, so one should stay awake to invite her in.

When I started writing this article, I knew nothing about bots. I had a superficially working knowledge of AI and how supervised learning worked in general but to me NLP was just an acronym that meant Natural Language Processing. About half of the reasons why I started investigating chatbots was to learn more about the gaps I had in my knowledge of this particular play. Someone put it well —

To curb your own personal ignorance is a joy of life cherished only by the most restless of minds.

My hunt for now was to address my first assumption about the bot industry — that they don’t carry any business merit. After a little searching, I was able to find Botlist — a collection of a crazy number of bots. While browsing my only aim was to guess and rationalize the developer’s decision to choose the bot platform over the app platform to solve their problem. How did making a bot make more business sense?

I found Mitsuku, of course, which was fun to talk to. Then Dr AI seemed to be solving a good enough problem. Rightclick.io was good but bit slow for my taste. Browsing through a lot of bots, Hangman to TVakis, they seemed to be quite utilitarian in their approach. It seemed that the development is still in its infancy and the idea is yet to evolve. The good part was that I got enough ideas to implement my own chatbot seeing the problems that they were trying to solve.

At some point, I must confess, I felt like an art school undergrad roaming around the Louvre looking for inspiration. One question, however, continued to bug me.

Where is the killer app?

Photo by Jeremy Bishop on Unsplash

The bot industry is in its infancy right now and they are all competing for the same thing — to find the next killer app that makes chatbots mainstream. There are no reigning champions in the chatbot domain as of now. The whole industry is a level playing field.

I talked with a lot of people to investigate how far we really are into this future. It was an educational ride just I had imagined. Common consensus with the experts that I talked to put the timeframe to about two years to five years until we see a really killer app for the chatbot platform. The technology still in its evolution, it is safe to say that the even the best chatbots of today can grow obsolete because of newer announcements in AI and NLP research.

It means that if the right idea struck, anyone could make the potential killer app. This revelation was highly motivating. Right now, the chatbots I played with seemed to be doing quite simple things but in all essence they were just replacement for the GUI. Two things that I noticed in particular with the good ones were:

  • If performing a task took longer than 2 steps on UI, chatbots provided a much better user experience.
  • Places in the UI where the task was just a simple search and tap, chatbots seemed redundant. In summary:

Whether you write a UI or a chatbot, it doesn’t really matter. The user will come to your solution only if it saves time.

The decision to build a chatbot instead of an app does indeed carry business merit. It saves time in longer than expected UI flows. The next part of my journey was actually making a bot to see how deep the waters really go.

Grinding the bot

Photo by Namroud Gorguis on Unsplash

Building a chatbot was like solving a reasonably-sized jigsaw puzzle for me. I just had to find the right pieces and the tools needed to build it. While I had some of the puzzle at an arm's length, I was still confused on where to start. I had a checklist of two items —

  • Bot should talk like a person: meaning that it should understand natural language.
  • Bot should be able to solve a non-trivial use case: meaning that it should do something that takes more than two steps to do in UI (business merit).

Keeping these constraints in mind, I wanted to establish credibility in my mind on whether bots are hard to build or easy to build. As I am a total newbie in natural language processing, I can imagine the learning curve to be same for most of us.

After listing through some problems, I finally chose to make a chatbot that correctly calculates dates from natural language strings. For example, it would accept inputs like “What is 6 days from now?”, “Give me 5 weeks after next September” and give me the date I am looking for.

A simple architecture for such a bot would be like this:

Following this tutorial, I was able to make a intent classifier system using basic NLP and a softmax based neural net in less than 2 hours (that includes installing Tensorflow on my Windows machine). After the intent was determined, the string would be parsed for input giving me the date that I wanted. I would rather have the input date parsed and given to me by the NLP module too, but it works for now for proof of concept.

Inputting in natural language.

Results. Not a very chatty chatbot.

To be honest, it wasn’t that hard. With Facebook’s Messenger Platform and Telegram’s Bot Platform, abilities offered by api.ai, wit.ai, and recast.ai — some of us might be able to do it faster than the route I took.

It has a learning curve. Agreed. But what doesn’t?

It was a very liberating exercise to learn something methodically and then go on ahead and make a working proof of concept. I was feeling good.

Salt and Pepper

Photo by Mira Bozhko on Unsplash

Making a chatbot for my own personal use opened me to a world of possibilities. People are solving so many of their problems with clustered UI like booking travel tickets, hotels, movie tickets, ordering food, etc. The user experience can be improved by leaps and bounds by introducing a bot UI there. The newness of the platform really excites me, to be honest. It’s the age when new Facebooks and Whatsapps emerge out of darkness.

I believe in a world not far away in time, everything would be done via a conversational bot like in the movie, Her. It would be more efficient than even a single tap on your smartphone screen. I wouldn’t advise falling in love with your Samantha, though. ;)

Photo by Her (2013), Annapurna Pictures

Jokes apart, the chatbot play is definitely an emerging trend. Everyone is debating whether it would last or not. But trends don’t live or die by their own. It’s people that make or unmake them.

I believe hype is an instrument that brings obscurity into mainstream. The industry is just learning what all it can do with this relatively new tech. It’s a bet worth taking as a businessman and a skill worth learning as an engineer.

After all, the best bots are yet to be made.

Thanks for reading :) If you enjoyed it, hit that clap button below as many times as you like! It would mean a lot to me and encourage me to write more stories like this

Let’s also connect on Twitter and at my blog shivalgupta.com

A very heartfelt thanks to Gaurav Ragtah, Gaurav Singh, Niraj Pant, Nikhil Vimal, and Misbah Ashraf for their help in writing and improving this article.