Skip to main content

Webhook alert method

Reading time: 0 minute(s) (0 words)

The webhook alert method sends alerts through an HTTP callback handler that is triggered by an event. You can create webhooks and configure them to handle different incident notifications using either custom or predefined notification templates.

Configuring the webhook alert methodโ€‹

You can configure your webhook alert method directly in the Nobl9 UI, or by applying a YAML file in sloctl.

Nobl9 Webโ€‹

To set up the alert method on the Nobl9 Web, follow these steps:

  1. Navigate to Integrations > Alert Methods.
  2. Click .
  3. Click the relevant Alert Method icon.

Then, in the Webhook Configuration Wizard:

  1. Enter the URL (mandatory).
    The URL must start with https://.

  2. Select a Project.
    Specifying a project is helpful when multiple users are spread across multiple teams or projects. When the Project field is left blank, Nobl9 uses the default project.
  3. Enter a Display Name.
    You can enter a user-friendly name with spaces in this field.
  4. Enter a Name.
    The name is mandatory and can only contain lowercase, alphanumeric characters, and dashes (for example, my-alert-method-1). Nobl9 duplicates the display name here, transforming it into the supported format, but you can edit the result.
  5. Enter a Description.
    Here you can add details such as who is responsible for the integration (team/owner) and the purpose of creating it.
  6. The Custom Header field is used to add a customized header. Click the blue plus icon icon to add a header. For example, a custom header named Authorization.

    • The Key can contain alphanumeric characters and dashes, and must start with a letter.
  7. The Notification Details tab allows you to configure a standard Nobl9 webhook or a Custom webhook:

    • A standard Nobl9 webhook lets you choose fields from a checklist which are then sent with the default Nobl9 webhook message. You must select at least one field from the checklist.

    • A Custom webhook lets you create your own payload in the JSON format.1
      1This functionality works with JSON only.

      • Each field name must be enclosed in double quotes ("<field_name>").

      • Most fields are in string format.

      • If the fieldโ€™s value is an array, you must use JSON syntax to define it. The array fields have a special format with square brackets ([]) after the variable name. For example $alert_policy_conditions[].

  8. Click Add alert method.

YAML configurationโ€‹

YAML for the webhook integration supports custom notification message templates. The template can be specified in two ways:

  • Only variables are specified, and the notification message is generated automatically
  • A full message template is specified, with variables in the form $<variable_name>
General YAML sample for Webhook alert method
apiVersion: n9/v1alpha
kind: AlertMethod
metadata:
name: string # Mandatory
displayName: string # Optional
project: default # Mandatory
# Optional
# The key value: only alphanumeric characters, `-`, `_`, or `.` are allowed.
# The key value must start and end with an alphanumeric character.
# An optional DNS subdomain prefix followed by `/` is allowed.
annotations:
key: value
spec:
description: string # Optional
webhook:
url: string # Mandatory, must start with https://
# Either `templateFields` or `template` must be specified, but not both.
templateFields: # array of strings
- string1
- string2
# Replace the `templateFields` with `template` if a full template is used
# template: string

Important notes:

  • The Webhook integration definition requires one (and only one) of these entries:

    • spec.webhook.template

    • spec.webhook.templateFields

  • The difference between alert_policy_conditions[] and alert_policy_conditions_text is that alert_policy_conditions[] creates a valid JSON array of conditions as strings, whereas alert_policy_conditions_text creates a single string field. For example:

    {
    "text": "Remaining error budget is 10%, Error budget would be exhausted in 15 minutes and this condition lasts for 1 hour",
    "array": [
    "Remaining error budget is 10%",
    "Error budget would be exhausted in 15 minutes and this condition lasts for 1 hour"
    ]
    }
  • slo_labels_text, service_labels_text, and alert_policy_labels_text are comma-separated key:value pairs. For example:

    • slo:ratio, slo:calendar

    • project:myproject

    • alert:low, alert:high

Testing the webhook alert policy in the UIโ€‹

You can test alert methods for all notification services supported by the Nobl9 platform through the UI.

To verify the correctness of your alert method configuration:

  1. Navigate to Integrations > Alert Methods.
  2. Click the required alert method.
    Its Details page opens.
  3. Click Test under the alert method name:

    • When the configuration is correct, Nobl9 displays Test completed successfully! under the button.
    • Otherwise, the Test failed message appears. It contains the details of incorrect settings.
For a more in-depth look, consult additional resources: