Logo of a guy sitting at a computer desk

gabmirdev

Engineering Manager - Software Engineer
Personal blog by Gabriel Miranda

Automating Engineering Rotations with JIRA, Tellspin & Slack

☕ 10 min read

The job of a manager

Being a manager to me is mostly about improving the quality of life of the engineers I work with. But most importantly doing so without my periodic intervention or their efforts. Because of this particular reason, I'm a fan of automating everything on my domain.

Old processes

The other day we were trying to improve our service desk rotations. The current and old processes involved looking for your name in an embedded calendar on a notion document and then working through the tickets.The assignment lasted for three consecutive working days. There was no messaging, no one fully accountable for the service desk and don't even talk about automatic assignees in the tickets. Tedious.

Rotations

We started with rotations alone. We started looking for apps that could do the following:

  • Notify at the beginning of the shift the person with the rotation assigned, hence removing the effort of looking through an old document
  • Automatic rotations based on a schedule, defining these rotations beforehand
  • Override assignee for a week, this is useful in case of vacations or absence due to different reasons
  • Specific handle in Slack (@dev-on-call), in case other teams want to communicate with the assignee without knowing our internal schedule

We finally ended up opting for Tellspin. A Slack App that does all of this and can even handle multiple rotations at a time. So in the future, if we want to have rotations for creating a newsletter, handling a specific meeting, or different tasks, we can do it 💪.

Service Desk

We also had an antiquated system to get support/service desk tickets. It was a custom google form with an integration that ended up creating a ticket in a ClickUp board. It was hard to follow, edit and mantain.

We switched to using JIRA Service Management. Yes, I know, a lot of people hate JIRA. In my case, I only hated it when it was poorly administrated and had a lot of unnecessary restrictions like complex and convoluted workflows.

We created a Service Desk with a few types of requests and some internal JIRA Automation to move the status automatically if an engineer answered a ticket or another employee outside of our team did. The thing is, the first assignee was still, well, no one. And even if we had a bot at the beginning of the week letting you know you're the assignee, there was no notification that a ticket had been created (apart from a feed channel with this tickets). So, how did we solve this?

Current solution

We realized the solutions were not coupled in any way now. So to create an on-call in OpsGenie or have a default assignee in JIRA wouldn't work because it'd be out of sync with Tellspin on Slack. So since Tellspin handled well rotations and overrides, we decided it was our source of truth.

Creating a Slack App

At the moment doesn't seem like Tellspin has a public-facing API to query who's on-call for a certain rotation. The only thing we thought of doing was: to ask Slack, but how? We created a Slack App with the following permissions:

  • users:read
  • users:read.email
  • usergroups:read

This it's basically to be able to query groups and user emails. Remember that Tellspin creates a handle @dev-on-call? Well, this is managed with user groups. So if we can query the group, then the user, and get the email, we're one step closer.

Our only thing left here generating a token for the app by installing it in our workspace. And, no, we're not going to use our app, we just need the token and the permissions to create requests from somewhere else.

JIRA Automation to the rescue

JIRA Automation is a powerful tool for this kind of thing. We even built some stuff that solves issues automatically by triggering requests to protected APIs. But in this case, we needed something more operational and interconnected. In JIRA Automation we've created a rule that goes something like this:

  1. When issue is created
  2. GET https://slack.com/api/usergroups.users.list?usergroup=<YOUR-USER-GROUP-ID>
  3. GET https://slack.com/api/users.info?user=<YOUR-USER-ID>
  4. GET https://<YOUR-ATLASSIAN-DOMAIN>.atlassian.net/rest/api/3/user/search?query=<YOUR-USER-EMAIL>
  5. Assign issue to <USER-ID>

In point 2, we've hardcoded the group, it's not a bad thing but we could add another step or two to list the user groups and pick the one we want, but Tellspin is not creating new groups so far, so it works. When we create this request we're answered by the Slack API with a list of a single user, with an alpha-numerical user ID. In point 3 we use that user ID to get the info, and more importantly, the e-mail of the user. In point 4 we use the e-mail to query the user ID from Atlassian. Why? We need that to assign the issue to someone we can't do it by any other fields. And it makes sense, other fields can change, but not the user ID.

Done, nothing else to do. Now you have automatic assignees based on your Tellspin rotations, always updated.

Closing thoughts

When we were starting to explore this issue we were trying to find a single tool that did all of it:

  • Slack reminders
  • Creating Slack group handle
  • Auto-assign JIRA issues
  • Schedule Management
  • Assignee overrides

And we didn't find a product like that. Sometimes, we need to stop looking for magical solutions that cover every single of our use cases. Fortunately, we're relentless and I particularly cannot endure defeat, so I have to keep going. Thanks for reading and I hope it helps you out in some way