# Datadog Webhook Integration

Forward alerts from Datadog monitors, synthetic tests, and APM error-tracking into OnCallAlert using Datadog's custom webhook integration.

## Step 1: Create a Generic API Key in OnCallAlert

1. In OnCallAlert, select your destination service.
2. Click **Integration Keys &rarr; Create Integration Key**.
3. Select **Generic API** and label it (e.g. `Datadog Webhook`).
4. Note the incoming API URL:
   ```text
   https://oncall.yourcompany.com/api/v2/generic/incoming
   ```
   and your Bearer token.

## Step 2: Configure Webhook Integration in Datadog

1. In Datadog, go to **Integrations &rarr; Integrations** and search for **Webhooks**.
2. Click **New Webhook**.
3. **Name**: `oncallalert`
4. **URL**: `https://oncall.yourcompany.com/api/v2/generic/incoming`
5. **Custom Headers**:
   ```json
   {
     "Authorization": "Bearer YOUR_INTEGRATION_KEY"
   }
   ```
6. **Payload**: Select **Custom** and enter the following JSON payload template:
   ```json
   {
     "summary": "$EVENT_TITLE",
     "details": "$EVENT_MSG\n\nMonitor: $ALERT_LINK\nTags: $TAGS",
     "dedup": "$ALERT_ID"
   }
   ```
7. Click **Save**.

## Step 3: Route Monitor Notifications

In any Datadog Monitor, add `@webhook-oncallalert` to the **Notify your team** section:

```text
{{#is_alert}}
Production Redis latency elevated above SLA.
@webhook-oncallalert
{{/is_alert}}
```

Datadog will dispatch alerts to OnCallAlert with deduplication based on monitor alert IDs.
