Skip to content

Instantly share code, notes, and snippets.

@jamesob
Created August 21, 2012 20:23
Show Gist options
  • Save jamesob/3419060 to your computer and use it in GitHub Desktop.
Save jamesob/3419060 to your computer and use it in GitHub Desktop.
Hubot and Jaconda.im integration

Hubot and jaconda.im

So you want Hubot in a jaconda.im room and responding nicely, right?

How you get it

Register the bot

Get an account for your Hubot registered on both jaconda.im and Google with identical login information. I'm not sure if matching is strictly necessary; I haven't tested it.

Edit the Hubot account settings on jaconda for awareness of the Google identity.

Install hubot

Follow the Hubot installation steps as detailed on their wiki. Make sure that you install a standalone hubot for proper integration with the gtalk adapter. You can do this either by downloading the zipfile deployable from the Hubot site and using that, or by running the ./bin/hubot binary with the -c flag. I have only tried the former.

Now, follow the gtalk adapter installation instructions. Specify the environment variables as directed, with this caveat:

export HUBOT_GTALK_REGEXP_TRANSFORMATIONS=".+: (.*)|\$1"

The regexp transformation I found elsewhere didn't work for me, so be sure to try the one above as printed.

Test-boot Hubot with ./bin/hubot -a gtalk -n hubot; see that there're no errors. At this point, you should be able to initiate an IM with the hubot from your personal jaconda.im account. Ensure that works, then continue.

Make the jaconda room aware of Hubot

Getting a jaconda room to acknowledge Hubot's presence (and vice-versa) is an odd process, but it's a one-time kludge that's worked thus far for me. Log in to the Hubot's Google account and manually initiate a chat window with your room, which is probably a [email protected] address. In order to do this, I had to type that address into the chat search bar and click "invite to chat" or something like that. I was shocked when it actually worked.

After this, your Hubot should be picking up on messages coming through the chat. The regexp message filter that you've soldered into the gtalk adapter should be working its magic; if you have problems, try adding a console.log message expression within hubot/node_modules/hubot-gtalk/src/gtalk.coffee in the @message method definition.

Once you've verified (from another jaconda account) that your Hubot is responding to messages within the group chat, you can close the browser window containing the manually-initiated GTalk between Hubot and the chat. It seems that the chat's awareness of Hubot continues for perpetuity after the initial connection.

You should now have a Hubot properly (if not messily) integrated with a jaconda.im chat.

@lgladdy
Copy link

lgladdy commented Apr 25, 2013

If you use: ".+?: (.*)|$1" as the regex transformation, it fixes an issue should anyone ever use a : somewhere in their text :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment