We have wanted to make a Twitter bot for a while now, so we finally decided to do it at this year's BostonHacks! We always end up making something funny/silly at hackathons and this seemed like a great way to start.

What it does

This bot randomly generates a tweet once every specific interval of time (we set it to once every 4 hours for now but it can be as frequent as every 5 minutes). The tweets consist of a random sentence structure and random words that we wrote to fill in the blanks of the sentences.

How I built it

We built this using javascript and a platform called Glitch. We used Uptime robot to schedule HTTP requests every 4 hours which triggers Glitch to send a tweet to a new account that we created. Our javascript file uses a randomizer to first choose a sentence structure from the different options that we wrote, and then completes the sentence with word variables. We have lists of different types of words (ex. a list of foods, a list of adjectives, a list of amounts, etc.) to help fill in the blanks with words that will make a syntactically correct sentence, but that might not be semantically correct.

Challenges I ran into

We have never used Glitch before, so we had to figure that out from scratch. We also were unsure of how to configure the private keys that we got from our Twitter developer account so that it could actually tweet on its own. Figuring out how to format the json structure in our sentence file to actually create the sentences was also pretty tricky. After sending about 20 test tweets that were pulling the wrong variables and not what we were looking for, we were able to fix our issues.

Accomplishments that I'm proud of

We made a working Twitter bot that is automated with Uptime Robot, meaning we do not have to manually send HTTP requests in order to send tweets.

What I learned

We learned how to make a Twitter bot!

What's next for EatThisBot

We would like to add a feature that allows Twitter users to tweet at the bot and it will tweet a response back .

Share this project: