Towards a node.js Auto-Tweeter

I’ve been intrigued by node.js as a platform for highly-scalable server applications written in javascript and finally found a super simple application I wanted to try with it: an auto-tweeter that would let me schedule future tweets to my own account.  I’m organizing a pub crawl for Repeal Day and I want a flight of tweets to go out during the crawl… without me or my partners having to do it manually.

I mentioned this to my buddies at Santa Barbara Hacker Space and we made it a collaborative project.  I’ll miss this week’s WebTech Wednesday session, but perhaps a write up will help keep the conversation going.

The idea is pretty simple.  There are three components.

  1. The tweet engine
  2. The datastore
  3. CRUD Interfaces to the data store

The tweet engine will query the datastore every so often and see if there are any tweets that need to be tweeted (because their tweet_by timestamp is in the past).

The datastore will hold the tweets and their tweet_by time, stored as UTC timestamps.

The CRUD interface will let us create, read, update and delete those tweets.

Future ideas:

  1. Use Twitter authentication for accessing the app
  2. Bulk uploader for multiple tweets.
  3. Support multiple users
  4. Support queues of tweets, which get tweeted at a regular schedule
  5. Support additional entity data with the tweets, such as geolocation


  1. Managing the timestamp will take some thought. The CRUD interface should use localtime—with an option to override the timezone—but store UTC in the database. That will avoid some common problems with tweets going out on the server’s time zone when the user thought it was set for theirs.
  2. This first version will, unfortunately, be totally exposed to anyone who knows the URL. We’ll add twitter authentication as soon as possible.
  3. Timing the engine will take some finesse. We could just poll the database, but that wastes a lot of cycles.  Instead, I’d like the engine to schedule itself to run at the next tweet_by time and have the CRUD either wake the process up early or kill & restart it.

That’s it for the start. More as it happens.

This entry was posted in AutoTweeter, coding and tagged , , , , , , . Bookmark the permalink.

6 Responses to Towards a node.js Auto-Tweeter

  1. Hey Joe,

    Thanks for the shout out! Here’s another project you may be interested in: SBitter, SBHX’s Twitter clone project… with a twist.

    To quote the README: “Why throw away perfectly good Twitter clones when we could instead build a federated network out of them?” 😀 If you write a version in JS or CoffeeScript running on Node, I’ll write one in Go and another using Django!

    Find out more here:

  2. @Joe: django-sample and rails-sample are apps meant to show off very basic functionality of Django and Rails, respectively, and have nothing to do with SBitter. SBitter should probably have its own repo… I’ll do that soon.

    gholms and I (and I think kitedawg) talked about the API a tiny bit, but it’s definitely still very much in the planning stages. Once we’ve got 2-3 SBitter instances, I’m thinking then we can focus more on the API… or you or your readers can drop into our IRC chat room ( and talk about how it should be structured immediately. 🙂

  3. Joe says:

    Well answered. There are a lot of crazy issues with identity and such in federated systems. Room for an interesting conversation, for sure.

    Meanwhile, let me get my node.js chops in order and we’ll see what happens.

  4. Sounds good!

    Speaking of Node, Dave (the UCSB math PhD ~candidate) will be teaching us about Node/server-side JS for this coming WebTech Wednesday @ 6pm. Should be cool! Later.


  5. Pingback: The World’s Simplest AutoTweeter (in node.js)

Leave a Reply