mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Count invalid keys, tokens, and deleted webhooks in a new failure_count column on each notification settings table, like servers.unreachable_count. After 3 failures in a row the channel is disabled and the team is told by instance email and its other channels. Rate limits and server errors are retried and not counted; test notifications never count.
25 lines
706 B
PHP
25 lines
706 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Channels;
|
|
|
|
use App\Jobs\SendMessageToSlackJob;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class SlackChannel
|
|
{
|
|
/**
|
|
* Send the given notification.
|
|
*/
|
|
public function send(SendsSlack $notifiable, Notification $notification): void
|
|
{
|
|
$message = $notification->toSlack();
|
|
$slackSettings = $notifiable->slackNotificationSettings;
|
|
|
|
if (! $slackSettings || ! $slackSettings->isEnabled() || ! $slackSettings->slack_webhook_url) {
|
|
return;
|
|
}
|
|
|
|
SendMessageToSlackJob::dispatch($message, $slackSettings->slack_webhook_url, data_get($notification, 'isTestNotification', false) ? null : $slackSettings);
|
|
}
|
|
}
|