Tech - Lets Chat

Instant messenger applications (like Yahoo Chat) have been around since the beginning of the web, but the web was initially bound by the desktop. With the emergence of mobile, messenger applications (like Whatsapp, Facebook Messenger etc.) have seen a explosive rise. According to recent statistics, billions of messages are shared using these applications.

While these messages are largely between humans, technology cannot be far behind. The DevOps movement in the world of IT accelerated the move towards automation. Except perhaps design and coding, a lot of activities such as testing, integration, deployment etc. are becoming automated. One of the last vestiges of manual intervention was tasks like - monitoring, troubleshooting etc. Bots were created to automate these repetitive tasks too.

Diagram using iPad App - Paper
I decided to explore this world of Chat and Bots, also called by some as ChatBot. There are a few mature frameworks that can help build this capability. Core to this concept is a Bot (or the brain that responds to commands). To complement it, one needs a chat application too.

I chose the Hubot framework by Github to power the Bot. One needs to write the commands (that the bot responds to) using JavaScript or CoffeeScript. And, the Bot is connected to a RocketChat server. So, users can type in their requests/questions/commands in RocketChat and the bot will respond to them. RocketChat is open source and the mobile versions are also already freely available.

Both Hubot and RocketChat are deployed to Heroku public cloud in the free tier. Some basic commands have been written in Hubot. Schedulers have also been setup to ensure that the free tier usage is not exceeded.

The bot has been named very unimaginatively named as "myhubot". Any user can invoke the bot by using this name. So, a sample command would look like - "myhubot stock chart msft". The bot would call the Yahoo API to get the latest stock quote for Microsoft along the recent trend chart.

Here is an example of accessing the RocketChat from a desktop to get stock quotes and weather information. Yahoo API is used for the stock quote and Open Weather Map API (1000 free calls per month) for the weather commands.

RocketChat from a Desktop

RocketChat mobile application is configured to the RocketChat server URL. The same bot commands can be now run from both desktop and mobile.


RocketChat from iPhone

All it took was a few days to pull everything together, primarily because Hubot is an easy framework to use. Cloud providers like Heroku and others provide a free tier to deploy and test the application, at least as a hobby. Lastly, RocketChat is an impressive open source chat application.

Comments

Popular posts from this blog

Meta Prompting for Success

Book Review - The Price of Being Fair

How to create a big picture