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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user