Chat With Howard

app screenshot

In the beginning...

...there was howardchicken.com, a website built by a fan of a podcast. It features quotes and other non-sequiturs from the Back 2 Work podcast.

I took the JSON data from that site and stuffed it into a MongoDB database, mostly as a learning experience. Then I wrote a back-end with Node/Express & GraphQL to serve up quotes in various ways. Thus, a basic API for fetching Howard Chicken quotes.

(Along the way I also wrote a very rudimentary quasi-Markov chain generator. It's primitive but still delivers a chuckle every now and then.)

The creator of the original website is in a Slack group with me, so my first use of the API was to build a slackbot that sometimes interrupts human conversations with potentially-relevant quotes from the show. It also responds directly when it hears its name being invoked. The bot has a handful of controls (via 'slash-command'), to start and stop, and change its frequency or likelihood of responding. It's also hard-coded to return quasi-Markov results, in our #debug channel.

But wait, there's more

It's no fun to have a toy that only works in one Slack instance. I wanted to be able to test the API and show it to a few more people, so I built a somewhat quick-n-dirty web app in React, effectively giving the API a front-end. It resembles a chat window, but it's really just sending text to the API and displaying whatever comes out, at random.

...and then I ran across the SpeechSynthesis API in modern browsers, so it suddenly was really important to get Howard Chicken to speak. (We've come to the conclusion that the fairly-common `Daniel` voice works best for Howard. Very posh.) I'm excited to see that the original creator worked SpeechSynthesis back into the original website, too!

Just for the heck of it, I also implemented an authenticated route on the Chat With Howard site. Those of us in the Slack are able to create scheduled appearances by Howard. (It's just a simple front-end implementing cron jobs on the server). So Howard simply pipes up, a couple of times a week.

Since I didn't want the database to get stale, an authenticated user can also use the website to kick off an Update Database process. That function grabs the latest JSON data from the original website and adds to the DB any new quotes that have been added to the site. It also deprecates any existing quotes that might have been removed (usually because a typo has been fixed. The wrong one is deprecated, the fixed one is added).

It's online here.

In summary...

MongoDB basics, Slack bot-writing, Node, GraphQL, weird recursive string functions, SpeechSynthesis API, OAuth authentication, and seriously old-school cron stuff.

I sorta learned a lot, here!

(UPDATE: It's also a back-end Wordpress plugin, now.)