Lately, I’ve been looking for ways to boost my following on social media, so I could market my content more directly to the community. In an effort to do that, I almost built a Twitter bot.
Table of Contents
As a bit of background, I’ve been struggling to build up a community for quite some time. Besides my wife, I don’t really have anyone helping me push The Renegade Coder, and naturally that’s resulted in some very slow growth outside of search engines traffic.
Over time, I’ve slowly grown my mailing list which sits humbly at about 50 email addresses at the moment. And ever since moving to Patreon, I haven’t really been able to sustain any sort of membership. On top of all that, I have a hard time maintaining support on my open-source projects as well.
So, what gives? How do I go about growing my following? After all, I always thought: if you build it, they will come. Well at this point, I have over 250 articles written, so there’s plenty for people to read. And sure, I’m getting plenty of organic traffic. The trouble is I’m not maintaining any sort of following.
Well, apparently that struggle is becoming obvious to some of my Twitter followers as one of them even reached out to give me some advice. In particular, they shared with me the following video in hopes of helping me grow my following:
And suddenly, I was on my way to writing a Twitter bot.
If you don’t have time to watch the whole video, here’s essentially the idea: liking tweets will you get you followers, so why not automate the liking process?
To be honest, I didn’t watch the whole video, but I got the gist. Basically, the YouTuber wrote some Python script to act as a person physically clicking through Twitter and liking tweets.
My understanding is that you would have to load open a page of Tweets in your browser and then let the bot take over. In other words, it would traverse the DOM and perform the liking action on all the tweet in view. Then, it would refresh the page and repeat the process.
To me, that seemed like a bit of overkill. I don’t know a ton about Twitter or its API, but I just knew there had to be a better way. So, I stopped watching the video and tried to do it myself.
Tweepy and The Twitter API
As it turns out, Twitter has an API which can be used to perform all those actions without having to write some complicated program to simulate a person. Instead, the API allows you to log in with some credentials and perform search queries to retrieve a set of tweets which can be interacted with.
To make matters even easier, there’s a Python library that wraps the Twitter API called Tweepy. With this library, you can quite literally log in to Twitter, search for tweets by some keyword, and like all of those tweets in less than ten lines of code.
To do that, however, you need to generate special credentials through the Twitter API. And to do that, you have to create a Developer account which ties you to those credentials.
After going through the process of creating a Developer account and almost creating my first set of credentials, I stumbled upon a link to Twitter’s automation rules. These rules explicitly state what you can and can’t do in terms of automation with the Twitter API.
If you scroll down to the bottom of that page, you’ll see a section titled “D. Automated actions you take on Tweets or accounts.” And in this section, you’ll find the following rule:
Automated likes: You may not like Tweets in an automated manner.
In other words, it’s against Twitter’s policy to use a bot to like Tweets.
Moral of the Story
As frustrating as it was to go through the process of setting up a Developer account just to find out I wasn’t going to be able to create my bot, I sort of have to be happy that a rule like that exists. After all, it seems like Twitter is actually trying to make their community a better place.
That said, I don’t love wasting time, so I figured I’d write this article. At least that way, it doesn’t feel like it was all for nothing.
Also, I want to shout out Jose Fon for the idea in the first place. I really appreciate this kind of community support!
Also, here are a few books relevant to social media and Twitter:
As always, I like to share relevant products with great reviews. If you think any products would make a good fit for this article, let me know!
While you’re here, check out some of my favorite articles:
- Rock Paper Scissors Using Modular Arithmetic
- The Difference Between Statements and Expressions
- How to Check if a File Exists in Python
And once again, thanks for your support. Every little bit goes a long way!
I'm embracing the virtual world and moving all of my computer science exams online. Here's why!
Amid all the chaos of my daily TODO list, I was able to find order by sorting my tasks by my values. Maybe you'll find some "value" in this tip as well.