Kerry Buckley

What’s the simplest thing that could possibly go wrong?

Updating FaceBook status from Twitter

17 comments

I’ve recently jumped on the Facebook bandwagon. I can’t be bothered to update two statuses (I rarely get round to it with one), so I was looking for a way to update my FaceBook status from Twitter. I installed the Twitter application in FaceBook, but that just displays the Twitter status separately.

It seemed that the only way to do it was to write a script to regularly check Twitter, and update FaceBook when it found a new Twitter message. I found a partial solution in PHP, but decided to roll my own in Ruby anyway.

It took a few hours longer than I expected (the documentation for Net::HTTP could be better), but I got there in the end. I now have the script below installed on my DreamHost account, and set to fire every minute via cron. It’s not the prettiest code I’ve ever written, but it does the job. Feel free to borrow it if you think it’ll be useful.

Andrew ‘Boz’ Bosworth
11:29pm September 6th

I’m an engineer at facebook and I’m writing to ask if you would be willing to take down the link to your facebook/twitter status sync utility (located on your website kerrybuckley.com). Based on your comment on TechCrunch I suspect you anticipated this would be coming at some point. Even if your intended use of such a script is noble (as I’m sure it is), the simple script you have posted on your site is (and has always been) against our terms of service. Said more shortly, we just can’t let people automate aginst our site outside of the platform; it’s a slippery slope.

We’d obviously like to resolve this without disabling your account or getting the lawyers involved if possible, so please let me know as soon as you’ve taken the script down so that our legal department doesn’t get all fired up about this.

thanks,
Andrew Bosworth
Facebook Engineer

My reply:

Andrew,

As you’ll probably expect, I’m not particularly impressed with Facebook’s current stance on openness in general, or on this issue in particular. I hope that at some point you add an API to allow remote updating of status, in the same way that you recently added an RSS feed to allow tracking of friends’ statuses.

For the record, I don’t believe that posting the script on an external site constitutes a violation of the terms of service, although I accept that using it would be. Also, when you say “we can’t just let people automate”, I assume you really mean “we won’t just let people automate”. This is a shame, as it goes against the grain of the Internet, and reinforces the impression that you’re trying to lock people into your site.

All that said, I don’t particularly want to be spending my time fending off writs and takedown notices, so the script no longer appears on my site (see http://www.kerrybuckley.com/2007/07/14/updating-facebook-status-from-twitter/).

Kerry

Technorati Tags: , , ,

Written by Kerry

July 14th, 2007 at 4:39 pm

Posted in Ruby,Web 2.0

17 Responses to 'Updating FaceBook status from Twitter'

Subscribe to comments with RSS or TrackBack to 'Updating FaceBook status from Twitter'.

  1. Hi Kerry,

    You could have just used the fbTwit application on Facebook. fbTwit automatically updates twitter with your facebook status.

    Read more about it here:
    http://www.allfacebook.com/2007/06/twitter-facebook-synchrornization/

    Best Regards,
    Nick

    Nick O'Neill

    14 Jul 07 at 6:50 pm

  2. Ah, but I wanted to update FaceBook from Twitter, not the other way round. I can update Twitter via SMS, which (being in the UK) I can’t do with FaceBook.

    Kerry

    14 Jul 07 at 10:08 pm

  3. I’ve just spotted that someone else has already done something very similar. The only real difference is that he uses curl. Mine doesn’t depend on any gems being installed, in the unlikely event that that matters.

    Kerry

    15 Jul 07 at 10:04 am

  4. I’ve now tweaked the script slightly from the original version (around line 19).

    FaceBook prefixes your status with “Name is”, so if you post something like “Is anyone listening” to Twitter, it doesn’t make sense on FaceBook. I now have it only copy the status if it begins with a lower case letter, so I can control whether it gets copied by how I phrase my Twitter update.

    Kerry

    18 Jul 07 at 6:18 pm

  5. Hi Kerry,

    Definitely correct about the “Name is” issue. I was talking with my friend about that the other day. Definitely cool that you took it upon yourself to develop this though.

    Best regards,
    Nick

    Nick O'Neill

    19 Jul 07 at 2:58 pm

  6. Kerry – had this script up and working earlier today – but for some reason it is now featching an empty “twitter_status” file – though the Twitter RSS feed it is calling is OK.

    Not cathcing any errors via SSH – any suggestions?

    Damon Kiesow

    5 Aug 07 at 10:51 pm

  7. Actually – looks like it is hanging up at the Facebook login. Really lost as this was working and has worked for several hours.

    Here is the error it is showing:
    /usr/local/lib/ruby/1.8/net/protocol.rb:133:in `sysread’: Connection reset by peer (Errno::ECONNRESET)
    from /usr/local/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill’
    from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout’
    from /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout’
    from /usr/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill’
    from /usr/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil’
    from /usr/local/lib/ruby/1.8/net/protocol.rb:126:in `readline’
    from /usr/local/lib/ruby/1.8/net/http.rb:2017:in `read_status_line’
    from /usr/local/lib/ruby/1.8/net/http.rb:2006:in `read_new’
    from /usr/local/lib/ruby/1.8/net/http.rb:1047:in `request’
    from /home/{USERNAME}/public_html/feeds/tw2fb/twfb.rb:33
    from /usr/local/lib/ruby/1.8/net/http.rb:543:in `start’
    from /home/newmedia/public_html/feeds/tw2fb/twfb.rb:32

    Damon Kiesow

    6 Aug 07 at 2:46 am

  8. Well – whatever it was it went away – the code is working. Sorry for the multiple comments.

    Damon Kiesow

    6 Aug 07 at 2:53 am

  9. Hi Damon,

    I’ve had some intermittent problems with the script too, which I never got to the bottom of. Glad it’s working again for you now, and that people are using it!

    Kerry

    6 Aug 07 at 7:53 am

  10. Kerry -

    May be unrelated – but I was having issues with status=previous_status

    I ended up setting my twitter_status file to a full path – not relative – and then clearing status and previous_status vars in the script before populating them. Pretty sure that was not necessary – but after those changes it worked.

    Damon Kiesow

    6 Aug 07 at 1:54 pm

  11. Rather than storing the last saved twitter status, why not simply check the Facebook status and see if it matches the twitter status (or do both). That way, if someone changes their facebook and twitter status through some other means, then uses your program, it won’t change the Facebook status unnecessarily.
    For example, when I’m on Facebook, I use a Greasemonkey script to keep my facebook status synced to my twitter status, but when I’m not, I like to use your script. But I have to manually change the twitter_status file before I start it so that it doesn’t change my status to what it already is.

    Also, you might reconsider ignoring a twitter status that doesn’t start with a lowercase letter. Anybody who doesn’t use the standard Roman alphabet won’t be able to use this app otherwise, if their status starts with ü, ブ, or в, for example.

    Dan

    9 Aug 07 at 3:53 pm

  12. How To Update Facebook, Twitter, and Kopete’s Status All At Once…

    I have whipped up a short script to update Facebook’s status, Twitter, and Kopete’s status all at once.  The Facebook portion of the code comes directly from Kerry Buckley’s script…

    Ben Kudria

    15 Aug 07 at 1:57 pm

  13. Given the choice between leaving the script on the site or losing my Facebook account and potentially being sued, I’ve chickened out and removed the script.

    Sorry.

    Kerry

    7 Sep 07 at 8:28 am

  14. Nice…

    Sophocles

    10 Sep 07 at 7:17 pm

  15. Just goes to show that Facebook truly are a bunch of asses – in all senses of the word.

    Definitely beginning to bore me…

    Steve Ellwood

    15 Sep 07 at 10:22 pm

  16. Kerry,

    As you already know, your not alone in this battle. This is the message I got from the same ‘Boz’

    Andrew ‘Boz’ Bosworth
    4:40pm August 30th

    I’m an engineer at facebook and I’m writing to ask if you would be willing to take down the link to your facebook/twitter status sync utility (located on your website blakebrannon.com). Even if your intended use of such a script is noble (as I’m sure it is), the simple script you have posted on your site is (and has always been) against our terms of service. Said more shortly, we just can’t let people automate aginst our site outside of the platform; it’s a slippery slope.

    We’d obviously like to resolve this without disabling your account or getting the lawyers involved if possible, so please let me know as soon as you’ve taken the script down so that our legal department doesn’t get all fired up about this.

    thanks,
    Andrew Bosworth
    Facebook Engineer

    To bad. Fun while it lasted. I will just have to stop using Facebook for status. Their loss.

    Blake Brannon

    20 Sep 07 at 4:50 am

  17. 8hands do it from more then a month
    why don’t facebook want the same thing from them?

    Murat Bişkin

    30 Nov 07 at 4:21 pm

Leave a Reply