Google Wave Embedded API : the missing tutorial

Google Wave provides an “Embedded API” that can be leveraged to insert a single Wave into any HTML page.
Unfortunately, the official documentation is somewhat old and gives the procedure only for the sandbox waves, not the regular ones, so here is a very short tutorial to help you integrate waves in your own websites/blogs in minutesĀ !

Finding the required parameters

First, create or open a Wave using the Google Wave website.
wave.png
When a Wave is selected and displayed, the page’s URL follows this patternĀ :

 https://<wave server>/<GUI configuration>:<wave type>!w+<wave id>.<some counter>

For example, our sample wave’s URL isĀ :

 https://wave.google.com/wave/?pli=1#restored:wave:googlewave.com!w%252BpRNN6dgjA

The two parameters we are interested in areĀ :

  • The serverĀ : “googlewave.com” (was “wavesandbox.com” for the “developer preview” accounts)
  • The Wave’s IDĀ : here, “pRNN6dgjA” (“w%252B” is only the URL-encoded representation of “w+“)

Embedding the wave

Now that we have the required parameters, let’s embed the wave.
This is as simple asĀ :

  1. Providing a container for the Wave (a simple <div> will do)
  2. Importing the Embedded Wave API
  3. Writing a few lines of Javascript to instanciate the WavePanel that will load the Wave
  1. <div id=”waveframe”></div>
  2. <script src=”http://wave-api.appspot.com/public/embed.js&#8221; type=”text/javascript”></script>
  3. <script type=“text/javascript”>
  4. var wavePanel = new WavePanel(http://wave.google.com/wave/&#8217;);
  5. wavePanel.loadWave(‘googlewave.com!w+pRNN6dgjA’); // This is where we specify the server type and wave ID
  6. wavePanel.init(document.getElementById(‘waveframe’));
  7. </script>

Styling the Wave

The default visual style is quite horrible, so let’s pimp it a bit.
First, you can apply some CSS styling to the container (ex: <div>). Feel free to get as creative as you see fit here, but you will want to provide a better “height” value (500px to 1000px), because the default size is ridiculously small.
Then, you can style the Wave itself. Well, sort of, because the WavePanel creates an IFrame in your container, so your page’s CSS have absolutely no effect on how the Wave is rendered.
To get around this, the API provides a “UIConfig” object that you can use to set some basic properties such as the background and foreground colorsĀ :

  1. <div id=”waveframe” style=”border:solid 1px #F90; height:500px;”></div>
  2. <script src=”http://wave-api.appspot.com/public/embed.js&#8221; type=”text/javascript”></script>
  3. <script type=“text/javascript”>
  4. // Styling
  5. var uiConfig = new WavePanel.UIConfig();
  6. uiConfig.setFooterEnabled(true);
  7. uiConfig.setHeaderEnabled(true);
  8. uiConfig.setToolbarEnabled(true);
  9. uiConfig.setBgcolor(‘#FFF’);
  10. uiConfig.setColor(‘#000’);
  11. uiConfig.setFont(‘verdana’);
  12. uiConfig.setFontSize(’12px’);
  13. // Wave embedding
  14. var wavePanel = new WavePanel(http://wave.google.com/wave/&#8217;);
  15. wavePanel.setUIConfigObject(uiConfig); // Set the style
  16. wavePanel.loadWave(‘googlewave.com!w+pRNN6dgjA’); // This is where we specify the server type and wave ID
  17. wavePanel.init(document.getElementById(‘waveframe’));
  18. </script>


Please note that the header/footer/toolbar-related parameters seem to have no visible effect – none I could find though.

Everyone’s welcome

Is your Wave is on a public website or blog, you may want to allow everyone to read and/or modif
y it. If you skip this step, only the current participants will see it.
To do this, get back to the standard Google Wave web interface, and add public@a.gwave.com to the Wave (you may need to add it to your contacts too). Then, click on its icon in your Wave and select “Full access” or “Read only” in the dropdown list. If you select Full Access, be aware that everyone will obviously be able to interact with the Wave and add, edit or remove replies.
public.png

Conclusion

Embedding a Wave is trivial once you get the correct instructionsĀ ; I hope Google will update their online docs soonĀ ! In the meantime, I hope this tutorial has been of some use to you.
The sample Wave use throughout this article is in “Full Access” mode, so feel free to drop a commentĀ !

Auteur/Autrice

Laisser un commentaire

Ce site utilise Akismet pour rƩduire les indƩsirables. En savoir plus sur comment les donnƩes de vos commentaires sont utilisƩes.

%d blogueurs aiment cette page :