This topic provides answers to some frequently asked questions about custom webhooks.
How do I configure an alert template?
If you want to send alert notifications by using a custom webhook, we recommend that you configure content in your alert template in a valid JSON format. This way, the result after rendering is in a valid JSON format.
Assume that you want to configure an alert template for the following alert message.
In the alert message, the value of the alert.annotations.message field contains double quotation marks (""). If you directly reference the {{ alert.annotations.message }}
field, the result after rendering is in an invalid JSON format, and alert notifications
fail to be sent.
You must use the built-in function quote(value) in alert templates to reference the field. This prevents an invalid JSON format that is caused by special characters.
- Sample alert message
{ "project": "test-alert", "region": "cn-hangzhou", "labels": { "service": "signin", "env": "prod" }, "annotations": { "message": "user \"xxx\" signin failed, error is: userNotFound" } }
- Sample alert template
{ "project": "{{ alert.project }}", "service": "{{ alert.labels.service }}", "message": {{ alert.annotations.message quote }} }
- Sample result after rendering
{ "project": "test-alert", "service": "signin", "message": "user \"xxx\" signin failed, error is: userNotFound" }
How do I select a network?

How do I verify access permissions?
- Configure an IP address whitelist for your webhook and add the IP addresses 120.76.47.88 and 119.23.150.175 to the whitelist.
- Configure an HTTP header.
- Use a custom token. You can set the Request Header parameter to
Authorization: Bearer token
. Replace token with your custom token. - Use basic authentication. You can set the Request Header parameter to
Authorization: Basic $(base64_encode(username:password))
. Replace username and password with your actual username and password.
- Use a custom token. You can set the Request Header parameter to
For example, if your webhook uses the NGINX reverse proxy, you can configure basic authentication in NGINX to verify access permissions.