Prototyping a Drupal Module for Google Wave

Friday, August 14, 2009 | 7:00 PM


Even before getting my invite to the Google Wave developer preview, I had started brainstorming new and interesting things I could contribute. One of the other things I wanted to try was embedding a wave into my Drupal site, since Blogger integration had already been demonstrated and I see a lot of potential in the combination of blogs and wave.

For the Drupal module, I began with their generic 6.x module tutorial . Since all I needed was to add a few pieces of javascript, it wasn't hard to do. I used the drupal_set_html_head() function to include the embed.js file, then used the drupal_add_js() function for the chunk of javascript specific to loading the wave into a container div.

At this point I was able to load a specific wave into the div, but had to specify the waveid in the module itself, because it was included in the header of the page. Considering this to be inelegant, I recalled some of my experiences with jQuery, and how it could pull contents from a div element given that it had a known id. I used the results of calling jQuery's .html() function on the DIV as the parameter to wave.loadWave() to provide it with the Wave ID. This appealed to me as a more elegant solution since I could specify the waveid in the contents of the page and put different waves on each page.

A wave can be embedded into any page by downloading, extracting, installing, and enabling the Google Wave Drupal Module.

Afterwards, add this content to any page and the wave will be embedded after the page loads:

<div id="wave" style="width: 560px; height: 420px">!waveid

This module was written in a couple days, so there is still plenty of room for improvement on it. One feature it lacks is the ability to change the font color/size and other options set using the wave.SetUIConfig() method. Although I'm proud of having written this module, it is by no means the only module out there for Drupal integration. Another module using a different technique, but with configuration options for things like font size and color, is available at

Several features would make the Embed API even more compelling, like the ability to embed Waves that anyone can read (regardless of whether they have a Wave account), and the ability to specify an alternative wave for visitors who don't have permission to view the embedded Wave.

As the Google Wave APIs continue to expand, even more robust modules can be written to take advantage of Google Wave's unique features. One such idea would be a robot for Drupal that acts in much the same way as Bloggy: publishing waves as pages to a Drupal instance, and allowing the management of a site's contents primarily through wave.

One of the things I find most exciting about Wave is that it comes in a time when so many services online are available through SOAP/REST/XMLRPC interfaces, and budding developers like me can theoretically integrate all of these services with Wave. Along those lines, I've been working on a robot that integrates Trac (issue tracking) and I'm also looking to write a module to embed waves into Elgg, since both of those are heavily used for my graduate project, Beaversource.

I hope that other users will find my Wave modules as useful as I have, and other developers will be inspired to integrate Wave into their own systems.