Tim Riley

Accessing Basecamp's writeboards programatically with Ruby

January 8th 2009

Basecamp’s writeboards provide a great facility for versioned, collaborative document editing. However, any user of Basecamp will be able to tell you that they don’t fit in as neatly as the other components of the system. Going to a writeboard takes you to an interim “loading” page before displaying the writeboard outside the regular interface of Basecamp.

To the developer, the difference between writeboards and the rest of Basecamp is highlighted further because writeboards are the only part of the app without an API. The enterprising Ruby developer, however, sees this as no barrier! So without further ado, I bring you writeboard-rb, a little Ruby class that allows you to access the contents of a writeboard programatically:

wb = Basecamp::Writeboard.new(
  :url        => 'http://bigcorp.updatelog.com/W1234567',
  :username   => 'user',
  :password   => 'pass',
  :cookie_jar => '/tmp/foo',
  :use_ssl    => true
)

puts wb.contents

Behind the scenes, no fewer than five calls to the curl command line utility are made, along with a wee bit of Hpricot screen scraping to facilitate a form post otherwise made with JavaScript during the normal writeboard loading page. Using curl is necessary here because we need to preserve session cookies for both the Basecamp and Writeboard domains during the process of fetching the writeboard’s contents.

Anyway, please go check out the code on github, and feel free to fork it to make any improvements or extensions! I hope it can come in handy for you. It was a fun little challenge to take it this far.

Tim Riley

Hi, I'm Tim Riley. I'm a web developer based in Canberra, Australia, where I work at a small design studio called Icelab. This is my blog, where I can share with you the things I learn as I go about building products for the web.

What I Build

Recent Presentations

  1. Facebook Authentication with OAuth
  2. JavaScript Testing with Capybara and Cucumber
  3. Using Titanium to Build Mobile Apps with JavaScript (audio)
  4. An Introduction to Sinatra
  5. Building your Capistrano Recipe Book