Close

Automatic incident management with Jira and StatusPage

Kev Zettler Headshot
Kev Zettler

Full stack web developer, DevOps

Learn how to use Jira automation rules to automatically sync StatusPage to Jira issues.

This guide demonstrates three Jira automation rules that automatically sync StatusPage to Jira issues:

  1. How to trigger a new StatusPage incident
  2. Update StatusPage when issue is commented upon
  3. Close StatusPage incident when issue transitions to done

You will need an active Jira project and a StatusPage account with API access enabled. Your Jira project will need a custom task type of “Incident” and a custom field “Incident ID”. You will also need your StatusPage API key and Page Code to configure the following automation rules. Check out the StatusPage API guide to locate your StatusPage API keys.

How to trigger a new StatusPage incident

This rule creates a StatusPage incident when a Jira issue is created with an “incident type''. It’s useful for managing StatusPage directly from Jira. 

Step 1. Add automation

Click the Add automation button and then select the Issue option.

Click: Add automation; Select: Issue

Search for and select Issue created.

New Trigger. Triggers start the execution of a rule. Triggers can listen for events or be scheduled to run.

Click the Save button to continue.

Issue created. Rule is run when an issue is created. This trigger needs no configuration.

Step 2. Create a new condition

Next, search for and select the Issue fields condition.

Select Issue fields condition under New condition. This checks whether an issue's field meets a certain criteria.

Use the Issue fields condition to check if the issue type is an Incident and act accordingly. Configure the Issue fields condition so the Issue Type field is equal to Incident. Click Save to continue.

Use the Issue fields condition to check if the issue type is an Incident and act accordingly. Configure the Issue fields condition so the Issue Type field is equal to Incident. Click Save to continue.

Step 3. Send a web request

Select the Send web request, which will update StatusPage.

New action. Select Send web request

To configure the Send web request action you will need your StatusPage API key and page code. These values can be found in the StatusPage documentation. Send web request is an advanced action with sensitive input values. Later in this guide, this action will be reproduced in additional rules, and will reference this configuration. 

In the Webhook URL field, enter the URL of the StatusPage incidents endpoint: 
https://api.StatusPage.io/v1/pages/your-page-code/incidents 

Replace the your-page-code placeholder with your StatusPage page code. In the headers section, enter Authorization:OAuth and your API key into the two header fields. 

Set the HTTP Method to POST and set the Webhook body to Custom Data

Make sure you check the Wait For Response check box since you will use values from the web request response in additional components. 

The Custom Data field includes code that defines an incident payload for the StatusPage API. This code uses smart values to extract and add the issue summary to the payload. The following screenshot displays the complete configuration of the Send web request action. Click Save to continue.

Send web request

Step 4. Create Edit Issue action

Finally, search for and select the Edit Issue action.

New action: Edit issue

The Edit Issue action extracts the Incident ID from the StatusPage request and stores it in a  Incident ID custom field. The Incident ID is extracted using smart values. The following screenshot demonstrates how to configure this Edit Issue component. 

Edit issue. Set values for fields on the issue

The following screenshot displays the final summary of this rule.

The final summary of the rule

This rule is now ready to be enabled. Enter a name for this rule and click the Turn it on button. Data from this rule will be used to create the following rules. 

Update StatusPage when issue is commented upon

This next rule is triggered when a comment is left on an “Incident” issue type. A web request is made to StatusPage that updates the corresponding incident with the content of the comment. The following image displays the summary of components for this rule.

StatusPage comment on incident

The important component to review in this rule is the Send web request action. This action is copied from the previous rule but with some changes. 

The Webhook URL was appended with /{{issue.incident_id}}. Smart values are used to pull the Incident ID custom field from the issue and pass it to StatusPage as the target of the web request.

The HTTP method is now set to PATCH instead of POST. This tells StatusPage to update an existing incident instead of creating a new one. 

The custom data field is changed to include code that uses smart values to extract the comment body from the issue and put it into the content body of the incident.

StatusPage comment on incident
Send web request

Close StatusPage incident when issue transitions to done

This last rule ties them all together. This rule tells StatusPage that an incident is resolved when the corresponding Jira issue is moved to Done. The following image displays the rule summary.

StatusPage comment on incident

The web request component has once again been copied and modified from the previous rules.

Send web request

The custom data field was modified to set the incident status to “Resolved”. This is the only modification from the previous comment rule. 

These rules are now ready for use. You can test these rules out by creating Incident type issues and performing trigger interactions. You can monitor the behavior of the rules in the automation Audit Log, which provides logging and information into the behavior of the rules. The automation rules demonstrated in this guide are great examples of advanced web request API usage rules. 

Check out hundreds of other examples in our Automation Template Library.

Kev Zettler
Kev Zettler

Kev — ведущий специалист по комплексной веб-разработке и серийный предприниматель более чем с десятилетним опытом создания продуктов и команд по методикам Agile. Он с большим энтузиазмом участвует в создании и развитии новых технологий с открытым исходным кодом, таких как DevOps, криптовалюта, виртуальная и дополненная реальность, а также преподает знания по этим технологиям. В свободное время Kev участвует в джемах по разработке инди-игр.


Share this article

Recommended reading

Bookmark these resources to learn about types of DevOps teams, or for ongoing updates about DevOps at Atlassian.

Devops illustration

DevOps community

Devops illustration

Simulation workshop

Map illustration

Get started for free

Sign up for our DevOps newsletter

Thank you for signing up