---
title: How to Create, Edit, and Delete Alerts
description: Create, view, edit, and delete alerts and notification channels for supported DigitalOcean resources.
product: Insights
url: https://docs.digitalocean.com/products/insights/how-to/manage-alerts/
last_updated: "2026-11-23"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Create, Edit, and Delete Alerts

DigitalOcean Insights provides metrics, logs, traces, dashboards, and alerts to help you monitor, analyze, and troubleshoot supported DigitalOcean resources.

Resource alerts monitor metrics from supported resources and notify you when specified conditions are met. You can create alert rules with configurable thresholds, evaluation windows, and notification channels, including email, Slack, and webhooks.

Available metrics depend on the selected resource type. Metrics are currently available for Droplets, Kubernetes, Managed Databases, Load Balancers, App Platform, Functions, AI/ML products, and networking services.

For an overview of metrics and how they relate to logs and traces, see [Understanding Insights Telemetry](https://docs.digitalocean.com/products/insights/concepts/understanding-telemetry/index.html.md).

**Note**:

  You can enable available Insights telemetry when creating a supported DigitalOcean resource. The available options depend on the resource type.

  For Droplets, under the **Monitoring** section, select **Improved Metrics and monitoring (Free)** to install the DigitalOcean metrics agent (`do-agent`). For GPU Droplets created with **AI/ML Ready** images, enable GPU Observability during resource creation. The agent collects supported system and GPU metrics, but logs and traces are not currently supported.

  For supported managed resources, you can enable log and trace collection during resource creation and disable it later if needed. Insights is enabled by default for [Managed Agents](https://docs.digitalocean.com/products/managed-agents/index.html.md).

To view and manage alerts, go to the [**Alerts**](https://cloud.digitalocean.com/insights/alerts?utm_source=docs-agent&utm_medium=md) tab in the DigitalOcean Control Panel.

## View Alerts Using the Control Panel

The **Alerts** tab lets you monitor active and resolved alerts, manage alert rules, and configure notification channels.

![Insights All Alerts page showing the Active Alerts view, status filters, and no active alerts message.](https://docs.digitalocean.com/screenshots/insights/alerts-all-alerts.4ae27fb3687d3ad1c8f0e2cf3d8f6ff77bae0e1ee94f935c4f1ddfe1e94e75e3.png)

In the **All Alerts** tab, you can view active and resolved alerts. To filter the alerts displayed, in the top-right corner, select one of the following:

- **All** displays both active and resolved alerts.
- **Active** (default) displays alerts whose conditions are currently being met.
- **Resolved** displays alerts whose conditions are no longer being met.

After an alert resolves, you can view it in the **Resolved** tab for up to 30 days.

## View Alerts Using Automation

You can view alert instances using the DigitalOcean CLI or API to retrieve existing alerts and their details.

### View Alerts via the CLI

To retrieve a list of alert instances, use the `doctl insights alert-instance list` command. To show only active or resolved alerts, add the `--status` flag.

## How to List Alert Instances Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights alert-instance list`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/alert-instance/list/index.html.md) for more details:

   ```shell
   doctl insights alert-instance list [flags]
   ```

   The following example lists active alert instances for an alert rule:

   ```shell
   doctl insights alert-instance list --status active --rule-id 4b6f2a7e-1c2d-4e5f-8a9b-0c1d2e3f4a5b
   ```

To retrieve details for a specific alert instance, use the `doctl insights alert-instance get` command with the alert instance ID.

## How to Retrieve an Alert Instance Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights alert-instance get`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/alert-instance/get/index.html.md) for more details:

   ```shell
   doctl insights alert-instance get <alert-instance-id> [flags]
   ```

   The following example retrieves an alert instance:

   ```shell
   doctl insights alert-instance get 9c1f8e2a-3b4d-4c5e-9f6a-7b8c9d0e1f2a
   ```

### View Alerts via the API

To retrieve a list of alert instances, send a request to the [List Alert Instances](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_alertInstances) endpoint.

## How to List Alert Instances Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a GET request to [`https://api.digitalocean.com/v2/insights/alert-instances`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_alertInstances).

Using cURL:

```shell
curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/insights/alert-instances?status=active&page=1&per_page=20"
```

To retrieve details for a specific alert instance, send its ID to the [Retrieve an Alert Instance](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_get_alertInstance) endpoint.

## How to Retrieve an Alert Instance Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a GET request to [`https://api.digitalocean.com/v2/insights/alert-instances/{id}`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_get_alertInstance).

Using cURL:

```shell
curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/insights/alert-instances/a1b2c3d4-e5f6-7890-abcd-ef1234567890"
```

## View an Alert Rule Using the Control Panel

The **Alert Rules** tab lists your configured alert rules and provides options to create, edit, enable, disable, or delete them. For recommendations on configuring alert conditions, selecting evaluation windows, and managing notifications, see [Alerting Best Practices](https://docs.digitalocean.com/products/insights/concepts/alert-best-practices/index.html.md).

![Insights Alert Rules page showing configured alert rules, resource targets, conditions, status toggles, and the Create rule button.](https://docs.digitalocean.com/screenshots/insights/alerts-alert-rules.3207694e98b37f4a0c31d9601c38a0e2c1f8939139e66aff2f7ea3c72752d213.png)

## Create an Alert Rule Using the Control Panel

You can create alert rules to monitor supported resources and receive notifications when specified conditions are met.

To create an alert rule, on the left, click **Alert Rules**, and then click **Create rule** to open the **Create alert rule** page.

![Create alert rule page showing fields for resource type, metric, resource selection, condition, notification method, and summary.](https://docs.digitalocean.com/screenshots/insights/create-alert-rule.cf7a9fc342a82c1b185d5a0ebae3b1681d994169fcfa5f32e6d34b4ac78639da.png)

### Select a Resource Type

The **Resource type** setting determines which supported DigitalOcean resource type the alert monitors. The available metrics and resource targeting options depend on the selected resource type.

To select a resource type, click the **Resource type** dropdown menu, and then choose the resource type you want to monitor, such as **Droplets**, **Apps**, **Databases**, **Kubernetes**, **Load Balancers**, or **NFS**.

After you select a resource type, the rule targets all resources of that type by default.

### Select a Metric

The **Metric** setting determines which metric the alert monitors.

To select a metric, click the **Metric** field, and then choose a metric available for the selected resource type. For example, for Droplets, you can select `do.droplets.cpu_utilization`.

**Note**:

  Alert rules do not support GPU metrics. For GPU Droplets, you can select the same metrics as other Droplets.

### Select Resources

The **Resource** section lets you narrow the alert from all resources of the selected type to specific resources or tags.

By default, all resources of the selected type are selected. For example, for Droplets, the default selection is **All Droplets**.

To monitor specific resources instead, in the **Resource** section, click the selection field, and then choose the individual resources or tags you want to monitor. To remove the default selection, click the **x** on the selected resource group or click **clear all**.

### Set a Condition

The **Condition** setting determines how the metric value is compared against the alert threshold.

To set a condition, click the operator dropdown menu and select **>=**, **>**, **<=**, **<**, **=**, or **!=**.

Then, in the value field, enter the threshold that triggers the alert when the selected condition is met.

### Select an Evaluation Window

The **Evaluation window** setting determines how long the alert condition must persist before the alert triggers.

To select an evaluation window, click the **Evaluation window** dropdown menu, and then choose **1 minute**, **5 minutes**, **10 minutes**, **15 minutes**, **30 minutes**, or **1 hour**.

Shorter windows detect changes faster but may trigger on temporary fluctuations. Longer windows reduce sensitivity to brief changes but may delay notifications.

### Configure Re-notification

The **Re-notify while unresolved** setting determines how often DigitalOcean sends another notification while the alert remains active.

To set the re-notification frequency, click the **Re-notify while unresolved** dropdown menu, and then choose **Every 30 minutes**, **Every 1 hour**, **Every 4 hours**, or **Never**.

### Select a Notification Method

The **Notification method** setting determines which notification channels receive alerts from the rule.

To select an existing notification channel, click the **Notification method** field, and then choose one or more notification channels.

To create a new notification channel, click **+ Create New Notification Channel** to open the **Create notification channel** window, and then [configure the notification channel](#create-notification-channel).

### Choose a Name

In the **Name** field, enter a descriptive name for the rule. Use a name that identifies the resource type, metric, environment, or threshold, such as `Production Droplets CPU >= 80%`.

### Review the Summary and Create the Rule

In the **Summary** section, review the alert rule configuration, including the metric, condition, resource selection, and notification method.

When the configuration is complete, click **Create alert rule**.

The new rule appears in the **Alert Rules** tab and is enabled by default. In the **Status** column, you can use the toggle to enable or disable the rule later.

**Note**:

  If an alert rule has an active alert when you disable it, the alert’s state changes to **Resolved**.

## Create an Alert Rule Using Automation

You can create alert rules using the DigitalOcean CLI or API to configure alert conditions, evaluation windows, and notification channels.

### Create an Alert Rule via the CLI

To create an alert rule, use the `doctl insights alert-rule create` command with flags for the metric, condition, evaluation window, and notification channel. Alternatively, pass a complete JSON or YAML request with the `--request-file` flag.

## How to Create an Alert Rule Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights alert-rule create`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/alert-rule/create/index.html.md) for more details:

   ```shell
   doctl insights alert-rule create [flags]
   ```

### Create an Alert Rule via the API

To create an alert rule, send a request to the [Create an Alert Rule](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_create_alertRule) endpoint with the metric, condition, evaluation window, and notification channel configuration.

## How to Create an Alert Rule Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a POST request to [`https://api.digitalocean.com/v2/insights/alert-rules`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_create_alertRule).

Using cURL:

```shell
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"spec":{"name":"High CPU","query":{"metric":"do.droplets.cpu_utilization","resource_urns":["do:droplet:12345"],"tags":["env:prod"]},"condition":{"window":"EVALUATION_WINDOW_5M"},"thresholds":{"warning":80,"critical":95,"operator":"THRESHOLD_OPERATOR_GREATER_THAN"},"notification_channels":[{"notification_channel_id":"550e8400-e29b-41d4-a716-446655440000","notify_on":["SEVERITY_CRITICAL"]}],"re_alert_duration":"RE_ALERT_DURATION_4H"}}' \
  "https://api.digitalocean.com/v2/insights/alert-rules"
```

## Edit an Alert Rule Using the Control Panel

To edit an alert rule, on the left, click **Alert Rules**, then find the rule you want to edit, on the right, click **…**, and then click **Edit** to open the **Edit alert rule** page.

Update the rule’s resource, metric, condition, evaluation window, re-notification frequency, or notification method as needed. These settings use the same configuration options as when you [create a rule](#create-alert-rule).

In the **Summary** section, review your changes, and then click **Save alert rule**.

Your changes take effect during the next alert evaluation cycle, which occurs approximately once per minute. If the rule has an active alert, its status updates during the next evaluation cycle based on the revised configuration.

## Edit an Alert Rule Using Automation

You can edit existing alert rules using the DigitalOcean CLI or API to update alert conditions, evaluation windows, and notification channels.

### Edit an Alert Rule via the CLI

To edit an alert rule, use the `doctl insights alert-rule update` command with the alert rule ID and the flags for the settings you want to change. Settings you omit keep their current values. You can retrieve alert rule IDs using the `doctl insights alert-rule list` command.

## How to Edit an Alert Rule Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights alert-rule update`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/alert-rule/update/index.html.md) for more details:

   ```shell
   doctl insights alert-rule update <rule-id> [flags]
   ```

### Edit an Alert Rule via the API

To edit an alert rule, send a request to the [Update an Alert Rule](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_update_alertRule) endpoint with the alert rule ID and updated configuration. You can retrieve alert rule IDs using the [List Alert Rules](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_alertRules) endpoint.

## How to Edit an Alert Rule Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a PUT request to [`https://api.digitalocean.com/v2/insights/alert-rules/{id}`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_update_alertRule).

Using cURL:

```shell
curl -X PUT \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"spec":{"name":"High CPU (renamed)","query":{"metric":"do.droplets.cpu_utilization","resource_urns":["do:droplet:12345","do:droplet:67890"]},"condition":{"window":"EVALUATION_WINDOW_15M"},"thresholds":{"critical":90,"operator":"THRESHOLD_OPERATOR_GREATER_THAN_OR_EQUAL"},"notification_channels":[{"notification_channel_id":"550e8400-e29b-41d4-a716-446655440000"}]},"status":"ALERT_RULE_STATUS_PAUSED"}' \
  "https://api.digitalocean.com/v2/insights/alert-rules/a1b2c3d4-e5f6-7890-abcd-ef1234567890"
```

## Delete an Alert Rule Using the Control Panel

To delete an alert rule, on the left, click **Alert Rules**, then find the rule you want to delete, on the right, click **…**, and then click **Delete** to open the **Delete alert rule** window.

Deleting an alert rule permanently removes it and stops the rule from evaluating metrics or triggering new alerts.

In the **Alert rule name** field, enter the rule’s name to confirm the deletion, and then click **Delete**.

**Note**:

  If the alert rule has an active alert when you delete it, the alert’s state changes to **Resolved**.

## Delete an Alert Rule Using Automation

You can delete existing alert rules using the DigitalOcean CLI or API to stop evaluating their conditions and sending notifications.

### Delete an Alert Rule via the CLI

To delete an alert rule, use the `doctl insights alert-rule delete` command with the alert rule ID. You can retrieve alert rule IDs using the `doctl insights alert-rule list` command.

## How to Delete an Alert Rule Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights alert-rule delete`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/alert-rule/delete/index.html.md) for more details:

   ```shell
   doctl insights alert-rule delete <rule-id> [flags]
   ```

### Delete an Alert Rule via the API

To delete an alert rule, send a request to the [Delete an Alert Rule](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_delete_alertRule) endpoint with the alert rule ID. You can retrieve alert rule IDs using the [List Alert Rules](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_alertRules) endpoint.

## How to Delete an Alert Rule Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a DELETE request to [`https://api.digitalocean.com/v2/insights/alert-rules/{id}`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_delete_alertRule).

Using cURL:

```shell
curl -X DELETE \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/insights/alert-rules/a1b2c3d4-e5f6-7890-abcd-ef1234567890"
```

## View a Notification Channel Using the Control Panel

Notification channels define where DigitalOcean sends notifications when an alert rule triggers. You can create channels for email, Slack, or webhook destinations and reuse them across multiple alert rules.

![Insights Notification Channels page showing configured email, Slack, and webhook channels, associated alert rule counts, and the Create notification channel button.](https://docs.digitalocean.com/screenshots/insights/alert-notification-channels.dafe33e3ff8842ea5ddd4444eea910d2a27c83b865ed12921b40b596c393c350.png)

## Create a Notification Channel Using the Control Panel

You can create notification channels to send alert notifications through email, Slack, or webhooks. Once created, you can reuse notification channels across multiple alert rules.

To create a notification channel, on the left, click **Notification Channels**, and then in the top-right corner, click **Create notification channel** to open the **Create notification channel** window.

Alternatively, when creating an alert rule, under the **Notification method** section, click **+ Create New Notification Channel**.

### Choose a Notification Name

In the **Name** field, enter a descriptive name for the notification channel.

### Choose Notification Type

To choose a notification type, click the **Type** dropdown menu, and then choose **Email**, **Slack**, or **Webhook**.

### Configure Notification

Configure the notification channel based on the selected type:

### Email

For an email notification channel, in the **Recipients** field, select the email addresses that should receive alert notifications.

Only verified email addresses can receive alert notifications. Recipients do not need to be members of your DigitalOcean team, but they must be [team contact emails](https://docs.digitalocean.com/platform/teams/settings/contact-emails/index.html.md) that a team owner has added and verified. To add or verify an email address, click **Manage contact emails**.

### Slack

For a Slack notification channel, in the **Slack destination** section, select either **Existing Connection** or **Custom**:

- **Existing Connection:** Select an existing Slack connection to receive alert notifications. To connect another Slack channel, click **+ Add additional Slack connections**.
- **Custom:** In the **Slack Webhook URL** field, enter the Slack webhook URL. Then, in the **Channel** field, enter the destination Slack channel.

### Webhook

For a webhook notification channel, in the **URL** field, enter the endpoint that should receive alert notifications.

In the **Authentication** dropdown menu, select one of the following options:

- **None:** Sends notifications without an authentication method.
- **Basic auth:** Enter the **Username** and **Password** required by your webhook endpoint.
- **Bearer token:** Enter the **Bearer token** required by your webhook endpoint.

To sign webhook payloads, select **Sign webhook payload**, and then enter a **Signing secret**. We uses this secret to generate an HMAC signature that your endpoint can use to verify alert payloads.

You can also add custom HTTP headers by clicking **+ Add HTTP header**, and then entering the **Key** and **Value** for each header. Click **+ Add HTTP header** again to add more headers, or click the trash icon to remove a header.

**Note**:

  Use custom HTTP headers for routing, tenancy, or vendor-specific metadata. To configure authorization, use the **Authentication** dropdown menu instead.

### Webhook Payload and Signature

When an alert rule that uses a webhook notification channel triggers, DigitalOcean sends a `POST` request to the channel’s URL. The body is a [CloudEvents](https://cloudevents.io/) 1.0 JSON object (`Content-Type: application/cloudevents+json`). Alert details are in the `data` field.

The request includes headers like the following:

```text
Content-Type: application/cloudevents+json
digitalocean-event-name: observability.alert.triggered
X-DigitalOcean-Signature: t=1793988325,v1=<hex-digest>
```

The following example shows a webhook payload for a Droplet alert. Payload details vary based on the resource and metric.

```json
{
  "specversion": "1.0",
  "id": "cccccccc-dddd-eeee-ffff-aaaaaaaaaaaa",
  "source": "cloud.digitalocean.com/observability/alerts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "type": "com.digitalocean.observability.alert.triggered",
  "subject": "do:droplet:123456789",
  "time": "2026-11-06T18:05:25Z",
  "datacontenttype": "application/json",
  "data": {
    "alert_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    "alert_rule_id": "bbbbbbbb-cccc-dddd-eeee-ffffffffffff",
    "alert_rule_name": "High CPU",
    "state": "Triggered",
    "severity": "SEVERITY_CRITICAL",
    "metric": "do.droplets.cpu_utilization",
    "resource_urn": "do:droplet:123456789",
    "resource_name": "example-droplet",
    "resource_url": "https://cloud.digitalocean.com/droplets/123456789/insights",
    "value": 87.5,
    "labels": {
      "host_id": "do:droplet:123456789",
      "resource_urn": "do:droplet:123456789"
    }
  }
}
```

If you enable **Sign webhook payload**, DigitalOcean sets `X-DigitalOcean-Signature` to `t=<unix-timestamp>,v1=<hex-digest>`.

To validate the signature, read the raw request body as bytes. Do not re-serialize the JSON before checking the signature.

Then, parse `t` and every `v1` value from the `X-DigitalOcean-Signature` header. The format allows more than one `v1` value.

Then, reject the request if `t` is more than five minutes from your server’s current time. This prevents an attacker from replaying a captured delivery.

Then, compute an HMAC-SHA256 digest of the string `{t}.{raw_body}` using your channel signing secret as the key.

Afterwards, compare the hex-encoded digest to each `v1` value using a constant-time comparison. Reject the request if none match.

The following Python example checks a signed webhook delivery:

```python
import hashlib
import hmac
import time

TOLERANCE_SECONDS = 300

def verify_insights_webhook(raw_body: bytes, signature_header: str, secret: str) -> bool:
    timestamp = None
    candidates = []

    for item in signature_header.split(","):
        key, _, value = item.partition("=")
        if key == "t":
            timestamp = value
        elif key == "v1":
            candidates.append(value)

    try:
        signed_at = int(timestamp)
    except (TypeError, ValueError):
        return False

    if abs(time.time() - signed_at) > TOLERANCE_SECONDS:
        return False

    signed_payload = f"{timestamp}.".encode("utf-8") + raw_body
    digest = hmac.new(secret.encode("utf-8"), signed_payload, hashlib.sha256).hexdigest()

    return any(
        hmac.compare_digest(digest.encode("utf-8"), candidate.encode("utf-8"))
        for candidate in candidates
    )
```

Each delivery has a unique `id`, including repeat notifications for the same alert. To also reject a replay that arrives within the five-minute window, store the `id` of each delivery you accept and reject any later request with the same `id`. Keep each `id` until five minutes after its `t` value. After that, the timestamp check rejects the delivery, so you no longer need the `id`.

After configuring your notification, click **Create notification channel**.

## Create a Notification Channel Using Automation

You can create notification channels using the DigitalOcean CLI or API to configure how alert notifications are delivered. Notification channels you create using the CLI or API can send Slack notifications only through a Slack incoming webhook URL. To connect Slack using OAuth, [create the channel using the Control Panel](#create-notification-channel).

### Create a Notification Channel via the CLI

To create a notification channel, use the `doctl insights notification-channel create` command with the `--name` and `--type` flags and the destination flags for the channel type, such as `--emails` or `--webhook-url`. Alternatively, pass a complete JSON or YAML request with the `--request-file` flag.

## How to Create a Notification Channel Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights notification-channel create`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/notification-channel/create/index.html.md) for more details:

   ```shell
   doctl insights notification-channel create [flags]
   ```

### Create a Notification Channel via the API

To create a notification channel, send a request to the [Create a Notification Channel](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_create_notificationChannel) endpoint with the channel name, type, and destination configuration.

## How to Create a Notification Channel Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a POST request to [`https://api.digitalocean.com/v2/insights/notification-channels`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_create_notificationChannel).

Using cURL:

```shell
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"name":"Platform alerts","slack":{"webhook_url":"https://hooks.slack.com/services/T000/B000/XXXXXXXX","channel":"#platform-alerts"}}' \
  "https://api.digitalocean.com/v2/insights/notification-channels"
```

## Edit a Notification Channel Using the Control Panel

To edit a notification channel, on the left, click **Notification Channels**, find the channel you want to edit, and then click its name to open the **Edit notification channel** window.

Update the channel settings as needed. The available settings are the same as when you [create a notification channel](#create-notification-channel).

After making your changes, click **Save notification channel**.

## Edit a Notification Channel Using Automation

You can edit existing notification channels using the DigitalOcean CLI or API to update their names, types, and destination configurations.

### Edit a Notification Channel via the CLI

To edit a notification channel, use the `doctl insights notification-channel update` command with the notification channel ID and the channel’s complete configuration. The command replaces the existing configuration, except for secret values such as passwords, bearer tokens, and signing secrets, which keep their current values when you omit them. You can retrieve notification channel IDs using the `doctl insights notification-channel list` command.

## How to Edit a Notification Channel Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights notification-channel update`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/notification-channel/update/index.html.md) for more details:

   ```shell
   doctl insights notification-channel update <channel-id> [flags]
   ```

### Edit a Notification Channel via the API

To edit a notification channel, send a request to the [Update a Notification Channel](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_update_notificationChannel) endpoint with the notification channel ID and updated configuration. You can retrieve notification channel IDs using the [List Notification Channels](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_notificationChannels) endpoint.

## How to Edit a Notification Channel Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a PUT request to [`https://api.digitalocean.com/v2/insights/notification-channels/{id}`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_update_notificationChannel).

Using cURL:

```shell
curl -X PUT \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"name":"Platform alerts (updated)","slack":{"channel":"#platform-alerts-prod"}}' \
  "https://api.digitalocean.com/v2/insights/notification-channels/550e8400-e29b-41d4-a716-446655440000"
```

## Delete a Notification Channel Using the Control Panel

To delete a notification channel, on the left, click **Notification Channels**, find the channel you want to delete, click **…** on the right of it, and then click **Delete** to open the **Delete notification channel** window.

Deleting a notification channel permanently removes it.

**Note**:

  You cannot delete a notification channel that is used by an alert rule. Before deleting the channel, [update the associated alert rules to use another notification channel](#edit-alert-rule).

In the **Notification channel name** field, enter the channel’s name to confirm the deletion, and then click **Delete**.

## Delete a Notification Channel Using Automation

You can delete existing notification channels using the DigitalOcean CLI or API to remove channels you no longer need.

### Delete a Notification Channel via the CLI

To delete a notification channel, use the `doctl insights notification-channel delete` command with the notification channel ID. You can retrieve notification channel IDs using the `doctl insights notification-channel list` command.

## How to Delete a Notification Channel Using the DigitalOcean CLI

1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI.
2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`.
3. Use the token to grant `doctl` access to your DigitalOcean account.

   ```shell
   doctl auth init
   ```
4. Finally, run `doctl insights notification-channel delete`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/insights/notification-channel/delete/index.html.md) for more details:

   ```shell
   doctl insights notification-channel delete <channel-id> [flags]
   ```

### Delete a Notification Channel via the API

To delete a notification channel, send a request to the [Delete a Notification Channel](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_delete_notificationChannel) endpoint with the notification channel ID. You can retrieve notification channel IDs using the [List Notification Channels](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_list_notificationChannels) endpoint.

## How to Delete a Notification Channel Using the DigitalOcean API

[Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API.

### cURL

Send a DELETE request to [`https://api.digitalocean.com/v2/insights/notification-channels/{id}`](https://docs.digitalocean.com/reference/api/reference/insights/index.html.md#insights_delete_notificationChannel).

Using cURL:

```shell
curl -X DELETE \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/insights/notification-channels/550e8400-e29b-41d4-a716-446655440000"
```