The DCTwits Twitter Group

Tell your friends!

Real quick post here to let you know about the DC Twits Twitter user group. I set this up this weekend (first foray into Twitter API and it wasn’t too hard) for people in the Washington, D.C. metro area who want to subscribe. That doesn’t preclude anyone else from participating – for instance Brian Layman from Ohio and Stuart MacDonanld from Toronto both are in the group (for what reason, I have no idea but glad to ahve them along, nonetheless!).

It’s a simple concept. Follow @dctwits in Twitter and any message you send as a direct message to dctwits (e.g

1
d dctwits hello world!

) from your Twitter account will be blasted out to everyone else following dctwits.

I’m tweaking things here or there as we go along (for instance, I made links clickable earlier), but it seems to be working. I’m thinking Boston needs a Twit group and I’d be happy to set up another instance for them (or any group – within reason) or anyone. Just give me a shout.

Update: I’ve released the code to the public. It is licensed under the GPLv2 License so feel free to use but keep the attribution notices in place. You must, at this time, have PHP 5.1+ or the PECL Json module loaded in PHP. You can download the code via SVN here: http://metro-twitter-groups.googlecode.com/svn/trunk/

1
svn co http://metro-twitter-groups.googlecode.com/svn/trunk/ twittergroups
  • dave holland

    I was wondering what client library you used? I have been meaning to experiment with Twitter4R as I have heard very good things about it (for Ruby) from 4 other developers I know well. Let us know your experiences with client libraries and what language you used?

    thx

  • http://www.technosailor.com/the-technosailor/ Aaron Brazell

    Dave, I use PHP. I found a Twitter client class written by David Billingham. I took it and modified it. For instance, his class uses XML. Mine uses JSON, though I will build XML back in as an option. The code is released now.

  • http://red66.com/ Carlos Granier-Phelps

    I’ve setup a Twitter Group for Miami, FL. You can find it at:

    http://twitter.com/MiamiTwits

    Just follow it and send direct messages to it to broadcast to the entire group.

  • http://housewifery.wordpress.com Jill Foster

    Thx Aaron-the-technosailor for organizing this and investing the time. -Proud to be a DCTwit!

  • http://raoli.com/ Eric Blair

    I’ve noticed some people are sending @msgs to DCTwits. What do you think of sending at DM containing the sending directions to anybody who sends an @msg to DCTwits? This would obviously add 1+ API request to each load, so it might not be worth it. Curious about your thoughts.

  • http://www.technosailor.com/the-technosailor/ Aaron Brazell

    Yeah, I have very little overhead on API right now so I’d prefer not. I think most people follow people individually anyway.

  • lft411

    Tried setting this up as it appeared pretty simple. Copied the files over to my linux box running php 5.2.5 in the following location:

    /home/lft411/www/twitter/

    Three files located there. I renamed the config file and edited it.

    For testing I set my twitter account to follow the “lft411″ twitter account, and the lft411 account to follow me.

    From my twitter account I sent “d lft411 hello world!”

    I don’t see anything show up on lft411 nor my twitter account but it sent.

    Since I have not setup the cron function yet I simply accessed the index.php via the web thinking that should accomplish the same thing right? The idea of the cron job is just to automate the process right?

    I am missing something here, would love to get this working for the local community.

    Thanks!

  • lft411

    I enabled the debug and I notice the following:

    Fatal error: Call to undefined function: date_default_timezone_set() in /home/lft411/public_html/twitter/index.php on line 22

    The timezone is set in the config.php file so I am not sure.

  • http://www.technosailor.com/ Aaron Brazell

    This function is a PHP function available in PHP 5.1 or greater. While my posts states you must have PHP 5+ I’ll update it to reflect 5.1.

    PHP Reference date_default_timezone_set()

  • http://www.afhill.com/blog Andrea Hill

    Thanks for your work on this! I haven’t delved into the code too much, but I was wondering about the “acceptance” of posters. Does DCTwits need to mutually follow someone for messages to be transmitted? Is that something you are handling manually?

    thx
    Andrea

  • http://www.technosailor.com/ Aaron Brazell

    Andrea-

    It’s setup now to autofollow anyone who follows @dctwits. This is to ensure that you are able to send DMs to it, as that is the required method of posting to the group. There is an up-to 4 minute delay for this to happen and you get an email notifying you when DCTwits is now following you. The delay is due to the need to stay within the 70 Twitter API requests per hour. Everything the bot does costs an API request.

  • http://www.brianeisley.com Brian Eisley

    Hi, Aaron. Thought I’d let you know that I’ve used your code to create an unofficial Twitter group for the 2008 Annual Conference of the American Library Association. The account is at:

    http://twitter.com/ala2008

    I have the code hosted on my own site and run by a commercial cron scheduler (WebBasedCron). It seems to be running beautifully.

    Thank you so much for doing this and putting the code out there!

  • http://www.brianeisley.com/ Brian Eisley

    Whoops, I hosed the link to WebBasedCron in my comment. I knew I’d mess something up! :-)