Skip to content

Commit

Permalink
updates doc on action parameter variable mustache escaping (#88521)
Browse files Browse the repository at this point in the history
Provides more detail on mustache variable escaping within action parameter templates.
  • Loading branch information
pmuellr authored Jan 21, 2021
1 parent c89f1f1 commit d3fa06b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/user/alerting/defining-alerts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit d3fa06b

Please sign in to comment.