Say Hello to Robot Haikubot!

The best automated Twitter account on the planet.

Last week my project team made something I’m particularly proud of: Robot Haikubot! 

Robot Haikubot combined our interests in poetry, data aggregation, sentiment analysis, automation, and social interaction into a Twitter bot that was fun to make and is even more fun to use.

I am a robot
Created by students at
Alchemy Code Lab

What It Does

Robot Haikubot will tweet you a randomly-generated haiku when you tweet at it; e.g., “Hey @RobotHaikubot, you up?”

You can also include either a #positive#negative, or #neutral hashtag in your tweet and get back a haiku with that sentiment; e.g., “Hey @RobotHaikubot, I would love a #positive haiku please!”.

Finally, you can add to our database of five-syllable and seven-syllable lines by adding the hashtag #five or #seven to your line; e.g., “@RobotHaikubot #five Get me a glass, please”. And don’t worry about adding erroneous lines to the db. Robot Haikubot uses syllable counting to validate if a line being added has five or seven syllables. If it doesn’t, the line won’t be added — no harm, no foul!

How It’s Built

Robot Haikubot is built using Node.js, MongoDB, and Express for data management and manipulation and the Twit, Sentiment, and Syllable npm packages for accessing the Twitter API and checking syllable count and sentiment. We deployed the final app to Heroku.

For syllable counting, we wrote a function using the Syllable npm package and imported that into a syllable-count middleware that validates the syllables in a line and sends the request to the correct route if valid or an error message if not.

For sentiment, we wrote a function using the Sentiment npm package that maps through a valid five or seven line and assigns a composite sentiment score to the instance of that line model before storing it in the database. This allowed us to take sentiment-specific get requests from the user when asking for a haiku.

Finally, the Twit npm package allowed us to open a stream from our bot account and listen for tweet events that mention our bot’s name and then tweet a haiku to the user making that request.

(Fun fact: don’t tweet your bot’s name from the account you have programmed to listen for that name and reply to unless you want an infinite loop of your bot listening for and tweeting to itself!)

Make Requests via Postman

Want to interact with Robot Haikubot but don’t have a Twitter account? You can make requests directly to the API via Postman by getting from and posting to these routes:

Contribute to Robot Haikubot!

My team did a ton of work to get Robot Haikubot up and running last week but there are still a handful of stretch goals we didn’t get to that we’d love some help with! If you’re comfortable with Node, MongoDB, Express, Mongoose, or just want to play around with our code, grab one of the open tickets here and have a go! For testing, you will need to include a .env file in your root and populate it with your version of the following keys:

 //credentials for accessing and authenticating mongodb

 //twitter credentials//
 //base url for routes/twit API//
 //admin credentials for authenticating fives and sevens//

Finally, don’t forget to follow my brilliant project partners on Twitter:

Thank you for reading.
Now, log on to Twitter and
have fun with our bot!

Let’s Catch-Up!

Absence makes the blog grow fonder.

Well hello there stranger! It’s been a minute, hasn’t it? Apologies for not posting anything the past SIX WEEKS (eep!), but Bootcamp II was a rush, then I went to New York for spring break (pics below!), then we started Career Track. I know you’re eager to read all about my progress over the past month-and-a-half, so without any more fuss or delay, here’s…

What I learned the Past Six Weeks: A Brief Recap

  • Week 7: APIs and serverless data storage
    • This week involved learning how to fetch data from third-party APIs, sort, filter, and paginate the results, and use Firebase to authenticate and save users. The main project I made this week was a Candidate Tracker that allows users to up-vote their favorite Democratic 2020 primary candidates during debates. GitHub repo here, deployed site here.
  • Week 8: Final Project Week (see Code In Action, below)
    • My team’s final project for Bootcamp II was a gif-based translation and guessing game using the Giphy API. See below for a more detailed description and a link to the deployed site.
  • Week 9: Spring Break: I went to NYC!
    • This was my first time in New York and I had a blast. I went to the Met, saw Sleep No More, hung out in Central Park, sang karaoke at Stonewall, bookstore-hopped in Brooklyn, and got pizza at 3 AM. Scroll to the bottom for some highlight pics.
  • Week 10: Node Fundamentals: Backend Stuff, Binary, Buffers
    • The first few weeks of Career Track really kicked my ass. This is the first time I’ve worked on the backend and I found it very hard to pick up the concepts. This week we were introduced to Node.js, binary, buffers, bitmaps (the hardest fucking thing I’ve ever tried to learn), destructuring, arrow functions, callbacks and asynchronous code, creating a local database, using Jest to test in the terminal, and installing project dependencies. It was a lot to come back to after a week in New York.
  • Week 11: Server Fundamentals Using Node
    • The second week of Career Track was as hard as the first, if not more so. This week we got into creating our first Node servers, learned about promises, (attempted) to make a chat app, started pinging APIs from the backend, started working with Express, learned about middleware, learned about Big O, and had to write our own functions that performed the same actions as .pop() and .push() without using any existing array or string methods, only loops and indexes. Oy.
  • Week 12: Express and MongoDB
    • Last week was a little easier, mostly because we started using Express and Mongoose to help with server creation and middleware. We also were introduced to MongoDB and Postman and deployed our first apps to Heroku! It was a week of bringing vague backend concepts out of the shadows and seeing how they work together in a much more user-focused way.

Code In Action

My final project for Bootcamp II is my favorite thing I’ve made in the course to-date. I really enjoyed my team, we kept on pace for the entire week, we worked through issues calmly when we were starting to get irritated with the project and each other, and we finished in time to add in a couple nice-to-haves to the final product. Check it out:

Talk Giphy to Me
GitHub Repo here | Live Site Here

  • What it is: A web app that uses the Giphy API to allow users to translate a message into a series of gifs, play a hangman-style guessing game based on a random gif, and save their favorite gifs to a page for later viewing.
  • What it demonstrates: Fetching from a third-party API, promises and asynchronous programming, pagination, sorting and filtering of data.
  • My main takeaways: I learned a lot about asynchronous functions, array methods, the order and placement of event listeners, different ways to manipulate the Firebase database, and how not to go about styling a group project (pro-tip: don’t do it as a group!). I also got a lot more comfortable with Flexbox and learned about the CSS ‘Computed’ inspection tool in Chrome. 

Closing Thoughts

I know I mentioned this in the last post, but future posts will stray from the Week-In-Review format. I’ve got two alternate format posts in the cooker already: one on how to deal with burnout, and the other on how to hash a new user’s password using virtuals and hooks in Mongoose. You can barely stand the wait!

Also, earlier I promised some pics from my trip to New York, so here ya go.

Until next week friends, here codes nothing!

Feature Photo by Official on Unsplash