Twitter to WordPress to Facebook

(Skip the lecture, go straight to the instructions — but note the update.)

I’m yet to be convinced that microblogging (eg Twitter, or those status updates in Facebook) is genuinely useful. Maybe, maybe not. But I’m willing to try it out.

Problem is of course that if you use multiple services, you don’t want to be having to update them all individually. If such a concept is going to work, you’ve got to be able to update once and have it cascade to everywhere.

Facebook has an app to push updates out to Twitter. Which would be fine, but for those outside North America, you can’t update your Facebook status from anywhere except within Facebook. (North Americans can use SMS from a mobile, but others can’t.) Okay, so maybe you’d want to do it mostly when in front of a computer anyway, but I do like about Twitter than you can update from anywhere… anybody can SMS a number (it’s based in the UK, so for me it’s costing 50 cents… so I’d better not go mad using it) so no fiddling with mobile web access just to post an update. Twitter also takes updates via IM (such as GTalk and Jabber). I also like that it’s open; people can see what’s going on without registering.

I normally hate words like synergy and leverage and convergence, but that’s what’s gone on here. Alex King has written code that updates WordPress from Twitter every 15 minutes. Christian Flickinger has written code that updates Facebook using PHP, with a hack using the Curl library (since Facebook doesn’t actually accept inputs like this) that logs into Facebook’s mobile web page and does the business.

And Blake Brannon has put the two together, so a Tweet (that’s Web 2.0 talk for a Twitter post) will cascade to your WordPress blog, and then on to your Facebook status.

Neato, huh? Now that really is leverage. If it works. Which it does for many people, but it didn’t for me. I was having problems with Blake’s code; probably an issue with my Web ISP’s configuration. I ended up splitting it off to a separate WP plugin, which was messy, but allowed me to use the code in isolation, and figure out the problem.

It may be an issue that only affects particular versions of PHP or Apache or something — I’m no expert — but the problem was the Curl call couldn’t write to the cookies file. Creating the my_cookies.txt file and making it writable (777) and modifying the code slightly to specify where the file lived solved it. Another issue involved Curl being unable to use the FollowLocation flag, but it turned out this wasn’t needed.

I also ended up with Blake’s (modified) code in a separate file to Alex’s, rather than inserted into it as Blake intended.

So in summary

Update 2007-08-31: Blake’s been told that automated access into Facebook is against the Terms of Service. It’s unclear if Facebook will actively go chasing those who use or distribute code like this, but it would seem to pay to be cautious. Sorry.

  1. Download Alex King’s Twitter Tools and put in your wp-content/plugins directory
  2. Download twitter-wp-fb.txt. Put your Facebook details in where shown, then put it into your wp-content/plugins directory
  3. Create an empty wp-content/plugins/my_cookies.txt file and make it writable (777)
  4. Go into your WP Plugins page and activate both Twitter Tools and WP/Twitter to Facebook
  5. Go into the Twitter Tools config page and enter your Twitter credentials
  6. Cross your fingers and post something in Twitter

I think that’s all the steps. Good luck.

Thanks to Blake for his assistance on this. And to Alex and Christian, whose code this is all built on.

2 thoughts on “Twitter to WordPress to Facebook

  1. Pingback: Ted » del.icio.us bookmarks for September 8th through September 9th

Comments are closed.