How to Setup Google Apps Chat SRV Records For iChat and xmpp4r-simple

I’ve registered several domains using Google Apps. Lately I’ve been fiddling with using Jabber with those domains, and I wanted to have a program be able to interact on IM using an account like tim@example.com. Furthermore, I wanted to have everything Just Work.

The place to start was with DNS. Google has a help page about how to setup your DNS so that your Google Apps accounts can be federated with other non-Google Jabber communities. The problem is that neither xmpp4r-simple nor iChat simply work if I use tim@example.com as my JID. Then I stumbled across this post that connected the dots for me.

Here’s a screenshot of how I setup my SRV records over at eNom:

DNS SRV records for XMPP federation and client setup.

After that, my simple chat listener worked:

require rubygems
require xmpp4r-simple

im = Jabber::Simple.new(tim@example.com, secret-password)
puts im.connected?
im.accept_subscriptions = true

while true
  sleep(5) unless im.received_messages?

  im.received_messages { |msg| puts msg.body if msg.type == :chat }
end

My little “bot” silently accepted new buddy requests, and printed out recent messages every 5 seconds.

UPDATE: Something’s amiss here, I think. I’ll update when I have more details. Guess not. I tried this out on another domain, and thought that things didn’t work right. But I was mistaken. Everything looks good.

2 Responses to “How to Setup Google Apps Chat SRV Records For iChat and xmpp4r-simple”

  1. Sam Johnston Says:

    Works for me… thanks for taking the time to write this as last time I tried to get Jabber::Bot up and running with Google Talk I was getting connection errors and didn’t dig deep enough to see that Google had omitted the _xmpp-client._tcp.$domain records from their Google Apps documentation. I’ll see about getting the offending article (http://www.google.com/support/a/bin/answer.py?answer=34143) updated!

  2. Sam’s World Of No by Sam Phillips » The Various Shortcomings of Google Apps Says:

    [...] talk services, you have to add some SRV records to your domain, and there’s a few very useful pages out there on sorting this out. To summarise them, at the moment my understanding is that the [...]

Leave a Reply