Hello, Rota! A Slackbot for Rotation Management
Tags: slack, remote, webdev, javascript
Published: 2020-05-10 17:57:17

# Improving Remote Work Through Internal Tooling

Ever since I started working _fully remote_ 4-ish years ago, I've been interested in the tools and automation that makes peoples' lives easier in tech remote work culture.

I'd like to give a shout-out to my former employer here: [Auth0](https://auth0.com) pioneered my appreciation for automation tools in Slack and their customizability, flexibility, and power for making remote communication and workflows appear to _just work_, automagically.

In fact, prior to my arrival at the company, Auth0 had built a `@concierge` Slackbot that was so integrated into the company culture that I thought it was a _core feature of Slack itself_. It wasn't until I'd moved onto my next role that I realized `@concierge` had been built custom _for_ Auth0 _by_ Auth0 dev tools engineers. The [Developer Tools team at Auth0 builds solutions and toolchains for the company](https://auth0.com/blog/auth0-internal-dev-tools-unleashing-engineering-potential/), internally, to vastly improve productivity and workflows within the organization.

As I moved on to my next fully remote role at [Gatsby](https://gatsbyjs.com), I found areas where I could — ostensibly — meaningfully contribute to the internal tooling ecosystem myself. And indeed, if I ever took on a role that was not Developer Relations in the future, an internal dev tools team is the first place I could see myself being very happy.

# Rota: What is the Task at Hand?

At many tech companies, teams have a need for regularly staffed _rotations_. Rota exists to _help manage rotations_.

For example, perhaps a content team needs blog post drafts to be reviewed each week. It doesn't make sense for one person to be responsible for this all the time, so instead the responsibility is shared among team members with one person reviewing each week. Perhaps an OSS organization has issues that need triage or pull requests that need review; these tasks also rotate amongst team members.

Maybe someone outside the rotation needs to contact whoever is currently on-call for a rotated task, but they don't know at any given time _who_ to reach out to. They could go look up names on a list or a calendar, or they could blast out a message to the entire Slack channel, or use a `@usergroup` that notifies everyone on the team, but this is _unscalable_ and _highly disruptive_, especially as a company grows.

# Rota In Action

Using Rota, we can set up new rotations, staff them, assign people to be on call, rotate the assignment, and send messages to whoever is currently staffing any given rotation.

You can create, name, and describe new rotations:

![create a new rotation with a simple "new" command, a name, and a description of the rotation](https://i.imgur.com/MzRrtx5.png)

You can then assign a "staff list" (usernames of everyone who should take part in the rotation, in assigning order):

![add a staff list to an existing rotation](https://i.imgur.com/ybDrjeC.png)

Then you can assign someone to the rotation either by username, or by assigning the `next` user on staff. When assigning the rotation, you can also pass an optional handoff message:

![assign the next person in the rotation and send them a handoff message](https://i.imgur.com/hYWDd1I.png)

The handoff message is then delivered to the new assignee in a direct message from `@rota`:

![dm from Rota with handoff message](https://i.imgur.com/1DHG7sr.png)

If anyone needs to contact the person who is on-call for any existing rotation, they can easily do so without needing to know _who_ is currently assigned.

![urgent message for the rotation](https://i.imgur.com/lrQq3NF.png)

The assigned user then receives a DM from `@rota` notifying them of the message that needs their attention:

![DM received from message for on-call rotation user](https://i.imgur.com/nh0aW9t.png)

# Rota Commands

At the time of this writing, Rota supports the following commands:

* `@rota new "[new-rotation-name]" [description]` creates a new rotation; rotation names can contain only lowercase letters, numbers, and hyphens. Technically the description is optional, but everyone will benefit if you provide one.
* `@rota delete "[rotation]"` deletes the rotation completely (use with caution!).
* `@rota "[rotation]" description [new description]` updates the description for a rotation.
* `@rota "[rotation]" staff [@user1 @user2 @user3]` adds staff to a rotation; a space-separated list of usernames is expected as a parameter with usernames in the order of desired rotation (rotations with a staff list can be assigned using `assign next`).
* `@rota "[rotation]" reset staff` clears a rotation's staff list (use with caution!).
* `@rota "[rotation]" assign [@user] [optional handoff message]` assigns someone to the rotation and, optionally, sends a DM to them with handoff information.
* `@rota "[rotation]" assign next [optional handoff message]` assigns the next person in the staff list to a rotation and, optionally, sends a DM to them with handoff information.
* `@rota "[rotation]" unassign` removes the current user assignment for a rotation.
* `@rota "[rotation]" who` reports the name of a rotation's assigned user.
* `@rota "[rotation]" about` displays the rotation's description and on-call user publicly, and displays the staff list only to the user who issued the commend (this is to prevent excessive notifications for everyone on staff).
* `@rota "[rotation]" [message]` sends a direct message to the on-call user for the rotation, notifying them that your message needs attention.
* `@rota list` displays a list of all currently known rotations.
* `@rota help` shows how to use the bot.

> _**Note:** More commands may be added as development evolves and progresses over time. Visit the [rota-slackbot GitHub repo](https://github.com/kmaida/rota-slackbot) for any updates._

# Want to Use Rota?

Rota is **_free_ and _open source_**. Its source code is available [on GitHub at **kmaida/rota-slackbot**](https://github.com/kmaida/rota-slackbot), along with instructions for setting the app up in your own Slack workspace. [Rota's README](https://github.com/kmaida/rota-slackbot/blob/master/README.md) lists the [**commands** that Rota supports](https://github.com/kmaida/rota-slackbot/blob/master/README.md#commands), as well as **tips for using Rota** with other Slack features ([like reminders](https://github.com/kmaida/rota-slackbot/blob/master/README.md#rotation-reminders)) and third party apps (like [Gator](https://www.gator.works/), for [scheduling messages](https://github.com/kmaida/rota-slackbot/blob/master/README.md#scheduling-messages)). Rota was developed for internal team use at [Gatsby](https://gatsbyjs.com), so it has been tested for that purpose and its continued development will focus on _internal tooling benefits_.

## Important Technical Details

Because Rota is free, it is _not distributed_ in a way that allows you to go to the Slack app directory and install it from the marketplace. It needs to have [settings for your workspace](https://github.com/kmaida/rota-slackbot/blob/master/README.md#development), needs to have [a database specific to your workspace](https://github.com/kmaida/rota-slackbot/blob/master/README.md#database-setup), and also needs to be [deployed to your hosting](https://github.com/kmaida/rota-slackbot/blob/master/README.md#deployment). Detailed instructions for all of the above are provided in the repo's README.

If I were to distribute Rota publicly, _it would not be possible for the app to remain free_. Public distribution would require provisioning data stores for each workspace it is installed in and would significantly increase hosting costs and maintenance overhead.

## Maintenance and Contribution

I will be actively maintaining [rota-slackbot](https://github.com/kmaida/rota-slackbot) at Gatsby during my tenure, as long as the bot is being actively used internally. If you'd like to aid in development work with Rota, please fork it on GitHub. To set expectations: because Rota is purpose-built for a specific organization, feature requests will be addressed if they have significant value add. _Community contributions_ to the codebase are welcome.

# Thank You!

I had a great time building Rota, and my hope is that it helps internally at my organization, but also that it helps others who share similar challenges in their teams and companies elsewhere. 🎉