How to create informative alerts from links using Slack unfurling

Slack OpsGenie Alert message unfurling

We love Slack like you do because it is where we get things done at work. Slack applications are the gateway for our favorite tools like Intercom, Jira, Google Drive and many more. There are also ChatOps tools like Opsgenie’s Slack application focusing on improving collaboration and automation by bringing day to day to operational challenges into shared chat channels.

As we are aware of the value that our Slack app brings to lots of developers and operations engineers around the world who use Opsgenie and Slack together, we invest in our Slack app a lot. Starting with implementing Add to Slack button to Slack Dialogs, we have come a long way for the last two years. We even wrote about our adventure and what we have learned in Slack developer blog.

OpsGenie Slack App Marketplace

Although our Slack app is super functional, there is always room for improvement. Everyone has their unique use-case and requirements. We try our best to create flexible integrations. To that end, we also try to create sample custom integrations using our APIs, SDKs, webhook integration, and Marid on GitHub. The goal is to help Opsgenie users handle their specific use-cases in an easy and powerful way.

In this blog post, we are introducing another simple but useful custom integration for Slack, focusing on reducing the context switches when you do ChatOps. Let’s start with explaining what the feature is and why it is a very useful addition for your Slack workspace.

Slack app unfurling for context rich messages

Slack attaches useful information when you share a link from a publicly open webpage. For example, try sharing a twitter link or a medium blog post link. You will see something like this:

Screen Shot 2018-02-12 at 12.21.43.png

Slack calls this classic unfurling because the information is crawled and attached to the message by Slack. You can do this for the links you want and attach as much details as you want, including some handy buttons! Slack app unfurling is especially useful where Slack can’t access information that requires authentication. This is called Slack app unfurling when you implement it by building a Slack app.

Unfurling Opsgenie alert links in Slack

When you want to share an alert with your teammates, there are couple of ways to do it depending on where you are.

If you are in Slack, you can share the message if you have it in a Slack channel or use Slash commands to get the details of an alert using the genie command.

If you are in Opsgenie’s web application, and want to share an alert in Slack, you can create a custom action called “Share in Slack” and write the code to send the alert to Slack — more information available on custom actions page and we would love if someone tries this! Let us know if you do :) But the more common way to share alerts in Slack would be to copy the alert link from the browser, and paste it in the Slack channel. To do that, developers would need to switch between Opsgenie and Slack as getting the alert information from Opsgenie requires authentication and Slack can’t crawl this data from the page.

This new custom ChatOps integration is all about this. It helps your team see contextual alerts when you share an Opsgenie alert link within a Slack channel.

We have used AWS Lambda (Amazon’s Serverless computing service) for this integration as it has lots of advantages for an integration like this such as pay-per-trigger billing and zero maintenance.

The best part is, of course, code is open and you can change the message structure to best suit you needs, create conditional messages, and even add buttons!

When you deploy the code, this is how it looks like when you share a link in Slack:

opsgenie-alert-unfurling.gif

You can find more information available in this blog post and review the code from the github repository.

If you want to try Slack with Opsgenie and see its power, you can  sign up for a free trial now!