slashbot

Eric Bailey

thoughtbot has come to rely on Slack, a text-based chat app, to communicate both internally and with clients. It’s been helpful for getting quick, actionable information, as well as coordinating with offices in other states (and countries!).

As we are a company largely made up of tinkerers, we also have spent a decent amount of time writing software to enhance our Slack experience. There are extensions that help with planning, managing documents and deliverables, and coordinating coding efforts.

We reserve Fridays to reinvest in ourselves. This is done by working on internal projects that are interesting to us that also help our company and community grow. Quoting the Playbook, “The goal is to encourage individuals to improve and share their knowledge with the rest of the team.“

One such project to come from these efforts is slashbot.

What slashbot is

slashbot is a Slack Slash Command configuration that helps thoughtbot employees quickly find information without having to leave Slack. It was built by the extraordinarily talented Steph Viccari and myself (but mostly Steph).

It functions much like a chatbot, where you type a keyword and it will deliver a preprogrammed response. The fun bit is that the responses are private, meaning that only the person using the command will see slashbot’s response. Here’s a screenshot of it in action:

A private slashbot reply appearing in between posts in an active conversation
about internationalization resources for React.

In this example, I’m asking slashbot to tell me the Boston office’s address for an order I’m placing, without interrupting an important conversation about localization resources.

This allows slashbot to meet thoughtbot employees where they are, at the moment they need help. There’s no context switching, nor is there the risk that you derail an active conversation.

What slashbot is not

In addition to the Handbook, we have a rich collection of internal tools worked on by many talented, passionate developers and designers. slashbot isn’t intended to replace them. It is designed to help surface them by making the responses link out to these existing resources.

slashbot’s grammar

There are two kinds of slashbot commands: general information and office-related information.

  1. General information can be asked by typing /slashbot topic.
  2. Office-related information can be asked by typing /slashbot office topic.

For example, /slashbot holidays is a general command that links to the part of the Handbook that lists all our shared holidays, while /slashbot boston printer is an office-specific command that links to all information related to the Boston office’s printer.

The code is hosted on GitHub, empowering thoughtbot employees to add new replies. We’re hoping all the common questions that are asked repeatedly will be captured in slashbot, helping us and future thoughtbotters get what they need with minimal fuss.

You ought to bot

For those looking to build their own slashbot, ngrok proved very helpful with testing. With ngrok, we could run our app locally, use ngrok to expose our localhost server and configure Slack to forward all requests for slash commands to the URL generated by ngrok. This allowed us to test slashbot responses in Slack, without having to deploy the application.

For storing each command and response, it’s important to us that everyone can view existing commands and contribute. One approach is to build a web interface that allows users to view and add commands. In our case, we opted to store the commands and responses in a YAML file. This approach satisfies our user goals and helps us determine team buy-in before adding features.

While the code for slashbot is private, the idea is not. If you’re inspired to create your own office slashbot, why not let us know? We’d love to hear all about it!