Display Jira issue status or any other field values on Opsgenie Alerts

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Purpose

With the current Jira Service Management integration in Opsgenie, when an Alert is created, the alert contains very limited data about the Jira issue, and these are not dynamically updated when there is an update in Jira issue.

Once an Alert is created by the Jira Service Management integration, the Status, Priority, and Issue key are captured on the alert as Extra Properties, however, these are not updated when these field values changed in Jira.

This is a limitation of the integration as currently via the integration we can only Create Alert, Close Alert, Acknowledge Alert and Add Note to an alert.

Sometimes you might need to update these values dynamically or capture custom field values to the Alert Extra Properties. This KB aims to provide a solution to the above using the Jira Automation Rules and Opsgenie's Add Details (Custom Properties) to Alert API endpoint.

Environment

Jira Service Management Cloud - Opsgenie

Solution

The solution provided here is focusing on dynamically updating the Status extra property in an Opsgenie alert when a status is changed in Jira:

  1. Create an API Key in Opsgenie for Authorization purposes.
    1. Login to Opsgenie and navigate to Settings → API key management.
    2. Click on Add new API key which will display a pop-up. Add a Name > Select the following option for Access rights:
      - 
      Read
      - Create and update.
    3. Make a note of the API key displayed under the field Key, this will be the API key used for the Authorization later in the Automation rule, and then click on Add API key.
  2. Create an Automation Rule in Jira.
    1. Open the Jira Project -> Project Settings -> Automation
    2. Click on Create Automation and configure an Automation Rule like the below:

      In this example, you send a status update to Opsgenie using Issue transition as a trigger. You can modify it further based on your use case

      Trigger: Issue Transitioned 


      Action
      : Send Web Request


      Here is the Data that I used for Web request URL and Custom data, you can use the same as well:
      Web request URL:

      https://api.opsgenie.com/v2/alerts/{{issue.key}}/details?identifierType=alias

      Custom Data:

      {
          "details": {
              "Status": "{{issue.status.name}}"
          }
      }


      Copy the API Key that we created in Step 1 from Opsgenie and use it in the Authorization Header in the Automation rule as displayed in the screenshot.

      The format is:

      Authorization: GenieKey <add the API_Key Here>


Similarly, you can send any field value to the Opsgenie Extra Properties. The only thing that would change is the smart value that is used to capture the right data from a Jira Issue.


You can refer to the Find the smart value for a field document to construct your own smart value, if you still encounter issues, consider reaching out to Atlassian Support for further assistance.


Last modified on Jun 29, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.