When I found out that Confluence has an XMLRPC interface, and the Groovy had an XMLRPC module, I started to think of a very simple way to make sure people remember when they’re rostered on Morning Tea.

My criteria for the app was "What’s the simplest thing that could possible work?" I figured a morning tea page on the Wiki, with a table of dates and names. My script is cronned to run once a week, scrape the page, parse the table, convert names to email addresses, and send em a reminder.

I told a mate that I reckoned I could put something together inside a lunch hour. 20 minutes later I was good to go.

Confluence needs a username and password to logon, so just using a scraper was no good. Fortunately the XMLRPC interface is a snack. To slurp down a secure confluence page, you just grab a token, the make the appropriate getPage call:

import groovy.net.xmlrpc.*; def c = new XMLRPCServerProxy("http://yourhostname/confluence/rpc/xmlrpc") def token = c.confluence1.login("user","password")  def page = c.confluence1.getPage(token, "YourSpaceId" , "Morning Tea Roster") def content = page["content"]  

Once you’ve got a handle to the content, it’s just a matter of some regular expressions to parse out the names, and you’re ready to email.

Groovy’s AntBuilder makes email integration equally straightforward:

new AntBuilder().mail(    mailhost: 'yourmailhost',     subject: 'Morning Tea') {      from(address: 'glen.smith@yourdomain.com.au')      to (address: 'the.person@yourdomain.com.au')     message( 'morning tea is on you today' ) )

And you’re off and emailing. You’ve just gotta love scripting languages…

Props to Tug for the XMLRCP module, and to the Confluence boys for providing the interface. Top Stuff. If you guys are ever in Canberra, Australia, the next donut’s on me.