Uncategorized

Hubot @ your service

A few months back, i got a chance to attend the rootconf2012, where i first came to know about “Hubot” , developed by github. I was very much interested, especially the gtalk plugin, where we can integrate “hubot” with a gmail account. We can make Hubot listen to every words and make it to respond back. There are so many default hubot-scripts which we can use to play around with it.

Configuring Hubot is very simple.

First, we’ll install all of the dependencies necessary to get Hubot up and running.

apt-get install build-essential  libssl-dev  git-core  redis-server  libexpat1-dev curl libcurl4-nss-dev libcurl4-openssl-dev”

 

Now, Download and extract Node.js

wget http://nodejs.org/dist/v0.9.2/node-v0.9.2.tar.gz”

tar xf  node-v0.9.2.tar.gz -C  /opt  &&  cd /opt/node-v0.9.2″

“./configure && make && make install”

For Gtalk Plugin we need “node-xmpp“. So we can use “npm” to install it. We also need CoffeeScipt.

“npm install node-xmpp”

“npm install  -g coffee-script”

Now clone the Hubot repository from GitHub.

“git clone git://github.com/github/hubot.git”

Now go inside the hubot folder and using the “hubot” binary inside the bin folder create a deployable hubot.

“./bin/hubot -c /opt/hubot”

Now go inside the new hubot folder and open the “package.json” using a text editor and add the hubot-gtalk dependency package.

“dependencies”: {
   “hubot”: “2.3.2”,
   “hubot-gtalk”: “>= 0.0.1”,
    “hubot-scripts”: “>= 2.1.0”,
   “coffee-script”: “1.3.3”,
    “optparse”: “1.0.3”,
    “scoped-http-client”: “0.9.7”,
    “log”: “1.3.0”,
    “connect”: “2.3.4”,
    “connect_router”: “1.8.6”,

Now use “npm install”  to install the dependencies.

Before starting the hubot, we need to configure the below parameters for Gtalk Adapter.

The GTalk adapter requires only the following environment variables.

  • HUBOT_GTALK_USERNAME (Should be full email address, e. g. username@gmail.com)
  • HUBOT_GTALK_PASSWORD

And the following are optional.

  • HUBOT_GTALK_WHITELIST_DOMAINS
  • HUBOT_GTALK_WHITELIST_USERS
  • HUBOT_GTALK_REGEXP_TRANSFORMATIONS

Once all the parameters are set, we can start the Hubot with Gtalk adapter.

“./bin/hubot -a gtalk”

Now Hubot is online with Gtalk. No we can add the Hubot gmail account to our Gtalk Account and start playing around with it. Hubot comes with a bunch of default scripts. If we type “help”, we will get a a bunch of options for each of these scripts.

Today I was able to execute some Bash commands, using my custom coffee scripts, which gave me some weird ideas, to use “Hubot” for “ChatOPS“. Let’s see how it works. Once it’s done i’ll update it in my blog. Wait for more……………….

Advertisements
Standard

9 thoughts on “Hubot @ your service

  1. Man, I’m afraid this doesn’t work on my system. Ubuntu 11.10, Node v 0.9, Hubot v 2.1.3.

    Can you tell me your node version, hubot version, and other things you think might help. I get various annoying errors, incomplete dependencies and incompatibilities.

      • Hi, thanks for that. I got it working using your versions. Also turned out I had a missing Ubuntu package called “libicu-dev” which kept causing me errors.

        So i’ve got him up and running, but am unable to get a reply. I’m going to go through your steps again and see if I missed anything.

      • Hi,

        Good to hear that. And have you whitelisted the emailid or domain. If your are trying to access the hubot id from another gmail id, you have to whitlist the GMAIL id from which you are trying to reach Hubot, other wise Hubot will not reply it to you.

      • outrunthewolf says:

        I certainly did. Turns out with all my messing I had numerous multiple installs of dependencies.

        So I cleaned out Node and everything and started again. Your tutorial worked perfectly. One thing to note is node-expat (which i needed) could only be installed globally via npm, and I did have to whitelist my domain for some reason.

        Thanks man, most up to date post on installing hubot ive used. Thanks for your help, hopefully if anyone else has problems this might help

  2. Bbloke says:

    Hi,

    Did you ever do another blog post on executing bash commands with hubot? I need to do that, I need hubot to do a ‘host -t TXT .specialdomain’ and return the result when I say “hubot query text ”

    Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s