Error Message When Resolving Alert


#1

We’re just starting out with OpsGenie as a replacement for PagerDuty and loving it so far but have hit an issue with resolving alerts.

Using the email integration and a unique reference within the body of the mail we can create an alert no problem but when we send the resolved email we’re getting the following error in OpsGenie:

The end result is the alert is not resolved. We have the same Alias string set in the open and close alert as {{ message.substringAfter(“storeId:”) }}

It’s going to be something simple but I’m not sure what. Any help would be appreciated…


#2

Hey Phil,

Welcome to Opsgenie!

The error you are seeing means that the string processing method didn’t find anything matching in the message. I’m blind over here, but I would check these:

1.) Check the alias on the generated alert. Did the substringAfter method work there properly? (if not, you would see a unique id as the alias)

If no: 2.a.) Check the email and the string you are looking for. Important to note that it’s case sensitive, so it it was storeID: or StoreId, your method won’t work.

If yes: 2.b.) Then there is a problem with the received email. It must be, that the content is not similar to the create alert request - so it might have an empty body, etc.

I’m fairly confident that the solution will be 2.a though, and probably you missed a letter. :slight_smile: Happens with me all the time!

Ping us through the in-app chat if this haven’t solved it! :+1:


#3

Hi Daniel,

Thanks for the reply! In the Alias ID row for the alert I see a long random string and not the unique ID sent in the body of the email. Does OpsGenie convert the ID we send to a unique string?

Many thanks,

Phil


#4

Hey Phil,

No - that’s when the alias is empty. It means my assumption was correct and we couldn’t parse out the string even when the alert was created - and not just when you were trying to close it.

Can you check the email you’ve sent to the integration, and check on that “storeId:”? Especially check on the upper case lower case problem I mentioned before.


#5

OK perfect, it was a case issue on the unique ID. I now have a slightly different problem :wink:

The alias is now being picked up but it’s also parsing everything after the ID. I guess I can use the substringBetween(String from, String to) command but this will mean surrounding the ID correct? What if I had a string that I want to add as a tag as well to the body? Would I need to use different characters?

In other words lets say I have this in the body of the email:

Location:New York
storeId:66666

and I want to set a tag to the Location string and the alias to the storeId. I’m guessing I would have to change my email alert to:

<location>New York</location>
<storeid>66666</storeid>

and then use:

{{ message.substringBetween("<location>","</location>") }} to grab the location for the tag and {{ message.substringBetween("<storeid>","</storeid>") }} for the alias.

Does that sound correct or is there an easier way?

Thanks in advance!


#6

I answered my own question, that worked perfectly…


#7

Glad to hear that it’s working! :slight_smile: Let us know if anything else comes up!