developer productivity

Creating powerful automations with n8n and Mattermost

Tanay is the Head of Developer Relations at n8n. He has published books on WebVR, virtual assistants on Raspberry Pi, and FirefoxOS. He has been listed in the about:credits of the Firefox web browser for his contributions to the different open source projects of the Mozilla Foundation. 


I’ve been involved in the DevOps world for a while and yet I finished reading The Phoenix Project only recently. The book piqued my interest in how teams execute their incident response playbooks. It’s enlightening to see the different approaches teams take to hone what works best for them.

n8n Mattermost

I wanted to test what automating a minimalist incident response playbook would look like, and I decided to use three of my favorite tools to do that: n8n, PagerDuty, and Mattermost.

Here’s a quick introduction to n8n and PagerDuty, in case you aren’t aware of them:

  1. n8n is a fair-code licensed tool that helps you automate tasks, sync data between various sources, and react to events—all via a visual workflow editor.
  2. PagerDuty is a SaaS incident response platform for IT departments in companies.

I decided to use Mattermost for a couple of reasons. At n8n, we are big fans of open source products, and we use Mattermost internally as well. Moreover, Mattermost has a strong and supportive community, and it’s easy to use!

Incident response in 6 steps

To avoid panic during an incident, a lot of companies have an incident response playbook. 

I created a minimalist six-step playbook for this experiment. Whenever a service goes down or something unexpected happens, the on-call team follows this high-level protocol:

  1. Triage the issue in Jira
  2. Create an auxiliary channel
  3. Invite the on-call team to the channel
  4. Acknowledge the issue
  5. Fix the issue
  6. Resolve the ticket

Creating Mattermost slash commands in n8n

n8n has tons of integrations that can be used to enable powerful workflows—including integrations for Mattermost, Jira, and PagerDuty. Additionally, n8n has first-class support for webhooks, which allows us to use buttons or slash commands in Mattermost to trigger workflows. It takes less than two minutes to create a slash command in Mattermost and connect it to a webhook node in n8n. Don’t believe it? Check out this article on Webhooks Fun with n8n and Mattermost.

Using just three workflows and a couple of nodes, we were able to automate the sample incident response playbook. If you’d like to automate your playbook as well, check out our step-by-step guide on how to do this. 

This GIF shows what the automated workflow looks like once an incident report gets created on PagerDuty.

This was an example of automating a sample incident response playbook. This ecosystem of Mattermost and n8n helps in the reduction of tedious and error-prone processes. You can integrate many other different services to create an efficient ChatOps infrastructure with minimal effort.

Conclusion

n8n’s open ecosystem of integrations allows you to connect and incorporate Mattermost with your favorite services and products to create a unified automation workflow for a wide range of use cases. I’d also love to hear from you about what kind of workflows you’d like to implement and which integrations you’d use. Feel free to give me a shout out on Twitter.

n8n is a free and open fair-code licensed node-based workflow automation tool. It can be self-hosted, easily extended, and used with internal tools. n8n has 100+ different nodes to automate workflows. Get started with n8n by heading over to our docs and blog. 💙

mm

Tanay is the Head of Developer Relations at n8n. He has published books on WebVR, virtual assistants on Raspberry Pi, and FirefoxOS. He has been listed in the about:credits of the Firefox web browser for his contributions to the different open source projects of the Mozilla Foundation.