Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple demo script for creating an XMPP bot wiht Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Gtalk Bot

This is a simple script demonstrating how to create a basic XMPP bot in Ruby.

The bot will authenticate to Gtalk, automatically accept any incoming “add contact” requests, and echo received messages back to the user — totally useless, but functional.

I've also included a little script to daemonize the bot using the Ruby Daemons gem.


Open ./bot/gtalk-bot.rb and set your username and password - this could easily be abstracted out into a config file if desired.

If you wish to enable logging, open ./im.rb and change :log_output to true.


Running the bot as a daemon is pretty straightforward:

ruby im.rb start     # starts the bot
ruby im.rb restart   # restarts the bot
ruby im.rb stop      # stop the bot

To run the bot as a background process using Screen:

screen -dmS myGtalkBot ruby ./bot/gtalk-bot.rb

Or simply run the script from the command line (good for testing):

ruby ./bot/gtalk-bot.rb


ruby ./bot/gtalk-bot.rb &    # start the bot in the background
Something went wrong with that request. Please try again.