mirror of
https://github.com/coollabsio/coolify.git
synced 2025-12-28 13:41:51 +00:00
Added actual HTTP POST delivery for webhook notifications and comprehensive Ray debugging for development. Changes: - Updated Team model to implement SendsWebhook interface - Added routeNotificationForWebhook() method to Team - Enhanced SendWebhookJob with Ray logging for request/response - Added Ray debugging to WebhookChannel for dispatch tracking - Added Ray debugging to Webhook Livewire component 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class SendWebhookJob implements ShouldBeEncrypted, ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/**
|
|
* The number of times the job may be attempted.
|
|
*
|
|
* @var int
|
|
*/
|
|
public $tries = 5;
|
|
|
|
public $backoff = 10;
|
|
|
|
/**
|
|
* The maximum number of unhandled exceptions to allow before failing.
|
|
*/
|
|
public int $maxExceptions = 5;
|
|
|
|
public function __construct(
|
|
public array $payload,
|
|
public string $webhookUrl
|
|
) {
|
|
$this->onQueue('high');
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
if (isDev()) {
|
|
ray('Sending webhook notification', [
|
|
'url' => $this->webhookUrl,
|
|
'payload' => $this->payload,
|
|
]);
|
|
}
|
|
|
|
$response = Http::post($this->webhookUrl, $this->payload);
|
|
|
|
if (isDev()) {
|
|
ray('Webhook response', [
|
|
'status' => $response->status(),
|
|
'body' => $response->body(),
|
|
'successful' => $response->successful(),
|
|
]);
|
|
}
|
|
}
|
|
}
|