Slack, Bots, Coffeescript, DoD, and SMS

Like every developer team working in Scrum, our Team OneAPI has a clear ‘definition of done’ (DoD) for each task, so someone else can try out a new feature, review code, etc. So much so that we even have a dedicated page on Confluence.

Now, the concept of that someone else is the most difficult part of this process. You must find that “lucky” person. Why you try, suddenly everyone is busy, in a rush or turns deaf. So, we had to randomize it.

FIRST ITERATION – GROOVY SCRIPT

…was quite trivial:

		
	

…but was done in matter of seconds. You had to randomize and assign the task on JIRA. The main problem is that’s easy to compromise. As nobody likes to do DoD tasks, nobody will trust you.

SECOND ITERATION – BOOKMARKLET

…was cool but still didn’t solve the problem:

		
	

You had to go to that JIRA task in your browser and run bookmarklet. Still, nobody will trust you. And (same as the first iteration) the code had to differ for each member. Plus, it probably doesn’t work on IE.

THIRD ITERATION – SLACKBOT

…was very easy. And it solved the problem of biasing the randomness.

Slack has a default bot – Slackbot which can answer one of the predefined responses on predefined requests. But it’s very, very annoying when he picks you!

FINAL ITERATION – HUBOT

…is the coolest

One of the reasons we adopted Slack is its easy integration with bots, and opportunity to write some cool and useful code. We decided to use Slack-Hubot. It has Hubot under the hood, it’s easy to setup and program. I won’t go into too many details, but you can find the documentation online.

And you must name it. Our bot is tough guy, so we named him Rambot. You program your logic in coffeescript, and it’s like you’re writing nodejs app. For example, you can list network interfaces:

		
	

But let’s return to the subject at hand!

We’ve created a simple script which recognizes the user who sent the request and randomly picks one of the remaining team members:

		
	

But then we could not stop programming, so we added a feature which enable Rambot to update task assignees through JIRA API:

		
	

And of course, an Infobip SMS API powered feature to notify that lucky guy with an SMS:

		
	

The final code looks something like this:

		
	

That’s it! If you have some improvement ideas, we do accept pull requests. The entire code is available on GitHub.

Enjoy!

By Petar Ducic, Software Engineer / Team Leader

Jun 16th, 2016
4 min read