Wednesday, December 12, 2007

Google Talk Groupchat

Google talk has recently added a groupchat feature to their talk gadget. This allows multiple users to join a common channel, like IRC or a chatroom on AIM. This is a great feature, and I have personally used it a few times now for working on homework assignments with a small group.

However, it is currently only supported (AFAIK) on Google's Flash-based talk gadget. This is alright because of its compatibility with anything that can run flash, but a flash-based client can only do so much. I use Pidgin as my chat client. Formally known as Gaim, this open source program can connect to all major protocols, including the Jabber network, which is what gtalk is on.

So when I heard Google was supporting groupchats, I was eager to see if I would be able to connect to the server using pidgin, like I would be able to on any other Jabber server. Well, unfortunately, that isn't available (yet, I hope). It looked like I would be stuck using the flash client.

However, there is a way to connect to an existing groupchat, and even create a new room. Since Jabber is an open protocol, all messages are sent in plaintext, and are easy to understand. Using a tcpdump, a common packet sniffer, I was able to read a message I had sent to the room. On it was the name of the room, in the standard Jabber format: room@server/nick.

The name of the room was "private-chat" followed a string of hexadecimal characters, in the following format:
private-chat-00000000-0000-0000-0000-000000000000
The server was groupchat.google.com.

With this data, we now know enough to connect from another client, such as Pidgin, following these easy steps:

1) Connect to your google talk account from Pidgin, iChat, or your Jabber client of choice.
2) Choose "Join a Chat", or the equivalent option to join a chat room.
3) To join an existing chat, either enter the room ID in the "Room" field. More on finding this later.
4) Use groupchat.google.com as a server
5) Use whatever nickname desired
6) Click connect!

Now, assuming the room ID was in the correct format, a new chat window should pop up. How do we find out what ID to use? There are two options that I know of currently: join the room the normal way (through an invite on Google's talk gadget) and capture an incoming/outgoing message using tcpdump, ethereal, wireshark, etc. Somewhere in the message there will be a field which specifies the room. It has to be in the above format; it isn't very hard to find. If this seems to technical, the other option is for someone else in the room to do this themselves, and post the room ID. The ID is the same for everyone in the room, and it doesn't change.

An alternative option would be to simply create a new room. If I were to create a totally random ID, say
private-chat-12345678-dead-beef-feed-fedcba987654, as long as it follows the rules it will work. If there is no one in the room already it will simply be created. Now the room ID can be sent to other members connecting from Jabber clients, or by using the "Invite" option in Pidgin, users on Google's talk gadget can be invited into the room.

So although Google has disabled convenient groupchatting (e.g. being able to connect to myroom@groupchat.google.com) they have at least left a way (intentionally?) for other clients to connect and create rooms.

16 comments:

Anonymous said...

Thanks. It worked for me.

Nick Head said...

Just figured out another way of doing it... When you get invited to a group chat with the hostedtalkgadget URL, click on the URL which then opens up the "JoeBloggs has invited you to a group chat" page, instead of clicking the "Launch Group Chat" button, go to the source of the page, and you'll see clear as day the javascript variable with the room ID. Worked for me :-)

Matt Kokotovich said...

Thanks for stopping by, and thanks for the hint. That is definitely easy than capturing the packets :)

Anonymous said...

Just tried Nick's method and verified it works. Thank you both for posting this!

Anonymous said...

HUMM...I can't get this to work. It keeps saying groupchat.google.com is not a valid server. Can someone direct me how to create a new chat??

Matt Kokotovich said...

I just tried it again, and I didn't have any problems. The room id needs to be in the *exact* format I mentioned, are you sure you had it correct? If so, maybe the server was down for maintenance. Good luck figuring it out!

mattack said...

I can't seem to find the room ID in the source... did it change?

Kent said...

Just Verified it works. Thanks Nick/Matt

Anonymous said...

In case anyone is still interested...

The random string (in the format 00000000-0000-0000-0000-000000000000) is a UUID.

You can create one with uuidgen in Linux and OS X, UUIDGEN.EXE in Windows, or on the web at http://www.famkruithof.net/uuid/uuidgen.

Nerita said...

Well said.

Shalabhsneha Katdare said...

If you do a View Source for "Launch Group Chat" Page...you will find following lines in [HEAD] section of the page:
[script type="text/javascript"]
var baseUrl = "http://talkgadget.google.com/talkgadget/";
var hostedDomain = "";
var room = "private-chat-6064e1fe-a901-4603-89d6-e634c61e492a@groupchat.google.com";
var user = "";
var windowInstance = "411670a648eeca97f5b9d703c91a6ede"

function launch() {
_joinPmuc(baseUrl, hostedDomain, room, user, windowInstance);
}
[/script]
var room houses the ROOM ID ;)
Enjoy!

Andrew said...

Like Anonymous said, in Linux use uuidgen, then in Pidgin, click Buddies > Add Chat, select your gmail account, for room, type in private-chat-*numbers_from_uuidgen*, server would be groupchat.google.com, then add. Once you join, you can invite other gmail folks to your private chat. Looks like if the uuid is unique, it will create a new chat room for you. Pretty cool.

javawizard2539 said...

This method has worked excellently. It's even inspired me to write a chatbot that can simulate named rooms: you will be able to invite the bot to these anonymous rooms and tell it a particular name for the room. It will then remember the room's whole "private-chat-..." name, and the next time you send it "join some-room-name", it will go look up the corresponding "private-chat-..." name and re-invite you to that room.

Rob said...

Trying to use ichat 5.0.3 to create a chat room, but keeps saying
"There was an error with Jabber."
1234@hello.com

I've check no firewall used, littlesnitch not active, using talk.google.com 5223

What could I be doing wrong?

mac 10.6.7

Thanks,
Rob.

explodedclown said...

Here's an AppleScript that will create a new GTalk group chat:

Here's an AppleScript that does all the work for you. It assumes that your Google Talk account is named "Google Talk", but that's easy to change.

set uuid to do shell script "uuidgen"
tell application "iChat"
set s to the first service whose name is equal to "Google Talk"
set c to make new text chat with properties {id:uuid, service:s, name:"Group Chat", active:true}
end tell
do shell script "open \"xmpp:private-chat-" & uuid & "@groupchat.google.com?join\""

It assumes your account is named "Google Talk" but that's easy enough to change.

Mink me said...

Just Sign up and enjoy MinkMe on your Phone Connect with Friends, Join Groups, Create Gossips, Share your Mood, Promoting your brand with Social media and much more, stay

connected.
Click Here To Download Free App
Take A Look @ Mink Display