All Products
Search
Document Center

Managed Service for OpenTelemetry:Customize alert notification objects via webhook

Last Updated:Jun 20, 2026

Alert Management in Managed Service for OpenTelemetry lets you send webhook alerts to third-party notification objects. This topic uses Lark as an example to explain how to create a webhook alert.

Step 1: Obtain a webhook URL

Configure a Lark webhook bot on your PC.

  1. Open and log in to Lark.

  2. Click the + icon, and then click Create group to create an alert group.

  3. Click the group settings icon, and then click the Bots tab.

  4. On the Bots tab, click Add Bot.

  5. In the Add Bot panel, select Custom Bot.

  6. On the configuration page, set a display name and description, and then click Add.

  7. In the confirmation panel that appears, click Copy, and then click Finish. Copy the webhook URL and keep it secure. Do not expose it publicly. In the Security Settings area, select the Custom Keywords checkbox, add the keyword alert, and then click Finish.

Step 2: Create a webhook notification object

  1. Log on to the Managed Service for OpenTelemetry console.

  2. In the left-side navigation pane, choose Alert Management > Notification Objects. Click the Webhook Integration tab, and then click Create Webhook.

  3. In the Create Webhook dialog box, configure the following parameters.

    Parameter

    Description

    Webhook Name

    Required. A custom name for the webhook.

    Post or Get

    Required. The request method. The URL cannot exceed 256 characters.

    In this example, select Post and paste the webhook URL from Step 1: Obtain a webhook URL into the text box on the right.

    Header or Param

    Optional. The request header. The value cannot exceed 200 characters. Click + Create to add other header or parameter information. The default request header is Content-Type: text/plain; charset=UTF-8. The total number of headers and parameters cannot exceed six.

    In this example, set the following two headers:

    • Arms-Content-Type : json

    • Content-Type : application/json

    Notification template

    The template for notifications sent when an alert is triggered. This parameter is optional and appears only if you select the Post request method. You can use the $content template variable to output the notification content. The template cannot exceed 500 characters. For more information, see Configure notification templates and webhook templates.

    The following is a sample notification template:

    {
    "Alert Name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster Name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application Name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification Policy":"{{ .dispatchRuleName }}",
    "Alert Time":"{{ .startTime }}",
    "Alert Content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    In this example using Lark, you can use the following text format:

    {
      "msg_type": "text",
      "content": {
        "text": "Alert Name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster Name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application Name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Notification Policy: {{ .dispatchRuleName }} \nAlert Time: {{ .startTime }} \nAlert Content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }

    Alert resolution template

    The template for notifications sent when an alert is resolved. This parameter is optional and appears only if you select the Post request method. You can use the $content template variable to output the notification content. The template cannot exceed 500 characters. For more information, see Configure notification templates and webhook templates.

    The following is a sample alert resolution template:

    {
    "Alert Name":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}",
    "Cluster Name":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}",
    "Application Name":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}",
    "Notification Policy":"{{ .dispatchRuleName }}",
    "Resolution Time":"{{ .endTime }}",
    "Alert Content":"{{ for .alerts }} {{ .annotations.message }} {{ end }}"
    }

    In this example using Lark, you can use the following text format:

    {
      "msg_type": "text",
      "content": {
        "text": "Alert Name: {{ .commonLabels.alertname }}\n{{if .commonLabels.clustername }}Cluster Name: {{ .commonLabels.clustername }}\n{{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}Application Name: {{ .commonLabels._aliyun_arms_involvedObject_name }}\n{{ end }}Resolution Time: {{ .endTime }} \nNotification Policy: {{ .dispatchRuleName }} \nResolved Alert Content: {{ for .alerts }} {{ .annotations.message }}\n {{ end }}"
      }
    }
  4. Click Send Test to verify the configuration.

  5. Click OK.

Step 3: Configure a notification policy

Create or edit a notification policy, set the Notification Object to Universal Webhook, and then select the corresponding Webhook Integration.

Note

If the target endpoint does not respond within 5 seconds, the webhook alert times out and the notification fails.