Programming for Marketers

How to Programmatically Acquire 50k+ Twitter Followers

In this lesson we’ll cover what you need to know to grow your Twitter following as organically as possible, without spending tons of hours on engagement.

In the basics we’ll cover tools to help with these things, and then in the advanced section we’ll show you how to build most of them yourself.

Let’s get started!

1. Basics – Tools and Techniques

The basics will be broken down into five sections:

  1. Setup
  2. Following people
  3. Favoriting
  4. Joining Conversations
  5. Timing

1.1 Setup

Before you do anything to try to grow your following, you need to have a Twitter account that’s worth following.

That means that when someone sees you pop up in their feed they’re interested in learning more about you and can clearly see why they should follow you.

This breaks down to three areas: Content, Bio, and Pictures.

1.1.1 Content
You have to create a unique voice on Twitter. I bet you don’t like following people who sound like robots, so you can’t sound like one either. Your word choice, the content you share, the people you retweet, it should all fit the voice of you and your Twitter account. If you like to swear, swear! Don’t feel like you have to follow any arbitrary rules about what to post aside from be yourself.

Some parts of the content to make sure you’re keeping consistent:

  • People you retweet
  • Articles you tweet
  • Quotes you tweet
  • Personal anecdotes you tweet

1.1.2 Bio
The first thing that someone will look at when you show up in their feed, on their followers list, or elsewhere is your bio. You only get 160 characters to tell the world who you are, so make them count! Don’t do a boring list like: “Entrepreneur, growth hacker, writer, marketer, lover of technology.” It sounds generic and boring.

Here’s Justin’s Twitter bio:

Co-author of Traction Book, the guide to getting startup traction. http://tractionbook.com.

It’s clear, to the point, and highlights the thing that he’s most likely going to be discussing on Twitter (since a lot of his followers came from the book). Make sure that you have a similarly clear Twitter bio that focuses on a couple of the most important things about you, while making you seem interesting and inviting.

Feel free to add a couple hashtags, but don’t over-do it. Hashtag soup is a big turn off and people will assume you’re going to spam them with articles they don’t care about.

Last, make sure that you have a location (people sometimes look for others in their area) and a URL. If you don’t have a personal site, you could put your LinkedIn or a link to your profile on a company page.

1.1.3 Pictures
Last but not least, have a nice profile picture and header that show a bit of your personality. Keep it fun, and don’t make it overly promotional. If you’re using Twitter for a company then you should have the logo and a header that represents them. Feel free to use one CTA in the header, but don’t make it sound spammy or it will turn people off.

Alright, now that you have a great Twitter account, let’s build some followers for it.

1.2 Following People

Assuming you’re not a celebrity, published author, journalist, etc. you’re not going to have a ton of exposure where people will naturally want to follow you. That means that to build your following, you have to get in front of people and pique their interest. The most reliable way to do that is to follow people.

Anywhere from 10-50% of people will follow you back if you follow them. A small portion of them will be using auto-follow-back programs, but a lot of them will just follow you back because you seem interesting and you followed them.

But you don’t want to follow randomly! You should only be following people who would be good candidates for being interested in your content, and who would be most likely to follow you back. The best way to do this is to try to “steal” other people’s followers. Here’s how it works:

  1. Go through your followers, find people who write about similar things as you and who have a lot of followers
  2. Go to their page
  3. Start following their followers in the hopes that they’ll follow you back

But doing it manually kinda sucks. Instead, check out Tweepi and Manage Flitter which both offer services to make it very quick and easy to follow a lot of people at once, and to target who you’re following. For example, with the paid version of Tweepi, you can pick a user who’s followers you want to follow, then add filters like:

  • Only people who are following more people than they’re being followed (these people will be more likely to follow back)
  • Only people who’ve tweeted in the last few days (no inactive accounts)
  • Only people who have at least 50 followers (less chance of spammers / totally new accounts)
  • Only people who I haven’t followed / unfollowed before
  • And so on

The other important step is to unfollow those who don’t follow you back. You won’t have a 100% success rate so it’s important to prune the people who don’t reciprocate. Tweepi and Manage Flitter can do this for you, and we’ll give you some code to automatically do it later. Or you could do it manually… but that’s no fun 🙂

Don’t get too eager with your following! For more active, established accounts, Twitter will let you follow up to 1000 people a day. For a brand new account you shouldn’t do more than 100, and you may never want to go much above 200 to be totally safe. Twitter does give you one warning though, so if you want to see how far you can push it go right ahead!

1.3 Favoriting Tweets

Before we explain this, go to Twitter, and tweet something like:

“Test tweet: I love growth hacking, startups, and growing my social media following”  (click it to tweet)

Here’s what happened when I posted that:

Programming for Marketers Twitter Follow Bots

Those 18 favorites showed up in less than 5 minutes–that’s an absurd engagement considering none of these people follow me.

Sadly it’s not really engagement. All of these accounts are using auto-favoriting scripts or programs to find people tweeting about certain topics, then favorite their tweets to hopefully get them to follow them.

Depending on your industry, this is a very effective tactic. It’s good in an area less inundated with “social media gurus” (for example, fine tea curation is probably low-competition) but it’s bad in the case above where everyone and their mother is running an auto-favoriting script. I’d say avoid doing it for things like social media, growth hacking, startups, and anything tangential to those.

Even though it’s not quite as effective as following people, it is nice because it doesn’t require you to inflate your following number. That would be desirable if you don’t want to look like you have an artificially high follower count just from doing follow / follow back.

Again, you could do it manually, but tools are better and we’ll show you how to write code for it later. In this case you want to use a tool like Twitfox. They’ll let you pick certain keywords to track, and then they’ll go out and favorite tweets related to those topics for you.

Try it for a bit, see how it converts, change your keywords around, and go from there!

1.4 Joining Conversations

Another way to gain exposure is to join conversations on Twitter. These conversations revolve around a certain hashtag, and if you look at a company’s Twitter page you can usually figure out pretty quickly if they do a regular Twitter chat.

Although you won’t get as many followers from Twitter chats, you will get your name out in the field and you might be followed by some high influence people. If you’re followed by someone with influence, they’re a great candidate for “stealing” followers from (a la 1.2) since when you follow their followers, their followers will see that the influencer they’re following follows you and assume that means you’re important and an influencer yourself.

There are also some conversations that aren’t hosted by companies but that come up organically. Search for certain hashtags related to your industry and see what comes up!

1.5 Timing

Those three things will be the main way you get discovered, but if you want to keep your followers, you have to not only have good content but well timed content.

In order to do this, you can combine Tweriod and Buffer to build an optimal sharing schedule.

2015-01-13_2221

First, go to Tweriod, sign in with Twitter, and see when your followers are most active.

Then, take that schedule, go to Buffer, and set your tweets to go out during those high-activity times.

Now so long as you post your tweets through Buffer you’re guaranteed that they’re hitting your audience when they’re most active!

Alright, so that’s the basics. Now let’s cover how you can do some programming and do all of this on your own (and for free!)

2. Advanced – Running Your Own Twitter Scripts

These techniques can be a bit risky! Don’t accidentally follow 1000 people at once (though we did our best to make that difficult to do). And there’s always the chance that you could get banned if you use them too much, so be smart! Play it safe and slowly escalate to what you’re comfortable with. Remember the limits from before.

In this section, we’ll cover:

  1. Getting you set up with Python
  2. Installing the Twitter tools for Python
  3. Favoriting with Python
  4. Following with Python
  5. Un-following with Python

2.1 Getting set up with Python & Twitter’s API

Before you can use any of this code, you’ll need to have Python installed on your computer. Python is a very simple, easy to use programming language.

If you’re a Mac user, good news! It’s already installed 🙂 If you’re a Windows user, go to this link and follow the directions: https://www.python.org/downloads/windows/

If you have any problems with installation (or anything else), go to Google and type in “Stack Overflow” followed by the description of the problem you’re having. We’ll try to answer questions too but it’s likely that Stack Overflow has already answered them, so start there.

Once Python is installed, you need the code for working with Twitter. Head to this link https://github.com/sixohsix/twitter/ then:

  1. Click “Download ZIP”
  2. Unzip it to your Downloads folder

Once it’s in your Downloads folder, go to Terminal (or Powershell if you prefer on Windows) and type in: “cd Downloads/twitter-master”

2015-01-13_2223

Assuming you left it in your downloads folder, you’ll now have “navigated” to the twitter-master folder using Terminal. “CD” tells the prompt where you want to go within your system, but it can only go down and up. If you wanted to go back up a folder, you could type “cd //” and then you’d be in “Downloads” instead of “twitter-master”. Stay in twitter-master though.

Now, in terminal, type “python setup.py install”. This will take the twitter-master code and add it to your Python installation so you can access it from other Python scripts. Don’t worry about all of the text that appears. Assuming nothing went wrong you should now have the Twitter tools installed!

There will be a lot of text, it should look something like this

There will be a lot of text, it should look something like this

Alright, you have Python and the Twitter tools. Now we just need access to the Twitter API. The API is the “Application Programming Interface” which is basically a fancy way to say “the data.” By having access to the API you’re really saying you have the ability to use Twitter as if you were on www.twitter.com, but with fewer birds and more lines of code.

Here’s how you get API access:

  1. Create a new folder (anywhere you want) to store the code for this project in
  2. In that folder, create a new file called “twitter_info.py” based on our example here: https://github.com/ProgrammingforMarketers/grow-twitter-following
  3. Now go to https://apps.twitter.com/ and click “Create a New App”
  4. Put whatever you want in the name, description, and URL. Don’t worry about the callback 00000061
  5. Once you hit accept, go to “permissions” and set them to “Read and Write” not just “Read Only”
    00000061
  6. Now go to the “Keys and Access Tokens” tab, and generate a new access token (there will be a button towards the bottom)
  7. Once you have that, you can copy over your Consumer Key, Consumer Secret, Access Token, and Access Token Secret to the file you created, twitter_info.py, based on our set up
  8. Save the file, and you’re done! Your computer is now set up to work with your personal Twitter account

2.2 Getting the Code for Automating Twitter

Now the real fun can begin. We’re going to download a Python package that someone was kind enough to open source for us, so that we can manipulate our Twitter accounts without having to build everything from scratch.

You can find the original code here: https://github.com/rhiever/twitter-follow-bot but we’re going to recommend you download our slightly modified version of it which will allow you to keep your personal Twitter info in the separate file you created. This is a good practice in case you share the code with someone else, since you don’t want to give them access to your Twitter account. Go here to find our version: https://github.com/ProgrammingforMarketers/grow-twitter-following

First, hit “Download ZIP,” unzip it to your downloads folder (unless you did this already earlier for the “twitter_info.py” file) and then copy the “twitter_follow_bot” and “sample_twitter_codes” files to the same folder as where you put your “twitter_info.py”

And that’s it! You can now run a bunch of different functions to automate your Twitter account, just by changing what’s “commented out” in the “sample_twitter_codes” file. We’ll explain in the next few sections.

2.3 Auto-Favoriting with Python

Now instead of having to pay for someone else’s service, you can run your own auto-favoriting robot right from the command line.

Here’s all you have to do:

  1. First, open “sample_twitter_codes” and un-comment #3 (we explain commenting in the file)
    2015-01-13_2234
  2. Then, open your terminal and navigate to where you stored the .py codes using the same “cd XYZ/XYZ” syntax from before
  3. Last, type in “python sample_twitter_codes.py” and hit enter! You’ll start favoriting everything related to that topic to a certain limit.

2.4 Auto-Following with Python

So this starts off the same as for auto-favoriting, but you’ll either un-comment #1 if you want to follow based on a phrase, or #2 if you want to follow someone’s followers. Once you’ve uncommented one, save the file again.

2015-01-13_2235

Go to terminal, navigate to the folder, and type in “python sample_twitter_codes.py” and you’ll start following!

2.5 Auto-UnFollowing Non-Followers

We won’t go too in-depth with modifying the python files here, but we did include the function to wipe out all of your non-follow-backs. You can un-comment and run #4 if you’re feeling aggressive 🙂

And there you have it! You now have a set of Python functions set up for your personal (or company) Twitter account that lets you automatically favorite relevant tweets, follow people who would be good leads for you, and even unfollow people who aren’t following you back. Go brag about it on Twitter!

Bonus

There’s one thing missing though. You still have to manually run these codes every day, which is still very easy but not quite ideal. We wrote up a short “bonus lesson” on how to make these codes run automatically for you as frequently as you want. If you’d like to learn how (don’t worry, it’s easy!) and you can get it right here by sharing this post now!

2015-01-13_2239

Conclusion

You now have the tools to go out and collect a massive Twitter audience with very little work on your part. Go out, conquer the world, and let us know if you have any feedback!

Your Friends in Technical Marketing,
Justin & Nat

  • Thanks for the hack, Justin and Nat, it’s so satisfying to see the script scroll through the tweets and see it automatically following/favouriting.

    Just a comment about a problem I ran into while running PowerShell.
    1) I kept on getting the error “No module named SetUpTools”. I had to install SetUpTools using these instructions first (https://pypi.python.org/pypi/setuptools).
    2) I also got an error saying that Python was not recognized, so I had to enter this at the very beginning before anything else “[Environment]::SetEnvironmentVariable(“Path”, “$env:Path;C:Python27″)”

    Otherwise, AWESOME!

    • Yann Leymarie

      Dear Stefanie! How do you know that the script is running smoothly?
      I think I followed everything but im not sure its working

      • If your script works correctly, a long list of Twitter ID numbers will start populating.

        • Yann Leymarie

          Thanks Stefanie! Unfortunately I keep bumping into this message:

          error: Twitter sent status 401 for URL: 1.1/friendships/create.json using parameters: (follow=False&oauth_consumer_key=GB7z9eMERDKCe3b4XXXXXXXXX&oauth_nonce=12320455449177XXXXXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1457257XXX&oauth_token=472090222-qX7pYUqET1A6sW6BRmHNKpMWtUmb98goXXXXXXXX&oauth_version=1.0&user_id=383921XXX&oauth_signature=8wFyxoR4hmFss7WmHFcp6XXXXXX%3D)

          details: {u’request’: u’/1.1/friendships/create.json’, u’error’: u’Read-only application cannot POST.’}

          • I’m sorry, I don’t know how to fix it. 🙁

          • Yann Leymarie

            It’s okay thanks for the replies anyway 🙂

  • Thack ☁️

    did you ever sort this out, Stefanie? Having similar problems to yours. I recall getting it fixed aeons ago but I’m on a different computer now, and didn’t make notes! 😀

  • Thank you for adding warnings throughout this post. Back on May 15, Twitter shut down a bunch of services that were doing ‘dumb’ automation. You have to make the interactions with the API look organic.

    Add http://narrow.io to the list of products that help you automate your Twitter marketing strategy. I built it initially as an experiment but it ended up working so well that I created a service out of it 🙂

  • shuvo

    vecation stie https://goo.gl/1e7Ct3

  • I have successfully implemented this script on https://www.pythonanywhere.com, which is a service that allows you to load and run Python scripts on a schedule. So now I can run my script automatically each day without manually typing it into terminal, but I’ve dialed down the numbers so I don’t go overboard and raise flags. Just nice to know that I can set it and forget it (perhaps visiting once a month to tweak the script to target other accounts, etc).

    • I’ve setup an account at pythonanywhere.com but can’t get the scripts running. I wonder if you could give a quick tutorial on how you got it working?

      • Well, I had scripts that I was running locally so I knew that they were setup properly. Honestly I just uploaded the files to the server, navigated to the file that holds all of the commands, and clicked “run”. After I verified that was working I pasted in the path to that file into the schedule tab like so: “python /home/[your directory]/sample_twitter_codes.py”. Set it to run daily and I just check in on the logs every once and a while to ensure all is well.

  • Thanks! I think I may be following too many people (I just came back and read your warning today). My API token keeps disappearing when I follow too many people.

  • DicoRico

    thanks for this great tutorial and the tools you had put together. Super helpful.
    What would be a really fantastic addition is the possibility to follow users based on somekeywords included in their bio.
    Looking forward to read more articles from you guys

  • M. K.

    anyone having any ideas how to set a limit on unfollow function? What to add here in ()?=

    from twitter_follow_bot import auto_unfollow_nonfollowers
    auto_unfollow_nonfollowers()

  • Tony Owen

    Justin & Nat, Excellent article! Thanks for the insight.

  • tweetadder is also a good tool for this. a little intimidating at first but quite useful. you have to pay though, as i think you have to pay now for socialoomph. but they let you download a trial version that actually lets you set up autoresponses for new follwers, which is great!

  • brown linda

    usually got legit twitter followers through a legit twitter automation softwares sorce: whitehatbox.blogspot.com/

  • Alex Rohner

    after i enter the “python setup.py install” text in terminal i get this error message: Alexs-MacBook-Pro:twitter-master alexrohner$ python setup.py install

    running install

    Checking .pth file support in /Library/Python/2.7/site-packages/

    error: can’t create or remove files in install directory

    The following error occurred while trying to add or remove files in the

    installation directory:

    [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/test-easy-install-6667.pth’

    The installation directory you specified (via –install-dir, –prefix, or

    the distutils default setting) was:

    /Library/Python/2.7/site-packages/

    Perhaps your account does not have write access to this directory? If the

    installation directory is a system-owned directory, you may need to sign in

    as the administrator or “root” account. If you do not have administrative

    access to this machine, you may wish to choose a different installation

    directory, preferably one that is listed in your PYTHONPATH environment

    variable.

    For information on other options, you may wish to consult the

    documentation at:

    https://pythonhosted.org/setuptools/easy_install.html

    Please make the appropriate changes for your system and try again.

    What is the problem here? Any help would be greatly appreciated.

    • Add “sudo” to the beginning of the command, so “sudo python setup.py install”

      • Alex Rohner

        It asks for a password after i enter this command

        • Brian Barr

          Hey Alex, that’s because sudo is telling terminal to run the command as an Administrator.

          The password is the same as your Admin password (usually the password you use to log into your computer)

    • john

      Everything is going fine powershell is unfollowing about 50 people then all of a sudden i get the error message of:

      Traceback (most recent call last):
      File “sample_twitter_codes1.py”, line 20, in
      auto_unfollow_nonfollowers()
      File “C:UsersYorkdesktopovodrakketwitter_follow_bot1.py”, line 209, in auto_unfollow_nonfollowers
      t.friendships.destroy(user_id=user_id)
      File “buildbdist.win-amd64eggtwitterapi.py”, line 312, in __call__
      File “buildbdist.win-amd64eggtwitterapi.py”, line 345, in _handle_response
      twitter.api.TwitterHTTPError: Twitter sent status 401 for URL: 1.1/friendships/destroy.json using parameters: (oauth_con
      sumer_key=qpTfJN1C6lNpyahuPhwr9ayFO&oauth_nonce=1783953095101796127&oauth_signature_method=HMAC-SHA1&oauth_timestamp=145
      9879127&oauth_token=3563780357-Hb7J00dIcKhG0LcBvIVW2dwohUHJfw9LZGCSffl&oauth_version=1.0&user_id=323814347&oauth_signatu
      re=aeqiRaEYniPl2AqyUbMe3P0rf7g%3D)
      details: {u’errors’: [{u’message’: u’Invalid or expired token.’, u’code’: 89}]}

      Anyone know how to fix this issue? I have to manually go into twitter and request a new access token each and every time because it seems as mine dissapeared. Thank you.

  • Yann Leymarie

    I don’t understand where to paste the ” Consumer Key, Consumer Secret, Access Token, and Access Token Secret” in the 2.1?

  • KC CK

    Hi, may be a beginner question but I followed all of this, and am running into the issue of “No module named twitter” when I run it.

    What did I miss?

  • Anyone know how to set conditions for the auto follow script (like Tweepi)?

    I’d like to set it up so the auto follow only follows people who are following more people than they have followers; and only people who’ve tweeted in the last few days.

    • Czar

      Hey, Brad. Did you ever got this working? I was also thinking about the posibility of making the autofollow randomize the handles from which users you’ll follow. Just going to start workinkg on that and if you have any workoround for setting more conditions on the script, it would be awesome.

      Cheers!

      • No I never did. I’ve just been using the scripts as written.

  • john

    Everything is going fine powershell is unfollowing about 50 people then all of a sudden i get the error message of:

    Traceback (most recent call last):
    File “sample_twitter_codes1.py”, line 20, in
    auto_unfollow_nonfollowers()
    File “C:UsersYorkdesktopovodrakketwitter_follow_bot1.py”, line 209, in auto_unfollow_nonfollowers
    t.friendships.destroy(user_id=user_id)
    File “buildbdist.win-amd64eggtwitterapi.py”, line 312, in __call__
    File “buildbdist.win-amd64eggtwitterapi.py”, line 345, in _handle_response
    twitter.api.TwitterHTTPError: Twitter sent status 401 for URL: 1.1/friendships/destroy.json using parameters: (oauth_con
    sumer_key=qpTfJN1C6lNpyahuPhwr9ayFO&oauth_nonce=1783953095101796127&oauth_signature_method=HMAC-SHA1&oauth_timestamp=145
    9879127&oauth_token=3563780357-Hb7J00dIcKhG0LcBvIVW2dwohUHJfw9LZGCSffl&oauth_version=1.0&user_id=323814347&oauth_signatu
    re=aeqiRaEYniPl2AqyUbMe3P0rf7g%3D)
    details: {u’errors’: [{u’message’: u’Invalid or expired token.’, u’code’: 89}]}

    Anyone know how to fix this issue? I have to manually go into twitter and request a new access token each and every time because it seems as mine dissapeared. Thank you..

    • Ne Tas Elvis

      Same thing happened, how to solve it?

  • john

    Anyone know how to set a certain unfollow limit?

  • botdirectory

    Hi all. Good tool Justin&Nat, thanks for sharing it.

    Has anybody tried to deploy it on OpenShift? It seems to have better free tier than pythonanywhere, less limits.

  • twiterrunner

    Hi there Justan & Nat. I would like to introduce myself. I am Bryon Henderson CEO of TwitterRunner.com. I want to take this time to thank you for this fine article and other Twitter articles you have posted which were very informative when we were developing our product TwitterRunner.Com Twitter Management Tools Suite.

    We could not have accomplished all of our goals without the help of articles such as yours.
    Yes our application enables you to get Followers free and fast also and our services fully accepted by Twitter as some steps mentioned pointed us to areas we need to address.

    So thanks again J & N
    Bryon

  • Nice one.www.francaolisa.com to see more social media tools I used that have really helped me grow my social media. Free and premium versions available.

  • Wang Milanda

    Great article, i have a lot of experience to get automatic twitter followers. TweetAttacksPro is the one which give me great help, http://twitterfollowerbots,blogspot,com auto-follow, unfollow, follow back, tweet, retweet, reply, favorite…just share my experience.

  • Kyle

    Hi,

    I’ve followed all the above instructions but I keep getting this error when I try to run the script through terminal:

    dyn202125:~ admin$ cd desktop/twitbot
    dyn202125:twitbot admin$ python sample_twitter_codes.py
    File “sample_twitter_codes.py”, line 3
    SyntaxError: Non-ASCII character ‘xe2’ in file sample_twitter_codes.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    I’ve had a google but I’ve been unable to find anything. Can someone help me please?!

  • Will Meyers

    For this step

    (First Image)

    I’m just wondering, on step 2 I entered this in the twitter_info.py:
    (Second Image)
    Should the quotation marks be included or not? Later on in the article it mentions for another step to not include them so I was a bit confused.

    Next

    This is where i’m stuck in the process:

    (Third Image)

    I’m unclear what they want me to do in step two. Navigate the.py using some syntax? Which codes?

    Also

    These directions in the sample twitter codes:

    Simply remove the three ‘ marks above and below the code you want in order to run it, while
    leaving the text within a new set of three ‘ marks.

    What do they mean while leaving the text within a new set?

    Last Question

    This is my codes folder I was told to make in the first step of the first image i posted… Does this look to be correct at this point, I noticed the files don’t seem uniform.

    (4th Image)

  • its very complicate because i cant access to api as easy