Google Wave – My First Bot

Google Wave – My First Bot

Last week, I went to the Google Technology User Group in London, which was all on the subject of Google Wave.  Lars and Steph, of Google Wave video, and Google Maps fame gave an excellent talk on Wave, how it was doing, where it was going, and the challenges they’re still facing in getting Wave ready for prime time and a public release.

I’ve had a developer account for some time now, and the talk finally got me motivated into messing around with more of the APIs.  So I created a bot.  Then I created another one.  Because the first one didn’t do anything.

1.  Get Eclipse

So far, the choices for creating Google bots are rather limited because there are rules that they must be hosted on AppEngine (for now).   So first off, get Eclipse – because it makes the entire process of doing that incredibly easy.  You can download Eclipse here.

2.  Get the AppEngine SDK.

Once you’ve got Eclipse installed and running, go to Help -> Install New Software.  Enter this URL to get at the Google AppEngine SDK.

3.  Create your project.

Go to File->New, and select Web Application Project.  If you don’t have that option, something’s gone wrong with your SDK download, so check step 2.

Uncheck the Googe Web Toolkit, we don’t need that.  But otherwise fill out the Project Name and Package as you see fit.

4.  Add the libraries from the Wave extensions SDK

Download wave-robots-api.jar, json.jar, and jsonrpc.jar and drop those into your project under war/WEB-INF/lib/.

Once you’ve done that, select File->Refresh, then Project->Properties from the main menu, and select Java Build Path.  Click Libraries, and Add JARs, to select the three that you’ve just added.

5.  Write your servlet class.

This is where the bulk of your bot logic (or lack of it), goes.

[codesyntax lang=”java”]package helloworld;

public class HelloWorldServlet extends AbstractRobotServlet {
public void processEvents(RobotMessageBundle bundle) {

for (Event e: bundle.getEvents()) {
if (e.getType() == EventType.BLIP_SUBMITTED) {
Blip blip = e.getBlip().createChild();
TextView textView = blip.getDocument();
textView.append(“Hello.  Are you the world?”);

6. Add a servlet mapping.

Edit the file, war/WEB-INF/web.xml and add a servet-mapping just below the one you have already.

[codesyntax lang=”xml”]<servlet-mapping>


7. Add a capabilities file.

Add a folder under war/_wave. Create a file under that called capabilities.xml. This tells Wave which events your robot is going to respond to. In our case, we’re going to respond whenever a blip is saved (blip_submitted)./ There is a full list of capabilities in the full api docs.

[codesyntax lang=”xml”]<?xml version=”1.0″ encoding=”utf-8″?>
<w:robot xmlns:w=”″>
<w:capability name=”BLIP_SUBMITTED” content=”true” />

8.  Get an AppEngine account.

That kind of finishes off the Wave-bot.  So you’ll need an AppEngine account to continue.  So go ahead and sign up, and create an application.  Incidently, I couldn’t find my created apps since I have a Google Apps / Domain account.  if that’s the case for you as well, you can find your apps list at<domain>.  Not sure why Google don’t detect that, but there we go.

9.  Deploy to AppEngine

Click the friendly little icon ae_deploy_button from your Eclipse toolbar, and enter your details to deploy you new robot.  Try not to scream “fly my pretties” as you do so.  I dare you.  Make sure you click the App Engine Project Settings button, and provide you Application ID, the same as you created in step 8.

10.  Add your app to a wave

The address of your robot will be, and you can add it just like any other robot.

You should now be able to interact with your bot.


And if you’d like to see my first bot in action – please drop in and say hello by adding it to your wave:

Now. World peace.  Where did I leave that file?

Tags: , , , , , ,

One Comment

    • beatwho
    • November 18, 2009
    • Reply

    web.xml has a typo


    should have a slash

Leave a Reply?