---
title: "Benachrichtigungskanal testen"
description: "Testet die Konfiguration eines Benachrichtigungskanals. Sendet optional eine echte Testnachricht."
---

`POST /api/notification-channels/test`

## Anfrage (Request Body)

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `type` | string | Ja | - | `webhook`, `slack`, `discord`, `pagerduty`, `pushover`, `opsgenie` |
| `config` | object | Ja | `{}` | Kanal-Config mit Geheimnissen |
| `organizationId` | number | Nein | aus Session | Organisations-Scope |
| `customerId` | number | Nein | null | Kunden-Scope |
| `websiteId` | number | Nein | null | Website-Scope |
| `dryRun` | boolean | Nein | false | Falls true, wird nur validiert (kein tatsächliches Senden) |

## Beispiel (cURL)

```bash
curl -X POST "$BASE_URL/api/notification-channels/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "webhook",
    "config": {
      "url": "https://deinkunde.com/webhook",
      "method": "POST",
      "timeout": 15
    },
    "dryRun": false
  }'
```

## Antwort (Response)

```json
{
  "success": true,
  "mode": "send",
  "message": "Webhook delivered successfully",
  "validation": { "ok": true, "errors": [], "warnings": [] },
  "request": { "url": "https://deinkunde.com/webhook", "method": "POST", "timeoutSeconds": 15, "headers": {}, "bodyPreview": "...", "bodySize": 256 },
  "response": { "reachable": true, "ok": true, "statusCode": 200, "statusText": "OK", "durationMs": 150, "headers": {}, "bodyPreview": null, "bodySize": null }
}
```

HTTP-429-Antworten werden als „erreichbar, aber rate-limitiert" behandelt (success: true).

## Häufige Fehler

- `401 Unauthorized` wenn du nicht authentifiziert bist
- `400 Bad Request` wenn die Config für den angegebenen Typ ungültig ist

