Importing Basecamp Tasks into iCal

basecamp-logo-for-fluidI’ve been back and forth a thousand times on Basecamp– I love it and I hate it, and have tried every alternative, but I just keep coming back.  So instead of switching again, I’ve decided I should just start fixing the things that bug me, and I’ve started with the fact that I can’t get a feed of my tasks into iCal.  Since ICS feeds are read-only, there’s no way to be able to check off basecamp tasks in iCal, but I’ve started using Minco to track my time (great app, by the way), and it pulls in a list of items to track from your iCal to do list.  I’m sure you see where this is going– if I can push my Basecamp tasks into iCal, then Minco can see them.  Maybe you have another reason for wanting your tasks in iCal, but this was mine.  Anyway, thanks to Monte Ohrt’s Basecamp PHP API library, I was able to throw together an API tool to pull my tasks and push them out into an ICS feed in just an hour!  I’ve made this tool available so you can easily drop it into iCal and away you go.  Or, if you’d rather dig into it yourself, you can download my code from: http://tr.im/EjnN

To use this tool, all you need to do is make a couple quick edits to this URL:

http://bctasks.hdev1.com/mytasks.php?site=SiteURLSegment&user=YourUsername&password=YourPassword

Username and Password should be self explanatory.  SiteURLSegment is the portion of your Basecamp URL between the http:// and the .basecamphq.com/ — if your Basecamp account is at http://hotchkissconsulting.basecamphq.com/, your SiteURLSegment would be hotchkissconsulting.

Nothing shows better than an example, though, so here’s what my URL would be if my password was ‘iLovePHP’

http://bctasks.hdev1.com/mytasks.php?site=hotchkissconsulting&user=sam&password=iLovePHP

Then, to feed your tasks into iCal, all you need to do is:

  1. Open iCal
  2. Select ‘Subscribe’ from the Calendar menu
  3. Enter your custom URL
  4. Make sure “Remove To Do Items” is NOT checked
  5. Set your auto-refresh to however often you want to check for new tasks and get rid of completed ones
  6. Press Okay

and Voila, all your Basecamp tasks are there in iCal.

Since BC tasks are context based (they sit within a project and a task list so you know what they’re about), I brought in this information, so your task in iCal will show up as “ProjectName ListName – Task Name”

Also, I’ve put in ‘short name’ functionality. A lot of my tasks are fairly verbose, and I want to be able to see what the task is quickly and easily.  So I put in support for short names– you can use this in the project name, task list name, and the title of the actual task.  All you have to do is put the name you want to show up in iCal inside [square brackets].  So, if I had a task list named “Preparations for Launch [Launch]”, the feed will only show the list name as “Launch”.  This helps to keep things short and reasonable.

Questions?  Comments?  Let me know!

Note: I do not store your Basecamp username and password– this information is passed directly through to 37signals and never gets stored on my server.  If you’re uncomfortable with this, feel free to download the source code and run it on your server.

3 Responses to “Importing Basecamp Tasks into iCal”

  1. Yuri Victor

    This was awesome. Thanks.

    For secure basecamp: you'll have to edit mytasks.php and add an s to http in $url ($url = 'https://'.$sitename.'.basecamphq.com/';)

    Also, if you want to use due dates, edit the mytasks.php

    ADD TO foreach($list->{'todo-items'}->{'todo-item'} as $item) LOOP

    $item_dueat = $item->{'due-at'};
    $dueatCharacters = array(":", "-", "Z");
    $item_dueat2 = str_replace($dueatCharacters, "", "$item_dueat");

    CHANGE $the_list[] to THIS
    $the_list[] = 'DUE:'. $item_dueat2 . "n" . 'SUMMARY:' . $project_name . ' ' . $list_title . ' – ' . $item_text . ' (|'.$item_id.'|'.$list_id.'|'.$project_id.'|)' . "n";

    DELETE SUMMARY IN BOTTOM FOREACH LOOP:
    BEGIN:VTODO

    END:VTODO

    Reply
  2. Bergen

    Is this still alive? Sounds great… but I get this:

    Warning: Invalid argument supplied for foreach() in /home/samhotchkiss/bctasks.hdev1.com/mytasks.php on line 60

    Warning: sort() expects parameter 1 to be array, null given in /home/samhotchkiss/bctasks.hdev1.com/mytasks.php on line 110
    BEGIN:VCALENDAR CALSCALE:GREGORIAN X-WR-CALNAME:Basecamp Task List X-WR-TIMEZONE:US/Eastern VERSION:2.0
    Warning: Invalid argument supplied for foreach() in /home/samhotchkiss/bctasks.hdev1.com/mytasks.php on line 117
    END:VCALENDAR

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *