WordPress publisher bot

Inspired by offlineblog’s blog about Live blogging and the WordPress plugins like described on my blog, and at offlineblog and the bloggy robot which can publish to blogger.com. I thought this could also be possible to perform the same with a WordPress robot.

The solution simply works by adding the robot wp-bot@appspot.com to a Wave. Then it publishes your wave to the site as an embedded wave to WordPress. With this you get a permalink to the blog, where the content is hosted. I was unable to using the API’s that Google is using for displaying that the content is shared. If you know how to use please let me know.

I found the wordpress-java library to help with creating the XMLRPC code, which I was unable to use. With this library it is pretty simple to create a blog with some content. And since the content I’m posting just is wave id=’waveID’ bgcolor=’#ffffff’, it is pretty easy to craft.

The robot in action works the following way.


The code looks like the following.

public class WPRobotServlet extends AbstractRobotServlet {
      private String ownname = "wp-bot@appspot.com";
    public void processEvents(RobotMessageBundle bundle) {
        Wavelet wavelet = bundle.getWavelet();
        // when the Robot is added publish to the robot
        if (bundle.wasSelfAdded()) {

            Blip blip = wavelet.appendBlip();
            TextView textView = blip.getDocument();
            textView.append(ownname+ " added version " +this.getVersion() +" \n");
            textView.appendMarkup("\n <a href=\"http://masteringwave.com/\">MasteringWave</a> <br />");
            String rootText = wavelet.getRootBlip().getDocument().getText();
            // find the first line, which will be the title to the blog
            String firstLine ;
                firstLine =     rootText.substring(0,rootText.indexOf("\n"));
                firstLine = rootText;
            textView.append( uploadWave(firstLine, wavelet.getWaveId()));

    private String uploadWave(String title, String waveID){
           String sXmlRpcURL = "http://wp-bot.masteringwave.com/xmlrpc.php";
              String sUsername = "wave";
              String sPassword = "<SECRET>";
              // Hard-coded blog_ID
              String blog_ID = "1";

              // XML-RPC method
              String sXmlRpcMethod = "metaWeblog.newPost";
              // the content of the blog
              String sContent = "[wave id=\""+waveID+"\" bgcolor=\"#ffffff\"]";

                  // Try block to create the upload
                Wordpress wp = new Wordpress(sUsername, sPassword, sXmlRpcURL);
                  Page newPost = new Page();
                  String resultId = wp.newPost(newPost, "draft");
                  return wp.getPost(Integer.parseInt(resultId)).getPermaLink();
              catch( Exception e )
               return e.toString();


The full code can be found at http://code.google.com/p/masteringwave/source/browse/#svn/trunk/WP-BOT.

If you just want to check it out, just add the robot wp-bot@appspot.com to your Wave and the wave will be published.

Bookmark and Share

Published by


Daniel Graversen

Founder of masteringwave.com and SAP Integration consultant at figaf.com

8 thoughts on “WordPress publisher bot”

  1. I think there are two categories of wave plugins for wordpress

    1. Plugins that work from wordpress > to Wave
    2. Those work from Wave > to WordPress.

    This one is wave to wordpress, and looks like it is easy

  2. Hi, i wanted to ask some question about the WP robot on wave and also about the plugin.
    I have tried to make a wave hosting the WP-bot, but i don’t know how to tell him where to publish it 🙂 i know it’s dummy, but i really want to make my blog more “waveable”…
    Second, i did the wp plugin “wavr” in order to include my first wave on my page. But when i publish it, i can’t see the wave.
    So maybe there is something i have to put on the wave to let everybody see this? or maybe only the wave users can see my wave?

  3. Hi Alfonso,
    If you want to publish your waves to your own blog, then you need to download the source code and correct the robot to your url.

    Just when the preview wave system was released, the wavr plugin did not support the preview wave system. I recomend you update your plugin, activate it and try to see if what Java script code is generated correct.


  4. Thank you Daniel,
    when i wrote that (i didn’t specifym, sorry for that) i was using wave from the phone… i just received my invitation and i was unable to see Wave otherwise…
    Now i know that, in order to embed the wave with wavr, my wave must be “public”… but still can’t see my wave on my blogpost.
    Here is the URL i’m trying to embed my test wave (with wavr, not with wp-bot) http://www.pasife.net/public/wordpress/?p=969
    Tonight i will also try wp-bot. But i believe i miss other informations (basic ones, like “where the heck do i paste this code?” :D)

  5. Two questions:

    How do I correct the robot to include my URL and information so that it publishes to my site and not to WP-Bot?

    Also, how do you make a wave public so that it appears on the blog, and protect it so that no one else can edit it? I tried adding the robot public@a.gwave.com to my wave, but it wouldn’t add.

  6. Hi Thea,

    The robot is not configured to allow posting to other sites than my test site. You can create a robot your self.

    It is not possible to allow mixed rights at the moment with wave, so it is not possible.


Leave a Reply

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