Create custom notification templates to send alert notifications to alert contacts via phone, SMS, email, DingTalk, WeCom, Lark, Slack, or webhooks. You can use variables to customize the content in both Chinese and English.
Create a notification template
This section demonstrates how to create a notification template, using an email template as an example.
Log on to the Cloud Monitor 2.0 console, select the target workspace, and in the left-side navigation pane, navigate to .
Click Create notification template.
In the Create/edit notification template panel, configure the following parameters.
Parameter
Description
Template name
Required. The name of the notification template. Use a descriptive name for easy identification and management.
Template ID
Required. The unique identifier for the notification template. This parameter cannot be modified after creation. Use a combination of letters, numbers, and underscores (_).
Type
Required. The delivery channel for the notification template. This parameter cannot be modified after creation. Valid values:
- Phone: Voice call notifications with concise content.
- SMS: Text message notifications with concise content.
- Email: Supports HTML-formatted notifications. A Notification title is also required.
- DingTalk: Notifications for DingTalk bots that support Markdown format.
- WeCom: Notifications for WeCom bots that support Markdown format.
- Lark: Notifications for Lark bots that support Markdown format.
- Slack: Notifications for Slack bots that support Markdown format.
- webhook: Custom webhook notifications that support Markdown format.
Notification content
Required. The notification content, which can be customized with variables. You must configure both the Chinese template and the English template.
Click OK.
Delete a template
On the Notification template page, find the template you want to delete and click Delete in the Actions column.
In the confirmation dialog box, click OK.
This action cannot be undone. Notification policies that use this template will fail to send notifications. Proceed with caution.
Template variables
Notification templates use Go template syntax. Use variables in the format {{ .VariableName }} to dynamically populate alert information.
Subscription and incident variables
Parameter | Description |
| The name of the notification policy. |
| The number of associated alert events. |
| The highest severity among the alert events. |
| The user ID. |
| The grouping key-value pairs (Map object). |
Event detail variables
Iterate over .events to access the details of each alert event:
Parameter | Description |
| The severity of the alert. |
| The time the alert was triggered. |
| The event type. |
| The title of the alert. |
| The labels of the alert. |
| The annotations of the alert. |
| The domain of the alerting resource. |
| The entity type. |
| The entity ID. |
| The properties of the alerting resource. |
Template syntax examples
Iterate over grouping key-value pairs:
{{ range $key, $value := .incident.groupingKeys }}
>> {{ $key }} = {{ $value }}
{{ end }}Iterate over alert events (limit to the first 3):
{{ range $index, $event := .events }}
{{ if lt $index 3 }}
>- Severity: {{ $event.severity }}
>- Time: {{ $event.time }}
>- Title: {{ $event.subject }}
{{ end }}
{{ end }}