i am using opsgenie ,OEC and Python Script for creating some jira issues with some custom jira fields which are not filled by default,the synchronization opsgenie-jira works fine and the jira tickets are created.I use the following scenario:
But i would like also to have within Incident the Issue Key and URL under Extra Properties,like below:
Could you pls give me a hint how to achieve this?I use this py script
Hi @Oalimerko ,
You could have the script add those fields to the Incident via Incident API. The responder alert that is triggering your script will have the incident-id as an Extra Property
So you could have your script use that incident-id for the API request to update the incident fields with those additional fields.
Hope this helps!
@Oalimerko It sounds like the responder alert created from the incident is triggering OEC to create the issue in Jira, right?
If so - that means the incident is being created before the Jira issue is being created.
So I was thinking modify the script that is creating the Jira issue, so that after it gets the response from Jira that the issue was created, it updates the incident with the additional fields via Incident API.
I don't have an example of the script. But the script is receiving the details of the responder alert from Opsgenie, which is then used to create the issue in Jira. So you could make another Get Alert API request back to Opsgenie to get all the responder alert fields (the incident-id field is an extraProperty of the responder alert as shown in my screenshot in my initial reply).
So you can grab that incident-id and assign it to a variable in the script.
Then when it makes the request to Jira to create the issue via API, it then grabs the response of that api request (line 256 below) and grabs the issueKey that is returned, and then adds that issueKey as an extra property to the alert.
So you could add lines there for it to then make an Add Details to Incident API Request (since you have the incident-id), and add the Jira issueKey and link to jira issue as details (i.e. extra Properties) to the incident.