paint-brush
Building Silicon Valley’s Hot Dog App in One Nightby@Kirksey
2,232 reads
2,232 reads

Building Silicon Valley’s Hot Dog App in One Night

by Caleb KirkseyMay 17th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

After watching the latest episode of HBO’s <a href="https://hackernoon.com/tagged/silicon%20valley" target="_blank">Silicon Valley</a> and seeing the <a href="https://www.theverge.com/tldr/2017/5/14/15639784/hbo-silicon-valley-not-hotdog-app-download" target="_blank">Not Hotdog</a> iOS app that was built, I wanted to see if I could build the same thing as a Twitter bot.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Building Silicon Valley’s Hot Dog App in One Night
Caleb Kirksey HackerNoon profile picture

After watching the latest episode of HBO’s Silicon Valley and seeing the Not Hotdog iOS app that was built, I wanted to see if I could build the same thing as a Twitter bot.

First, I forked @BryanEBraun’s awesome open source, Node Twitter bot. It was set up to retweet everything from a specific list. My first task was setting it up to auto-reply to tweets that mentioned my bot, IsItAHotdog. First I started listening to any tweets with my handle using Twitter’s streaming API and the tuiter NPM package








function listen() {tu.filter({track: 'isitahotdog'}, function(stream) {console.log("listening to stream");stream.on('tweet', onTweet);});}

Then I only reply to the ones that have images

if(tweet.entities.hasOwnProperty('media') && tweet.entities.media.length > 0)

Finally, I use tuiter to tweet out a reply




tu.update({status: "@" + tweet.user.screen_name + message,in_reply_to_status_id: tweet.id_str}, onReTweet);

Next I needed to make the actual classification. Originally I was going to collect images and train a Keras CNN, but I decided to get something running with AWS Rekognition first. I’d still like to return to this and train my own net.

Using Rekognition was really simple. I just downloaded the image from Twitter onto my server, passed the bytes to Rekognition through the AWS Node SDK, and then got classification results.

rekognition.detectLabels(params, function(err, data) {

It was able to label images with hot dogs in them very consistently. Once I threw in some logic to tweet the correct message, I had everything working. I threw my bot on Heroku and started sharing it around. Here are some sample tweets:

It’s really crazy how quickly you can build something like this with all of the great open source tools and web services available. Try tweeting something at it yourself! Also, check out the rest of my code here.