updates doc on action parameter variable mustache escaping (#88521)

Provides more detail on mustache variable escaping within action parameter templates.
This commit is contained in:
Patrick Mueller 2021-01-21 09:06:30 -05:00 committed by GitHub
parent c89f1f18d3
commit d3fa06b268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,11 +59,19 @@ Each action type exposes different properties. For example an email action allow
[role="screenshot"]
image::images/alert-flyout-action-details.png[UI for defining an email action]
Using the https://mustache.github.io/[Mustache] template syntax `{{variable name}}`, you can pass alert values at the time a condition is detected to an action. Note that using two curly braces will escape any HTML. Should you need to preserve HTML, use three curly braces (`{{{`). Available variables differ by alert type, and a list can be accessed using the "add variable" button.
Using the https://mustache.github.io/[Mustache] template syntax `{{variable name}}`, you can pass alert values at the time a condition is detected to an action. Available variables differ by alert type, and the list of available variables can be accessed using the "add variable" button.
[role="screenshot"]
image::images/alert-flyout-action-variables.png[Passing alert values to an action]
Some cases exist where the variable values will be "escaped", when used in a context where escaping is needed:
- For the <<email-action-type, Email>> connector, the `message` action configuration property escapes any characters that would be interpreted as Markdown.
- For the <<slack-action-type, Slack>> connector, the `message` action configuration property escapes any characters that would be interpreted as Slack Markdown.
- For the <<webhook-action-type, Webhook>> connector, the `body` action configuration property escapes any characters that are invalid in JSON string values.
Mustache also supports "triple braces" of the form `{{{variable name}}}`, which indicates no escaping should be done at all. Care should be used when using this form, as it could end up rendering the variable content in such a way as to make the resulting parameter invalid or formatted incorrectly.
You can attach more than one action. Clicking the "Add action" button will prompt you to select another alert type and repeat the above steps again.
[role="screenshot"]