Death is Certain Bot

Posted: Reading Time:
Just as manure fertilizes the plants and so on, so as the contemplation of death, and the acceptance of death Is very highly generative of creative life. You get wonderful things out of that.

In one of our daily standups, my old colleague and good friend, Michael was having a pretty bad morning. I think he had a crappy commute and the feature that he was working on was taking longer than he expected. Instead of being miserable during his turn giving updates, he typed "Death is certain" in giant letters on his laptop screen, turned his laptop around, and gave the rest of the team a big smile.

At the end of the day, no one is dying on the proverbial table for most of the software we write. I wanted to build a project that played with that moment Michael created. I had the idea to overlay really depressing, nihilistic, and philosophical quotes over cute emails, and tweet them out every couple hours. I had two problems: I didn't have a library of depressing quotes or a library of cute animals.

Depressing Quotes 

Another team member who was in our standup circle that morning was our digital producer, Jenny Villone (she's an amazing photographer!). I was telling her about my ambitions to build a bot like this, and she immediately jumped in to help. She's an avid philosophy reader and already had a catalog of these quotes in her back pocket.

I set her up with a Github account, showed her standard JSON and how structured data worked, and how to commit her changes. She took to it like a git pro and pushed commits up to the main repo in order to add more responses.

Cute Animals

In order to get my hands on as many cute animal pics as possible, I signed up for the Flickr API. I set it up to query Flickr for photos that are royalty-free, and tagged with our cute animals of choice: [puppies, kittens, etc].

Once I have that image, I used ImageMagic on my server to convert the image to black and white, as well as resize it to a size that's appropriate the web. I then find a random response from the JSON file I mentioned earlier, pull down the quote and its attribution, and overlay those on top of the image. Once the image is finally constructed, I send it off to Twitter as a JPEG.

Fun fact: the code for Certain Death Bot is my LinkedIn cover photo, and no one has ever said a word! I'd like to add you to my professional network on LinkedIn.

Bringing It All Together

Now that I had all of the missing pieces, it's time to bring it all together. I built a node.js app that pings Flickr to grab the photo, then transplants a random quote from our depressing quote library on top of it. I also fetch the original URL of the photo to the image on Flickr. I convert the image to black and white using Imagick and then send the image and quote to Twitter.

I have a server on Digital Ocean that I use for all of my side projects. It's hooked up to Laravel Forge to make server maintenance super easy. I set up a CRON job within Forge that tells the app to run at 8am and 8pm est every day.

It was so fun getting to play with node, various APIs, and social media to create something that feels living and breathing, especially with friends. As of this writing, @CertainDeathBot has tweeted over 1,3000 times. While it doesn't have that many followers, it's still fun to scroll through my timeline and see my humble little bot posting regularly.

One more fun fact: My user portrait on twitter was designed by the one and only Kyle Mitchell.

Do you have an idea or need help with a chatbot? I'd love to help out. Can't wait to hear from ya!

Go to the Home Page

Hey there,

I’m a creative designer, developer, and leader obsessed with solving complex problems

Check this Nerd Out!

Go to the Resume Page

Résumé

Experience & Accolades

Over ten years and going strong

Go to the About Page

About Me

Bios & Photos

A story to rival the Star Wars universe

Go to the Professional Work Page

Pro Work

Case Studies

Go to the Blog Page

Writing

Articles

Latest:

Go to the Contact Page

Contact

Social & Contact Form

Slide into my DMs :)

Go to the Non-Profit Work Page

Non-Profit Work

Case Studies

Go to the Activity Page

Activity

Updates

Latest:

Go to the For-Fun Page

For Fun

Case Studies