Skip to content

Hubot’s Gtalk Adapter

by arlo on November 5th, 2011  Tip

Hubot is an awesome chatbot written by the Github Team and opensources recently. At work we don’t use chatroom environments, instead we use Gtalk. Our campus has staff located in several building and we all communicate via our enterprise Gtalk. IT and non tech savvy people have taking a liking to communication via the messenger. Naturally upon seeing hubot in all his glory, I knew that he MUST be part of my workplace’s culture.

Gtalk Adapter

If you are interested in using this adapter in your private Hubot and do not want to upgrade Hubot to v1.1.9, you can download the adapter at my repo.

The beauty of the Gtalk adapter is that is only depends the node-xmpp node package, which is already part of hubot. You can literally drop in that adapter and you are good to go.

Environment Variables

Even though the official Hubot wiki has a page about this adapter, here are the two environment variables you need:

export HUBOT_GTALK_USERNAME="example@domain.com"
export HUBOT_GTALK_PASSWORD="account password"

Enjoy

If you have any issues with the Gtalk adapter or wish to submit a feature request, feel free to create an issue on Hubot’s main repo and mention @mexitek in the description or the comments. In mentioning my name I will be notified and Github staff will bug me to support the adapter.

From → Hubot

  • http://twitter.com/ArticleManagers Article Manager

    Id really like to get talk version of my hubot working, but I don’t know what I’m doing wrong… In normal case there is a request to accept contact on talk chat. How do you manage that initial request with bot?

  • http://www.arlocarreon.com Arlo Carreon

    Good question. In my case, our mail domain is being handled by Google (google enterprise apps), so I automatically see Hubot when I add him.

    Otherwise, if you are using this with a normal gmail account, you have to: 
    1.) add hubot to your buddy list. 
    2.) log into gmail with hubots account and go to the chat (bottom left sidebar) and accept the request.

    I am looking into adding a configuration variables where you can say what domains or email addresses Hubot should accept automatically. Until then, those are your options. =)

  • http://www.arlocarreon.com Arlo Carreon

    Just to let you know, github merged my pull request last night for hubot accepting buddy requests from certain accounts or domains.

    https://github.com/github/hubot/pull/150

  • http://twitter.com/ArticleManagers Article Manager

    Fantastic, can’t wait to test it again!

  • Svovel

     Hi,
    When starting hubot locally with the -a gtalk switch I get this message:
    “Cannot load StringPrep-0.1.0 bindings. You may need to `npm install node-stringprep’ ” even tho node-stringprep is installed

    any ideas? 

  • http://www.arlocarreon.com Arlo Carreon

    Yes, node-stringprep is not a dependancy for gtalk, but rather another package that comes with hubot.

    For what it’s worth you can run this inside the hubot [base] directory: “npm install stringprep”

    That should fix the error. On another note, @thetombell just launched hubot 2.0 which lets the adapters reside in their own npm package. This change will make installation a lot cleaner and avoid problems like these. I am working on releasing a gtalk 2.0 adapter shortly.

  • Svovel

    thanx for the quick reply, but I’ve tried to do a ‘npm install stringprep’.. installs successfully, but same error :/
    testing it on an ubuntu 11.10 64bit box 

  • Svovel

    ./bin/hubot -a gtalk

    > node-stringprep@0.1.2 install /home/edocon/scripts/hubot/node_modules/node-stringprep
    > sh ./install.sh

    Checking for program g++ or c++          : /usr/bin/g++
    Checking for program cpp                 : /usr/bin/cpp
    Checking for program ar                  : /usr/bin/ar
    Checking for program ranlib              : /usr/bin/ranlib
    Checking for g++                         : ok
    Checking for node path                   : ok /home/edocon/.node_libraries
    Checking for node prefix                 : ok /usr/local
    ‘configure’ finished successfully (0.812s)
    Waf: Entering directory `/home/edocon/scripts/hubot/node_modules/node-stringprep/build’
    Waf: Leaving directory `/home/edocon/scripts/hubot/node_modules/node-stringprep/build’
    ‘build’ finished successfully (0.038s)

    [Thu, 08 Dec 2011 22:41:40 GMT] INFO Loading adapter gtalk
    Cannot load StringPrep-0.1.0 bindings. You may need to `npm install node-stringprep’
    [Thu, 08 Dec 2011 22:41:40 GMT] ERROR Cannot load adapter gtalk – TypeError: Object function Gtalkbot() {
          this.error = __bind(this.error, this);
          this.handlePresence = __bind(this.handlePresence, this);
          this.handleMessage = __bind(this.handleMessage, this);
          this.readStanza = __bind(this.readStanza, this);
          this.online = __bind(this.online, this);
          Gtalkbot.__super__.constructor.apply(this, arguments);
        } has no method ‘use’
    [Thu, 08 Dec 2011 22:41:40 GMT] INFO Loading scripts from /home/edocon/scripts/hubot/scripts
    [Thu, 08 Dec 2011 22:41:40 GMT] INFO Loading scripts from /home/edocon/scripts/hubot/src/scripts
    TypeError: Cannot call method ‘run’ of null
        at Robot.run (/home/edocon/scripts/hubot/node_modules/hubot/src/robot.coffee:225:27)
        at Object. (/home/edocon/scripts/hubot/node_modules/hubot/bin/hubot:105:11)
        at Object. (/home/edocon/scripts/hubot/node_modules/hubot/bin/hubot:108:4)
        at Module._compile (module.js:432:26)
        at Object.run (/home/edocon/scripts/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:66:25)
        at /home/edocon/scripts/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:147:29
        at /home/edocon/scripts/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:115:19
        at [object Object]. (fs.js:115:5)
        at [object Object].emit (events.js:64:17)
        at afterRead (fs.js:1111:12)

  • http://www.arlocarreon.com Arlo Carreon

    Quick Hubot: https://hubot-factory.herokuapp.com/
    This will get you a hubot in a matter of seconds. All you need is a heroku account, that is all.  Perfect for showing off hubot to friends and yourself.

    If you need a local hubot for testing or development.  Try searching the github.com/github/hubot issues for this same problem.  There are some threads that talk about updating the package.json file. https://github.com/github/hubot/issues/search?q=stringprep

    Also, what version of hubot are you running? Did you download hubot or did you use “npm install hubot”?

  • 零七 零

    link has broken