Categories
Ruby Web 2.0

Updating FaceBook status from Twitter

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

[tags]facebook, twitter, ruby, mashup[/tags]

17 replies on “Updating FaceBook status from Twitter”

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.

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.

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.

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

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?

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

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

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 –

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.

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.

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…

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.

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

Definitely beginning to bore me…

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.

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

Leave a Reply