# ChatOps at HackMIT

The HackMIT team uses Slack for most of our internal communication. We used to use email exclusively way back in the day, even for (almost) real-time communication. Some team members used ad-hoc solutions for better real-time chat, so we had some developers on Slack, most of the marketing and branding people on a Facebook group chat, some people on Google chat, and so on. Now, everyone uses Slack.

Having everyone on the same platform works really well for us. Every committee has its own channel, so conversations about different topic are kept separate, but anyone can join any channel and participate. It’s a lot easier to manage, and it’s a lot easier for everyone to stay up-to-date on what’s happening.

# Chat-based Automation

Another really nice thing about having everybody use a single chat service is that we can connect all our separate services and applications to one central platform. We use a lot of separate software services, including a bunch of custom-built apps, for both internal and external use. We’ve turned Slack into our centralized monitoring and command-and-control hub for these services with a bunch of scripting and automation exposed through a chat bot built on the Hubot framework.

Chat-based automation is really nice. It makes it possible to effortlessly interact with a bunch of different services without leaving the chat, even while in the middle of having a conversation.

## Monitoring

We run a bunch of different services in the cloud, and it’s important to monitor them so we can deal with issues when something goes wrong. We’ve written a little monitoring service to help with this, and we’ve connected it to our bot. We can see the status of health checks via Slack:

And of course, we also get push notifications to Slack if something goes wrong:

These notifications are especially useful when launching new services, when things are much more likely to break. We have “on-call” developers who also get texted when something goes wrong, but having these messages in Slack makes it really easy to discuss issues and solutions having the context of the error messages right there.

## Real-time Information

We also use our chat-based automation to get easy access to real-time information. We have our bot connected to our custom-built event registration and check-in systems, so we can see current statistics at any time:

Having access to information like this can be very useful during the event — for example, we used these statistics to make decisions about how many walk-ins to admit.

## Interaction with Services

Often times, a chat-based interface is nicer and easier to use than the default interface for a tool.

Our corporate relations team uses a giant Google Sheets spreadsheet to keep track of sponsors. It’s not the nicest interface to deal with, so we built some automation so we could query and update the spreadsheet directly from Slack:

We could also see how much money we’ve raised:

### URL Shortener

We use a custom-built URL shortener for both internal and external use, hosted at go.hackmit.org. We wrote a plugin for our chat bot so that we could create short links from our chat:

The bot also listens for mentions of our URL shortener and expands short links:

Nowadays, we barely use the web interface for the URL shortener — everyone just uses the chat-based interface.

## Improved Communication

To improve our workflow in Slack, we wanted the ability to ping groups in a way that is more fine-grained than using “@channel”, because being present in a channel doesn’t imply membership in a specific group. We wanted to be able to say something like “@dev someone needs to fix the CSS on the FAQ page” and ping the people on the dev team. Slack didn’t have this feature at the time, so we built a plugin to add support for it:

We use this feature all the time — it’s one of our most used features!

## Scripting

Our whole team makes use of bot automation, so we wanted everyone to be able to easily program simple behaviors and shortcuts into the bot without having to write any code. To make this possible, we wrote a plugin so that anybody could easily define bot macros:

Macros can take arguments too, behaving as shortcuts for longer commands:

The macro system ended up being extremely useful for making shortcuts for frequently used commands — for implementing this kind of functionality, using the macro plugin was a lot faster and easier than writing code.

The macro system is our most used bot feature. We barely use regular commands anymore — we access all of the most used bot commands through shortcuts that we have created.

## Fun

Some features have been added to our bot just for fun:

# Conclusion

Chat-based automation has been highly beneficial to all of us on the HackMIT team. We’ve put a lot of time and energy into writing code for our Hubot setup, but it was worth the investment.

We’ve open-sourced some of the tools that we’ve written in the process so that others can make use of what we’ve built:

We’ve also released the source code for our bot setup, so that anyone can see exactly how we’ve configured our bot.