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

Parse email subject lines

Zander Otavka
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 4, 2023

Apps like Heroku and Fivetran don't support rich alerting through the Opsgenie API.  Instead, they send emails.  Is there a way to parse the subject lines of an email using a regex and extract an alert action and alias?

Here is an example:

Screenshot 2023-03-27 at 10.08.18 AM.png

Instead of creating two alerts, I'd like to automatically close the first one when the second "[Resolved Alert]" email comes in.  A simple regex should be able to separate out whatever comes after the [Brackets] into the alert alias which we could use to auto close the issue.  Is there a way to parse that subject line using incoming integrations?  

 

1 answer

0 votes
James Allen October 5, 2023

@Zander Otavka you can apply regexes to fields via a string processing method, though in this case it looks like you can use the substringAfter method too, documentation here:
String processing methods in Opsgenie integrations | Opsgenie | Atlassian Support

You can use this to define the Alias field, you just want to be careful to ensure that the subject is going to be unique for each alert, if not you should combine some other variable from the email body (which can be extracted via a string processing regex).

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events