# Route Notifications to Slack or a Webhook

These instructions apply to the current Admin Console.

{% hint style="info" %}
Alerts are in early access and may not be available in your account. [Contact Contextual support](mailto:help@contextual.io) to request that Alerts be enabled for your tenant.
{% endhint %}

A destination stores where to send a notification. A subscription selects which alerts go there. Create both to route a threshold rule, or use a lifecycle template that renders a subscription.

## Create a Destination

The Admin Console provides **Alerts → Destinations → Create destination**. Choose **Slack webhook** or **Generic webhook**, enter **Label** and **Webhook URL**, and select **Save**.

The equivalent `POST /destinations` body for a generic receiver is:

```json
{
  "label": "Test alert receiver",
  "kind": "webhook",
  "secret": "https://alerts.example.com/contextual"
}
```

Replace the example URL with your reachable HTTPS receiver. `secret` is the delivery URL, not the signing key. Ordinary destination reads omit it; authorized URL reveal is a separate action. Slack destinations use `kind: slack-webhook` and a URL beginning with `https://hooks.slack.com/`.

Generic destinations must resolve to publicly routable addresses and pass delivery URL checks. Loopback and private-network targets are unsupported. For signing-key retrieval, verification, and retries, see [Verify incoming alert webhooks](https://docs.contextual.io/operate/alerts/webhook-receivers.md).

## Route One Rule

After creating the rule and destination, send `POST /subscriptions`:

```json
{
  "ruleId": "RULE_ID",
  "targetKind": "destination",
  "destinationId": "DESTINATION_ID",
  "channels": ["webhook"],
  "enabled": true,
  "notifyOnResolve": true
}
```

Use returned IDs, preserving their case. `webhook` is the supported channel for both destination kinds. User-targeted subscriptions do not have a deliverable channel in this version; do not use them as an email or inbox substitute.

`notifyOnResolve` defaults to `true`. Setting it to `false` suppresses resolved notifications for that subscription; it does not suppress stale notifications.

## Route by Labels

Omit `ruleId` to create a broader policy and add `matchers`, for example:

```json
{
  "matchers": [{ "label": "severity", "op": "=", "value": "critical" }],
  "targetKind": "destination",
  "destinationId": "DESTINATION_ID",
  "channels": ["webhook"],
  "enabled": true
}
```

Matchers support `=`, `!=`, `=~`, and `!~`. Review the scope carefully: an enabled subscription without a rule or narrowing matchers can match broadly. Multiple matching subscriptions can affect delivery; inspect the alert's delivery details for the participating subscription IDs.

A rule with `notify: none` may still match an organization policy. For temporary suppression, create a [silence](https://docs.contextual.io/operate/alerts/silences-and-alert-history.md).

## Change Recovery Notifications

For a supported threshold rule, open its **Rules** row actions and choose **Edit notifications**. Select **Edit notifications** for the destination route, change **Notify on recovery**, and select **Save**. You can also open the supported route from **Destinations → Advanced routing**. This requires rule/subscription read and subscription-update permissions, plus authoring availability.

The preference applies to that subscription. Other matching routes keep their own settings. This editor does not change the rule's condition or destination, and does not edit broad label policies or lifecycle routes. If the subscription changed, use **Reload latest** and review it before saving again.

## Maintain a Destination

In the Admin Console, open **Destinations → Edit destination**. The configured URL starts masked. Use **Reveal URL** to retrieve it with destination-update permission, or **Replace URL** to enter a replacement without retrieving the old value. After reveal, **Hide URL** and **Show URL** control visibility in the dialog.

Select **Save** to persist changes; revealing a URL alone does not change it. A label-only update still needs the complete destination body, so reveal or replace the URL before saving. **Cancel** closes the dialog without saving. If the destination changed, use **Refresh destination** and review the current record before trying again.

API clients read the record and send a full `PUT /destinations/{id}` with `secret` and its current hash. Ordinary reads remain redacted. The separate [webhook URL reveal endpoint](https://docs.contextual.io/tenants/tenant-apis/alerts-api/configuration.md#reveal-a-destination-url) requires an explicit current hash and returns the stored URL to authorized callers. Treat that response as a credential.

Replacing a generic webhook URL does not rotate its signing key. Remove or repoint subscriptions before deleting a destination, and review any metrics-connection health notification setting that references it.
