I am using OpsGenie Cloud with Jira Cloud and have configured the OpsGenie integration to add a comment to the Jira issue when an OpsGenie user acts on an alert. The comment that is added to the Jira issue looks like:
[Opsgenie]: Firstname Lastname acknowledged alert: "Alert Title"
I would like to assign the Jira issue to the "Firstname Lastname" user who is mentioned in the comment. All of my OpsGenie users are valid Jira users.
I am able to use the smart field {{comment.body.match(": (\w+ \w+) ")}} to pull out the "Firstname Lastname" string from the comment. I tried using that smartvalue to set Assignee but it fails. It seems that I need an accountID to set Assignee. How can I look up the accountID for that "Firstname Lastname" string?
Thanks for any advice.
Hi @Kyle
There is an open suggestion to find users by name from within an automation rule: https://codebarrel.atlassian.net/browse/AUT-725
As a work-around (albeit a slower one) you could use a webrequest to call the REST API with a user search to get the account ID, and use that for assignment. Here are some references if you want to try that approach:
Best regards,
Bill
@Bill Sheboy with some experimentation I totally got it working. I like it. Thanks again for the pointers to a solution.
For future reference here are the automation steps that I used:
1. a "Send web request" step configured as follows
- Webhook URL: https://<put-your-sitename-here>.atlassian.net/rest/api/3/user/search?query={{comment.body.match("\[Opsgenie\]:\s(\w+\s\w+)\s").urlEncode}}
that smart field match gets the "firstname lastname" from the comment and urlEncodes it to be part of the REST API query parameter, use your own regex in this place
- Headers: Authorization = Basic <my-API-key-encoded-per-that-other-article>
- HTTP method: GET
- Webhook body: Empty
- check Delay execution of subsequent rule actions to that the next step can use the returned value
2. an "Edit issue fields" step which sets Assignee to
{{webhookResponses.first.body.accountId}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kyle Thanks for the detailed solution, this solved a very troublesome task I had been stumped on for some time. For anyone who is in a similar situation, I was unable to execute the user lookup by email address from a python script remotely due to GDPR restrictions, but this webhook executed in the Automation panel apparently circumvents that block.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.