What is the purpose of the Source field in Update Notes API?

Richard Guo October 14, 2021

For reference: https://docs.opsgenie.com/docs/alert-api#add-note-to-alert

 

The "source" field isn't returned when Notes are queried. The "source" in the parent Alert isn't updated. There's no corresponding "source" in the notes panel for each note. It appears this field is not used anywhere.

 

This leads to a followup use case: I'd like to have some logic in outbound webhooks to determine if the webhook should even be triggered depending on the contents/metadata of a Note. Currently there are no alert filters in webhook config that's actionable on Notes.

1 answer

1 vote
Allen Barnard
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 18, 2021

Hi @Richard Guo

 

The source field is an optional parameter and does not need to be specified. It is used optionally when the REST API is used to add notes, the intended value is meant to be the name of the service, system, or script that added the note.  For more information visit this page.https://docs.opsgenie.com/docs/alert-api#add-note-to-alert.

 

On your second point, the alert conditions filters do not work against notes, please tag the alerts you wish to be ignored by your webhook integration and configure your alert condition filters to check the tags,

 

Thanks and kind regards,

 

Allen

Richard Guo October 18, 2021

Hi Allen,

 

 the intended value is meant to be the name of the service, system, or script that added the note.

 

It has zero purpose when that field isn't presented anywhere for the note. I don't see it in the GUI, it isn't a returned field when I query for alert notes from API. This value is effectively discarded. How do I/custom code get this value back?


And as for not being able to operate on anything not at the alert level, that's unfortunate. I don't want to discard the entire alert just because I want to squelch an automated note from triggering downstream integrations.

Allen Barnard
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2021

Hi @Richard Guo

You are most correct it is not available in the GUI or in the List Alert Notes response.  The intended purpose of the field is to populate the alert log with the source of the note so that admins may determine the origin of the note.

The customSource can only be found in the alert log entry that is added to the alert when the note is added.  To retrieve it you will need to use the List Alert Logs API call, it will return an array of logs for that alert, you will need to filter for the type "Comment", the first comment log returned will relate to the most recent not added to the alert, you will need to use regex or sed to extract the name of the source and store it in a string variable.

As for your concern about not wanting to accidentally trigger downstream integrations, it would be best to open a chat using the chat bubble inside the Opsgenie app, our Support Engineer can arrange access to your Opsgenie instance to review your integration configs.

I hope this helps thanks and kind regards,

Allen

Like # people like this
Richard Guo October 22, 2021

Great, I think I can work with that.

The intended purpose of the field is to populate the alert log with the source of the note so that admins may determine the origin of the note.

It would help to have that sentence in the description of the field. Since by inserting a value, users typically expect to be able to get it back via the complementary "get" function/API/CLI.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events