From 413dee5d8c97edefd4b359831d6db766b1235c9c Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:59:17 +0200 Subject: [PATCH] feat: implement actual webhook delivery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement full webhook delivery functionality: - Create SendWebhookJob to handle HTTP POST requests - Update WebhookChannel to dispatch webhook jobs - Configure retry logic (5 attempts, 10s backoff) - Update Test notification payload with success/message structure Webhook payload structure: { "success": true/false, "message": "notification message", "event": "event_type", "url": "coolify_dashboard_url" } 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Jobs/SendWebhookJob.php | 45 +++++++++++++++++++ app/Notifications/Channels/WebhookChannel.php | 14 ++---- app/Notifications/Test.php | 3 +- 3 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 app/Jobs/SendWebhookJob.php diff --git a/app/Jobs/SendWebhookJob.php b/app/Jobs/SendWebhookJob.php new file mode 100644 index 000000000..865dd9493 --- /dev/null +++ b/app/Jobs/SendWebhookJob.php @@ -0,0 +1,45 @@ +onQueue('high'); + } + + /** + * Execute the job. + */ + public function handle(): void + { + Http::post($this->webhookUrl, $this->payload); + } +} diff --git a/app/Notifications/Channels/WebhookChannel.php b/app/Notifications/Channels/WebhookChannel.php index 53524e4f5..757e5e934 100644 --- a/app/Notifications/Channels/WebhookChannel.php +++ b/app/Notifications/Channels/WebhookChannel.php @@ -2,8 +2,8 @@ namespace App\Notifications\Channels; +use App\Jobs\SendWebhookJob; use Illuminate\Notifications\Notification; -use Illuminate\Support\Facades\Log; class WebhookChannel { @@ -18,16 +18,8 @@ public function send(SendsWebhook $notifiable, Notification $notification): void return; } - // TODO: Implement actual webhook delivery - // This is a placeholder implementation - // You'll need to: - // 1. Get the webhook payload from $notification->toWebhook() - // 2. Create a job to send the HTTP POST request to $webhookSettings->webhook_url - // 3. Handle retries and errors appropriately + $payload = $notification->toWebhook(); - Log::info('Webhook notification would be sent', [ - 'url' => $webhookSettings->webhook_url, - 'notification' => get_class($notification), - ]); + SendWebhookJob::dispatch($payload, $webhookSettings->webhook_url); } } diff --git a/app/Notifications/Test.php b/app/Notifications/Test.php index 5a635a601..60bc8a0ee 100644 --- a/app/Notifications/Test.php +++ b/app/Notifications/Test.php @@ -116,8 +116,9 @@ public function toSlack(): SlackMessage public function toWebhook(): array { return [ - 'event' => 'test', + 'success' => true, 'message' => 'This is a test webhook notification from Coolify.', + 'event' => 'test', 'url' => base_url(), ]; }