diff --git a/docs/sources/alerting/unified-alerting/message-templating/_index.md b/docs/sources/alerting/unified-alerting/message-templating/_index.md index a83efa158be..10a97c30480 100644 --- a/docs/sources/alerting/unified-alerting/message-templating/_index.md +++ b/docs/sources/alerting/unified-alerting/message-templating/_index.md @@ -79,11 +79,11 @@ You can use any of the following built-in template options to embed custom templ | `default.message` | Provides a formatted summary of firing and resolved alerts. | | `teams.default.message` | Similar to `default.messsage`, formatted for Microsoft Teams. | -### Custom template examples +### Example of a custom template -Here are a few examples of how to use custom templates. +Here's an example of how to use a custom template. You can also use the default template included in the setup. -Template to render a single alert: +Step 1: Configure a template to render a single alert. ``` {{ define "myalert" }} @@ -110,7 +110,7 @@ Template to render a single alert: {{ end }} ``` -Template to render entire notification message: +Step 2: Configure a template to render entire notification message. ``` {{ define "mymessage" }} @@ -125,6 +125,13 @@ Template to render entire notification message: {{ end }} ``` +Step 3: Add `mymessage` in the notification message field. + +``` +Alert summary: +{{ template "mymessage" . }} +``` + ### HTML in message templates HTML in alerting message templates is escaped. We do not support rendering of HTML in the resulting notification.