https://support.atlassian.com/opsgenie/docs/dynamic-fields-in-opsgenie-integrations/
Jira Service Management parses your data to construct rich and informative alerts. You can use dynamic fields to customize alert properties and alert conditions.
...
Dynamic (draggable) fields
Draggable fields bring significant data for creating and managing well-informed alerts. Jira Service Management Integrations Framework The integration framework provides different dynamic fields for every integration, specific to the integrated toolapplication. You can use dynamic fields in Filters the filters of your integration actions as well as Alert Fieldsalert fields. In Filterthe filter, fields are available to choose select in the condition drop lists-down. In Alert Fieldsthe alert properties, you can drag a dynamic field into any input you find appropriate.
View file | ||
---|---|---|
|
Jira Service Management interprets the expressions within the double-curly braces as dynamic fields. Dynamic data populates at every notification that's sent to Jira Service Management. For example, let's say someone created creates an issue in JIRA; Jira and enters "This is the summary" as for the summary. Using Jira Service Management’s JIRA Jira integration, "[Jira] {{summary}}" for Message in a 'Create Alert alert' Action will yield creates an alert with the message "[Jira] This is the summary". It will then notify the users. All we needed to do was is drag {{summary}} to Messagethe message. When the issue was is created, Jira Service Management got get notified automatically notified. It creates an alert with the issue's summary in the message.
You can mix static text with dynamic fields. In the example above, the "[Jira] " in "[Jira] {{summary}}" is static and it'll be at the beginning of the message for every created new alert's message. "{{summary}}" can be different for each alert.
Using
...
raw parameters from
...
webhook URL,
...
payload, and
...
headers
You can also insert url URL parameters or http payload parameters from webhooks directly into your alerts. Let's clarify with an example:Suppose you're using Jira Service Management's Jira integration. Jira For example, an integrated application sends a variable named timestamp to Jira Service Management in the webhook payload. But timestamp isn't available as a draggable field in the Integrations configuration page. If you still need to use timestamp in your alerts, you can :
...
Go to Advanced Settings of your integration
...
add {{_payload.timestamp}}
to the input fields.
...
Save the integration.
Nested payload variables are accessible as well. In the Jira example, we could also use _payload.issue.fields.environment to environment to access the following value that is in the http body of the webhook:Text
Code Block |
---|
{
"issue" : {
"fields" : {
"environment" : "env_val"
}
}
}
|
Url The URL query parameters of a webhook are also accessible via {{_url.param}}
where param is the parameter key. You can add custom parameters to the webhook url URL and inject it into your alerts. To clarify this with an example:Suppose For example, suppose you're using Jira Service Management’s Stackdriver integration. You're monitoring many projects and want to use a single integration for all your alerts. But If you still want to have a way to distinguish which alert belongs to which domain. A way to do this is to , you can use a custom parameter for each of your projects.
You can add your custom parameter to the webhook url URL of the Stackdriver integration. E.g.For example: ¶m1=val1, and insert {{_url.param1}}
in the integration config to access it.
Note |
---|
Note that accessing request url, payload and headers parameters is not available for actions via Alert API |
Headers of a webhook request are also available via {{_headers.param}}
where param is the name of the header. You can use all the headers of a request in your alert fields.
Info |
---|
For email-based integrations, you can use headers of an email via {{_headers.PARAM1}} notation . For example, for an email-based integration, you can use and {{_headers.IMPORTANCE}} in the alert fields. Note that you should use Use UPPER CASE letters for the keys. |
To control your alert fields further, you can use string processing methods on dynamic fields. For example, your Jira Service Management JIRA an Integration has an 'Add Note' action, and Note is configured as "note: {{comment_body.substringAfter("is")}}".
Now when someone in JIRA comments on an issue with the integrated application adds "This is the comment" as a comment to the issue, a note is added to the issue's Jira Service Management alertcorresponding lert, with the text "note: the comment".
Listed below are the complete list of methods you can use in dynamic fields:
substring(int from), substring(int from, int to): yields the string between specified indices. from is included to is excluded
{{ from_name.substring(5,20) }}
substringAfter(String from): yields the string between specified indices. from is included to is excluded
{{ subject.substringAfter("Host") }}
substringBefore(String to): yields the string before the specified parameter
{{ from_address.substringBefore("@") }}
substringBetween(String from, String to): yields the string between from and to parameters
{{ subject.substringBetween("URL:","(") }}
extract(regular expression): yields part of the string that matches the parenthesized section of the regular expression.
{{ message.extract(/Host: (\S+)/) }}
toDate(String format) converts millisecond-based timestamp into date format, following Java formatting . The default format is "yyyy-MM-dd HH:mm:ss ZZZ".
{{create_timestamp.toDate()}}
get(int index) yields the element at the given index of an array.{{myArray.get(0)}}
Info |
---|
Share your feedbackWe would love to receive feedback about this documentation, the product experience, functionality, or anything you’ve got to share. (Simpler: Do you have any feedback about this documentation, your product experience, or any functionality? We'd love to hear from you.) You can either add comments to this page or add a card on the Trello board. |
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Criteria for checks |
- Replacing OG with JSM
- Basic grammar & spell check
- US English
- Positive language
- Removing passive voice (wherever necessary)
- Simplifying sentences
- Change V&T
- Replacing old links and images with new ones
- Structure of these pages: Do these need to be separate topics? Can it be added /merged with another topic? Does the headline need to revised? Are all the topics + content helpful for our reader?
- Conceptual validation: Do these journeys, concepts, terms make sense for JSM? Do we need a developer to verify parts of this content?