Add Mattermost notification channel support

Introduces Mattermost as a new notification channel, including backend service integration, controller validation, UI form fields, and updates to channel type enums in the database schema and migrations. This enables users to configure and send notifications via Mattermost webhooks.
This commit is contained in:
Hosteroid
2025-10-21 14:33:22 +03:00
parent ec0b5c61ea
commit 774379f107
6 changed files with 182 additions and 8 deletions

View File

@@ -463,7 +463,9 @@ class NotificationGroupController extends Controller
'email' => 'Email',
'telegram' => 'Telegram',
'discord' => 'Discord',
'slack' => 'Slack'
'slack' => 'Slack',
'mattermost' => 'Mattermost',
'webhook' => 'Webhook'
];
$channelName = $channelNames[$channelType] ?? ucfirst($channelType);
@@ -532,6 +534,17 @@ class NotificationGroupController extends Controller
}
return ['webhook_url' => $webhookUrl];
case 'mattermost':
$webhookUrl = trim($data['mattermost_webhook_url'] ?? '');
if (empty($webhookUrl) || !filter_var($webhookUrl, FILTER_VALIDATE_URL)) {
return null;
}
// Validate Mattermost webhook URL format
if (!str_contains($webhookUrl, '/hooks/')) {
return null;
}
return ['webhook_url' => $webhookUrl];
case 'webhook':
$webhookUrl = trim($data['webhook_url'] ?? '');
if (empty($webhookUrl) || !filter_var($webhookUrl, FILTER_VALIDATE_URL)) {