New Project! 🎥 Export GIFs and Videos from FigmaTry it now

Chatbots are just command line interfaces

May 31, 20163 min read


Chatbots are all the craze nowdays, but did you know you already wrote one without even realizing it?

Lets lookup the definition of a chatbot:

a computer program designed to simulate conversation with human users, especially over the Internet. [as defined by Google]

Now lets look at the definition of a command line interface:

A command line interface (CLI) is a type of human-computer interface (i.e., a way for humans to interact with computers) that relies solely on textual input and output [as defined by LINFO]

Therefore chatbots are a superset of a command line interfaces. In other words a chatbot is nothing more than a glorified command-line interface with fuzzy matching and Natural Language Processing (NLP).

You have all written CLIs in the past and probably see how useful they are for us programmers. However, most people don’t use them. That is until now! Thanks to chatbots we can bring CLIs to mainstream users, you know the regular folks we build apps for.

Now why does this matter? Because as soon as you realize that, you will understand why they are the future and you should write one for your product.

If you are still not convinced lets take a look at recent high-tech trends. Google, Apple and Amazon all create their own speech-to-text smart assistants. These too are chatbots, input is converted into text an output is formatted as text and converted to sound. With the release of the Google Home and Amazon Echo, it is clear we will have an always-on voice command system (Ok Google and Alexa) that will soon be able to control any device and functionality just by using our voice. For that to work the app developers will need to create a set of text-based rules exposed by their apps.

For example “Ok google, play me something upbeat” will bring an upbeat song on spotify as long as spotify implements the proper hooks provided by the Google Home API.

All the slack integration we are seeing now can then also be used to do something like

Ok google, ask slackbot to file a new github issue “cannot close about window” >>> Slackbot says: Actually, there is already an issue for that. Would you like to take a look at it before we create a new one? >> Lets do it. >>> Ok, John Cambell created an issue called “cannot close about window after login in” last Thursday. It appears to still be open and assigned to Tod Gibson. >> Ok please mark it as top priority. It must be done before tomorrow’s demo >>> Ok consider it done

Notice we intentionally leave out addressing “OK Google” and continue with a normal conversation. We enter into a slackbot specific interaction instead of the more generic context. This is similar to running a CLI in interactive mode, we do it all the time. A good example is when you SSH to a remote machine, you now get the context of the remote host. This same context switching behaviour applies to chatbots.

My point is, we already know how to build these types of applications. The heavy lifting of NLP processing and figuring out intent is all done by the big players in the space and offered to us as an API already. Why not take advantage of it now? It is the inevitable future whether you like it or not.

More articles to come as I play around with bot tools out there and try to build something useful.

© 2022 Michael Yagudaev