Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Auto Link Alerts to Jira Service Management Incidents

Summary

When working with JSM Incidents there is no way to automatically link Opsgenie Alerts to JSM Incidents. Or is there? 

With the new Incident REST API and the Opsgenie Alerts API, we can GET Alerts and also link alerts using two API requests. 

Automation Rule configuration:

  • Manual Automation Trigger

In this example, we will be using a Manually triggered rule to first get the Opsgenie Alerts where the Status is Open and there is a message of intermittent. This default value set on the Manually Triggered Automation Rule will look for Alerts that meet this criteria. Please note that this default value can be changed based on your use case and if you want to look at the message/status, or other values on the Alerts:

Default Value for User Inputs

status: open AND message: intermittent

Smart Value for Manually Triggered Rule

{{userInputs.alertsQuery}}

Screenshot 2023-07-13 at 8.10.56 AM.png

  • GET Request using a Send web request Action

Then we will be using a GET request to get the Alerts to later link using the following Web request URL. Please be sure that the smart value from the Manual Trigger is used for the query, and then url Encode the request URL, similar to below:

https://api.opsgenie.com/v2/alerts?query={{userInputs.alertsQuery.urlEncode}}

You will also need to get a Genie Key from an Opsgenie API integration to authorize the API request and get the Alerts:

Screenshot 2023-07-13 at 8.11.05 AM.png

  • POST Request using a Send web request Action

Lastly, we will link the alerts to the JSM Incident dynamically using the following POST web request URL. Please be sure to use your own cloud for your Jira site with experimental API headers, using Basic Authorization:

https://api.atlassian.com/jsm/incidents/cloudId/<cloud_id>/v1/incident/{{id}}/alert/add
X-ExperimentalApi opt-in
Authorization Basic <api_key>

Also, here is the custom JSON data you want to pull in the web response data from the previous API GET request:

{
"alertIds": {{webResponse.body.data.id.asJsonStringArray}}
}

Screenshot 2023-07-13 at 8.48.15 AM.png

Once this is all setup and you manually trigger the rule you will see linked alerts that met the criteria for the rule linked now, within the Linked Alerts field:

Screenshot 2023-07-13 at 8.44.06 AM.png

Related articles:

1 comment

Ken Young
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 13, 2023 • edited

One helpful thing when using this is to make sure you are using the IssueID vs the issue key (like most other api calls do) otherwise you will get a 404 error when trying to link to the alerts

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events