Update Message or Description of the Alert automatically in Opsgenie when the same is updated on the Jira ticket
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Problem
It is not possible to update the summary or description of the Alert automatically in Opsgenie when the same is updated on the Jira ticket. This is expected behaviour as it is not a part of the integration (Jira Service Management Cloud / Jira Software Cloud).
The below mentioned workaround can help if you want to update the Opsgenie alert with the updated summary or description of the Jira ticket.
Environment
Jira Service Management Cloud / Jira Software Cloud integrated with Opsgenie via the New Integration:
Solution
You can follow the approach mentioned below to configure the Automation rule in Jira to update the Alert message or description in Opsgenie.
Create an API Key in Opsgenie for Authorization purposes.
Navigate to Settings → API key management.
Click on Add new API key
Add a Name > Select the following option for Access rights:
- Read
- Create and update.
Click on Add API key and copy it.
Create an Automation Rule in Jira.
Open the project that you have chosen while adding the Jira Service Management/Jira Software integration in Opsgenie.
Navigate to Project Settings → Automation → Create Rule.
Trigger: Select the Field Value Changed action
Fields to monitor for: Summary and Description
Change type:Any changes to the field value
For: Edit issue, Transition issue and Assign issue
New condition: IF/ELSE block - select smart value condition
First value: {{fieldChange.fieldID}}
Condition: Equals
Second value: Summary
New Action: search for Send web Request action
Paste the below values accordingly:
Web Request URL: https://api.opsgenie.com/v2/alerts/{{issue.key}}/message?identifierType=alias
Headers:
Authorization: GenieKey <API Key from Step 1.d above>
Content-Type: application/json
HTTP method: PUT
Web request body: Custom data
Custom data:
{
"message":"{{issue.summary}}"
}
Click Next.
Add Else- repeat steps (2 b.ii to 2 b.iii) for description field. The complete rule should look as follows
Note:
You can import this automation rule in your cloud site using the below. Once the import is completed, please add your API key from step 1.d above and save it.
copy the following code-block and save it into a JSON file
update Alert message and description in Opsgenie.json
1
{"cloud":true,"rules":[{"id":18044498,"clientKey":"ad17720c-bb93-3576-ad85-64ffac1c57a8","name":"update Alert message and description in Opsgenie","state":"ENABLED","description":"","authorAccountId":"5fab9d519494af006e079d19","actor":{"type":"ACCOUNT_ID","value":"557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"},"created":1709030159470,"updated":1709034461635,"trigger":{"id":"407858433","component":"TRIGGER","parentId":null,"conditionParentId":null,"schemaVersion":2,"type":"jira.issue.field.changed","value":{"changeType":"ANY_CHANGE","fields":[{"value":"summary","type":"field"},{"value":"description","type":"field"}],"actions":["edit","transition","assign"]},"children":[],"conditions":[],"connectionId":null},"components":[{"id":"407858434","component":"CONDITION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.condition.container.block","value":null,"children":[{"id":"407858435","component":"CONDITION_BLOCK","parentId":"407858434","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"407858437","component":"ACTION","parentId":"407858435","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.outgoing.webhook","value":{"url":"https://api.opsgenie.com/v2/alerts/{{issue.key}}/message?identifierType=alias","headers":[{"id":"_header_1709028437056","name":"Authorization","value":"GenieKey 197c3425-f486-4917-a5ab-4b84be336447","headerSecure":false},{"id":"_header_1709028475651","name":"Content-Type","value":"application/json","headerSecure":false}],"sendIssue":false,"contentType":"custom","customBody":"{\n\"message\":\"{{issue.summary}}\"\n}","method":"PUT","responseEnabled":false,"continueOnErrorEnabled":false},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"407858436","component":"CONDITION","parentId":null,"conditionParentId":"407858435","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{fieldChange.fieldID}}","second":"summary","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"407858438","component":"CONDITION_BLOCK","parentId":"407858434","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"407858440","component":"ACTION","parentId":"407858438","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.outgoing.webhook","value":{"url":"https://api.opsgenie.com/v2/alerts/{{issue.key}}/description?identifierType=alias","headers":[{"id":"_header_1709028437056","name":"Authorization","value":"GenieKey 197c3425-f486-4917-a5ab-4b84be336447","headerSecure":false},{"id":"_header_1709028475651","name":"Content-Type","value":"application/json","headerSecure":false}],"sendIssue":false,"contentType":"custom","customBody":"{\n \"description\":\"{{issue.description}}\"\n}","method":"PUT","responseEnabled":false,"continueOnErrorEnabled":false},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"407858439","component":"CONDITION","parentId":null,"conditionParentId":"407858438","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{fieldChange.fieldID}}","second":"description","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null}],"conditions":[],"connectionId":null}],"canOtherRuleTrigger":false,"notifyOnError":"FIRSTERROR","projects":[],"labels":[],"tags":[{"id":57737536,"tagType":"IS_RULE_UPDATED","tagValue":"true"}],"ruleScope":{"resources":["ari:cloud:jira:f61a7458-e4b6-4cd5-8864-59121ebe0213:project/10031"]},"ruleHome":{"ruleLifecycleHome":{"locationARI":"ari:cloud:jira:f61a7458-e4b6-4cd5-8864-59121ebe0213:project/10031"},"ruleBillingHome":{"locationARI":"ari:cloud:jira-servicedesk::site/f61a7458-e4b6-4cd5-8864-59121ebe0213"}},"writeAccessType":"UNRESTRICTED","collaborators":[],"billingType":"NORMAL"}]}
References:
If you encounter issues or require further clarification on the topic, please consider reaching out to Atlassian Support for further assistance.
Was this helpful?