Using Hubot with Slack

Slack is the latest hip tool that technology teams have come to depend on. Based on an idea eerily similar to Internet Relay Chat (IRC) that was extremely popular back in the mid-nineties, Slack allows teams to collaborate in web and app based chat rooms and  is growing in popularity with enterprises as well as the smaller start-up world where it first took off, as larger businesses are realising that Slack provides a very neat audit trail through the log of the chats themselves.

2016-08-27 11_08_43-Slack_ Be less busy

Slack is extremely extensible, and this is where Hubot comes in. Slack is the perfect interface for Hubot as bots can be team members in Slack, appearing in chat rooms and interacting like everyone else.

Slack offers accounts at different price points, from no cost and quite restricted up to enterprise level that costs more but comes with all the bells and whistles. I dove in with a free account to facilitate testing of my bot.

Once the Slack account was up and running along with the associated team (which I couldn’t resist calling “Chatty McChatface”), I was ready to deploy my Hubot (Io).

In Slack, you simply navigate to the Apps directory and search for Hubot.

2016-08-27 11_18_12-Configure Apps _ Chatty McChatface Slack

There follows a handful of simple configuration steps which include generating an access token. This is important as that token is used on the server hosting Hubot to enable the connection with Slack, in much the same way as the access and secret keys enable access with AWS. (The next post will deal with environment variables like this one).

With Hubot configured in Slack (and connected on the server) it’s possible to use a chat room to interact with Hubot. Initially, the bot will have a direct or private room for 1:1 chat, like any team member. Here, simple tests can be carried out in private to ensure all is working as it should.

2016-08-27 11_30_40-io _ Chatty McChatface Slack

There’s far more value in having Hubot out in the open in one of the team rooms and enabling that is as simple as inviting Hubot to join the room, just like you would for a human team member, through the “/invite @[BOTNAME]” command.

2016-08-27 11_34_52-random _ Chatty McChatface Slack

Now that Hubot was in place and working, AWS functionality could be tested. The hubot-aws script features a lot of commands, but a simple listing (ls) command of one of the AWS services is enough to ensure connectivity. Like any good bot, Hubot will list all the commands he supports through the “help” command.

2016-08-27 11_37_52-random _ Chatty McChatface Slack

So there you have it, a working Hubot implementation, connected to and interacting with AWS, presented through Slack.

Up next, how to use Systemd to automate the running of Hubot.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: