Questions tagged [hubot]

Hubot is a an automation service / application. You can use hubot to provide access to resources through chat rooms, web services or other interfaces.

Hubot is a robot which runs using node.js and is written in coffee-script.

The documentation on the site does little justice to what Hubot can be used for, because it’s hard to explain that Hubot can be used for succinctly.

In short you can use Hubot to do anything that you are able to program.

See... terrible explanation.

Hubot can be configured to join your company chatroom and based on key words or regular expressions, Hubot can run commands, call APIs, execute scripts or programs… anything at all in the background and return the results to you in the chat room, without you having to change context.

I will give some examples of what Hubot can be used for to make understanding its value.

The two methods I will explain are: hear and respond . e.g.

robot.hear    /restart iis on "(.*)"/i, (msg) ->

robot.respond /restart iis on "(.*)"/i, (msg) ->

If you implement this as a respond function, you must address hubot directly in the chatroom.

john: hubot restart iis on myservername
bill: john just directly asked hubot to restart iis on myservername

However, if you were to implement this as a hear function. You could type a full sentence such as

john: I think if we restart iis on myservername it will resolve the issue.
bill: oops you just restarted the server

Hubot would automatically execute a restart of your iis server. In this case that would have been a bad thing.

With this basic premise that any task you can automate, can be implemented through hubot. You simply map a regular expression for hubot to watch for and either "hear" or "respond" to.

Here are a few ideas of how this could be of value:

  • Allow a person with no production access to execute specific tasks in production
  • Give developers are mechanism of requesting development environment refreshes from production in a chat room.
  • Since your interface to this functionality becomes your chatroom, you can use the chat room as audit documentation of who requested what task be completed.
  • Temporarily grant someone access to perform specific tasks by inviting them to special chat rooms, and removing them from the chatroom after the fact.

Here is a slide deck which discusses hubot/ chatops

ChatOps at GitHub by Jesse Newland

I hope this provides better insight into what hubot can do for you.

Find any repetitive task you do and give it a shot, see if you can write a hubot script to automate that task.

Check out sample scripts in the following deprecated repository for inspiration.

DEPRECATED HUBOT-SCRIPTS REPO

Official Info:

official hubot site

hubot source code

277 questions
9
votes
1 answer

Calling one command from another

I want to do some kind of alias, for example, hubot status should call hubot newrelic me and hubot gauges for today. I tried to do things like `msg.send "hubot newrelic me", but seems like hubot just ignore the message. How can I do that?
caarlos0
  • 20,020
  • 27
  • 85
  • 160
8
votes
1 answer

Can't retrieve username of user in Hubot

I can't seem to make this work, I'm just trying to print out the username of people who've just entered robot.enter (msg) -> msg.send "#{msg.user.name}"
lemon
  • 9,155
  • 7
  • 39
  • 47
7
votes
1 answer

Display ANSI colours in a Slack Snippet

I am using Slack and Hubot to run a few commands on our servers, the stdout and stderr of these commands is uploaded to a channel as a snippet. Some of these commands return colour outputs and are displayed in the snippet as ANSI colour codes…
Shipra
  • 1,259
  • 2
  • 14
  • 26
7
votes
1 answer

How do I find the name of the room Hubot is responding to?

I'm writing a Hubot script to connect with our tracking system at work. It should be triggering a PHP script with various parameters, and then that script will send the response into the room. How can I tell which room the message that Hubot is…
Ben Craig
  • 308
  • 9
  • 19
6
votes
3 answers

How to make Hubot understand chat context?

Is there any way to make Hubot understand the context of conversation between messages? Such that he could ask me clarifying questions? For example: me: hey, create a branch plz Hubot: How should I name it? me: super-duper Hubot: Branch…
Anton Rudeshko
  • 1,039
  • 2
  • 11
  • 20
6
votes
2 answers

Hubot's github-pull-request-notifier.coffee

I recently got a hubot setup for irc and works fine. I'm trying to add this script. I'm not entirely understanding the setup instructions however. The setup instructions read curl -H "Authorization: token " \ -d…
Blaine Kasten
  • 1,633
  • 1
  • 15
  • 27
5
votes
1 answer

Coffeescript regex not matching as intended

I'm trying to write a hubot script that answers to two different kinds of input. A user can either input the name of a stop for the local public transport or optionally postfix this with a delay. The input can therefore be dvb zellescher weg or dvb…
Kilian
  • 2,122
  • 2
  • 24
  • 42
5
votes
1 answer

CoffeeScript - Execute bash script with arguments

I am playing around with GitHub's Hubot, and I try to execute a bash script inside my robot work. I succeed executing my script, but cannot get it working if I add some arguments to this script. { spawn } = require 'child_process' s = spawn…
eouti
  • 5,338
  • 3
  • 34
  • 42
5
votes
1 answer

Hubot hangs/freezes when launching

I am able to get Hubot to work when running in the command line. However, when I try and connect it to a grove.io it seems to 'hang' or 'freeze'. I get just two lines: [Fri Feb 07 2014 18:23:43 GMT+0000 (UTC)] WARNING The HUBOT_AUTH_ADMIN…
5
votes
1 answer

Match up user name and @mention name in Hubot on HipChat

Is there a way to find an @mention name for a user name (either the numeric xxxx_xxxxxx or full name) and vice versa? Looking at the msg.message object there is a user object with the id, jid, and name of the person the message was from. I'd like to…
Aaron
  • 13,349
  • 11
  • 66
  • 105
4
votes
1 answer

AssertionError while testing Hubot script with hubot-test-helper and chai

I'm writing a simple test for my Hubot (which acts as a Slack bot) to check that my bot sends a reply in response to triggers. I've followed the example shown in the docs, but test results in an AssertionError (details below) and I'm not sure why.…
reesaspieces
  • 1,600
  • 4
  • 18
  • 47
4
votes
0 answers

Rocket Chat Hubot Adapter is not replying back

Hi i am running hubot with rocket chat. I have created another user "mybot" having bot role and used it and got connected successfully. Below are my environment variables export ROCKETCHAT_ROOM='' export LISTEN_ON_ALL_PUBLIC=true export…
jitendra rajput
  • 612
  • 10
  • 15
4
votes
1 answer

How to add role to a user after private message to Hubot with password

I would like to add a new role for a user, when he is able to give the right password to Hubot. Here is the script i have for now : module.exports = (robot) -> robot.respond /PasswOrd (.*)/, (res) -> paSS = res.match[1] if paSS is "1234" …
bob dylan
  • 989
  • 2
  • 10
  • 26
4
votes
1 answer

Deploy Hubot on AWS Lambda?

I'm a noob using Hubot, so please bear with me. I was going through Hubot's documentation ( https://hubot.github.com/docs/deploying/ ) and saw that we can deploy to Heroku, Unix systems and others. May I know how can Hubot be deployed on AWS Lambda…
DjangoRocks
  • 13,598
  • 7
  • 37
  • 52
4
votes
1 answer

Can Hubot send an HTML or other type of formatted message to Hipchat?

Looking at the Hubot documentation there seems to be no way to send a formatted message to the Hipchat client from a Hubot script. Does anyone know of a way to better present lines of text sent from Hubot? Version 1 of the Hipchat API (albeit…
1
2
3
18 19