Add generic webhook notification channel

Introduces a new 'Webhook (Custom)' notification channel allowing users to send JSON payloads to any HTTP endpoint (e.g., n8n, Zapier, custom APIs). Updates the UI to support webhook configuration, adds backend validation, and implements the WebhookChannel for sending notifications. Documentation is updated with usage instructions and payload examples.
This commit is contained in:
Hosteroid
2025-10-17 11:13:25 +03:00
parent 6e8fef9b79
commit 2b783b7470
6 changed files with 219 additions and 82 deletions

View File

@@ -214,6 +214,7 @@ class NotificationGroupController extends Controller
break;
case 'discord':
case 'slack':
case 'webhook':
$missingField = 'webhook URL';
break;
}
@@ -427,6 +428,17 @@ class NotificationGroupController extends Controller
}
return ['webhook_url' => $webhookUrl];
case 'webhook':
$webhookUrl = trim($data['webhook_url'] ?? '');
if (empty($webhookUrl) || !filter_var($webhookUrl, FILTER_VALIDATE_URL)) {
return null;
}
// Optional: Allow any HTTPS URL; prefer HTTPS for security
if (!str_starts_with($webhookUrl, 'https://') && !str_starts_with($webhookUrl, 'http://')) {
return null;
}
return ['webhook_url' => $webhookUrl];
default:
return null;
}