Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (49 sloc) 1.89 KB

Twitter Bot - skeleton for twitter robots

If you need to create twitter bot that will eternally iterate over own followers - this is what you need.


Install it from npm:

npm install twitter_bot


  1. Register twitter account for your bot.
  2. Register twitter application for your bot.
  3. Get access tokens for your application from your bot's account.
  4. Write some code
    var util       = require("util"),
        TwitterBot = require("twitter_bot"),
    // overwrite constructor
    function MyBot(config) {
        // make something cool in constructor
        this.isCool = true;
    util.inherits(MyBot, TwitterBot);
    // main function that you must implement
    MyBot.prototype.process = function(id, callback) {
        console.log("Processing user with id=" + id);
        setTimeout(callback, 1000);
    // create instance of your bot
    bot = new MyBot({
        consumer_key        : "<consumer key from application settings page>",
        consumer_secret     : "<consumer secret from application settings page>",
        access_token_key    : "<auth token of your bot given to your app>",
        access_token_secret : "<auth token secret of your bot given to your app>",
        concurrency         : 10 // concurrency level, 10 is default
    // start processing your followers
    // after 10 seconds stop iterating new followers,
    // but finish processing current ones
    setTimeout(bot.stop.bind(bot), 10000);
    // this is it.
  5. Promote yourself.


This project came from @listwatcher (sources) code and is used in @unfollowr twitter project to manage more than 200K followers.