Hey folks,
Sorry I haven’t had very much time to post. I wrote my first Twitter bot during a weeklong exploratory project during our break from class. I was inspired to check out bots after attending Liz Uselton’s *.rb talk, Build Your Own Friends: Fun Times With Twitterbots.
Here are some key takeaways from my twitter bot experience. You can check it out @CoinForTechConf. And you can find my GitHub repo for it here.
Trying out cron
Getting cron to understand the environment you need for a rake task can be extremely frustrating. I kept breaking and repairing and researching crontab throughout the project. This article, Using RVM with Cron, was very illuminating. I still ended up breaking my cron task during my latest development change, so I’ll need to play with it more. I did learn a ton about how cron executes shell scripts and sends you mail whenever something doesn’t work out. On the flip side, getting Heroku Scheduler set up was very straightforward – I typed in my rake command, and my bot was alive. Aliiiive!
Trying out new gems
After my bot started retweeting mentions of tech conference scholarships, I noticed that I was getting a ton of duplicate posts. Like when you visit a news article and click their little “Tweet” button and it aut0-populates the text field with the same titles, taglines, and links. I didn’t want to spam followers every time the same scholarship info was posted. I used the similar_text gem to quickly identify and kick out tweets that had an 80% or higher similarity to another tweet being posted. Was installing this lazy? Probably. But I wanted to spend more of my project time exploring Twitter’s API, researching automation, and thinking about my bot options.
Use case considerations
So after creating a search filter for my bot, I realized that it wasn’t posting very frequently. That’s because it’s waiting for fresh, new mentions of tech conference funding. It’s not gonna just dig through the archives and return something weeks old. I was thinking “quality over quantity.” Unfortunately, this isn’t how most of us use twitter. I would imagine that frequency of tweets is usually how folks discover things like scholarships. If someone tweets more often, you’re more likely to stumble across their post in your newsfeed stew.
To address this, I might want @CoinForTechConf to build its own tweet reminders, rephrasing info from the most recently posted tech conference. These reminder posts will continue for X days. This could help fill in the gaps during slow seasons.