Looks like Guy Kawasaki was talking (point 6) about using twitter for web 2.0 publicity again, at the recent Nasscom - Tweetup meet. Twitteybot is just that, a dead simple tweet automator :). This post deals with the technical details. The source code is available here. The overall architecture of the website is simple.
The application is hosted on the Google App Engine and uses the built in persistance, user accounts, cron jobs and tasks.
Starting from the persistence layer, there are are two major objects; one to store the twitter account auth tokens, and the other to store actual tweets that have to be scheduled. There is another object to stores the application properties and it primarily stores the twitter oauth key and secret. I put them in the database instead of a properties file to enable revocation, etc without having to redeploy the application.
The servlet layer simply fetches this data using either the TwitterAccountManager or the StatusManager classes. The UI makes direct calls to these classes to manage the data at the backend.
The UI is simply an interface to modify the objects at the backend. The only other functionality are the tool boxes at the left that let a user schedule and shrink the tweets. These are purely javascript functions that modify the values to be sent to the backend.
The cron job runs every minute, checking for tweets, older than the current time. If it finds any, it adds them to a taks queue. The Task queue looks at the tweets, one after the other and is responsible for posting them to twitter. The twitter oauth credentials are saved in memcache as they would not change very often.
A lot of code has been written, and a lot more need to be. Please take a look at the site and criticize, suggest or even appretiate.
Here are the list of issues that I would be working, once I get back. I would definitely welcome help, so if you are interested in churning out some code, do drop me a comment.
Friday, October 30, 2009
Twittey-Bot :: Technical Details
Labels:
twitteybot
Subscribe to:
Post Comments (Atom)

3 comments:
Hi there. I love the possibilities of this app.
Can I suggest to you what I need and can you tell me what you think it would take to have this done?
I have different "groups" of tweets that I need scheduled, and I need them scheduled at different intervals.
For example I might have group A: quotes. I might want these tweeted every 83 minutes, and I might want this list to repeat endlessly.
Then group B: personal promotion. I might have, say, 6 tweets here and I'd want these to be scheduled for every 6 hours, say.
Etc...
The only way to do this now, with your software, is to setup multiple accounts, but that's silly.
Rather I'd like to see such a "groups" or "sets" feature.
I would be delighted if this were possible.
Next...
I'd like to be able to select my timezone, and have the system show me what the next, say, 10 tweets look like, in what order, and at what time. This could be done per group and universally too. Univerally (an overall view) would be well enough for me.
Next...
A scheduling override which indicates a range of hours that are the limit of the tweeting. So, if group C was tweets targetting Australian users, I'd want to be able to specify an interval (say, 45mins), but also I'd want to specify that these should only be tweeted during Australian business hours. Otherwise they're wasted, I'd suggest.
Finally...
This is not a killer as I can prepare the tweets in TweetDeck which does this...
I'd love integrated Bit.ly (using my own account there). This would mean my text file would include long-form URLs and the app would shorten them at the time of import.
If any tweets were over the 140 character limit after shortening the app would alert me to these and I guess I could re-import the corrected file, or there might be a means that the app provides for me to correct the over-length tweets there and then.
How does all this sound??!
@Alister,
Answering your questions...
1. Grouping and Scheduling tweets is possible even now, just that I am working on the user interface. Tweets are grouped by the source they are uploaded from. This source can be changed later.
2. The timezone point is very valid. All tweet times are in the local timezones. This is one feature that can be added. The "schedule only during day" feature will also be a part of this feature.
3. TweetDeck allows you to schedule, but you have to have it runing. This is more for enterprises and smaller companes who have a promotion list, and want to forget about it, once scheduled.
hi.. just dropping by here... have a nice day! http://kantahanan.blogspot.com/
Post a Comment