Here's how to add a new message route to allow the xmpp bot to respond with the message 'hello you' when it receives the message 'hi'.
require 'xmpp-agent' xa = XMPPAgent.new xa.add_route ('hi') {|params, messenger, msg| messenger.deliver(msg.from, "hello you")} xa.run('switchboard@rorbuilder.info', 'secretpassword')
Note: The routes (similar to Sinatra routes) can accept a regular expression or a string.