Manage webhooks from the panel
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

Create one and see its secret once, send a test, change the secret, and read
each delivery with what the other end answered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 11:44:11 +02:00
parent d80ed1a3e8
commit d4cf4a66b7
14 changed files with 797 additions and 26 deletions

View File

@@ -9,6 +9,7 @@ use App\Models\Application;
use App\Models\ReviewComment;
use App\Models\Revision;
use App\Models\Webhook;
use App\Models\WebhookDelivery;
use App\Support\AdminContent;
use App\Support\ContentTypes;
use App\Support\SiteUrls;
@@ -43,6 +44,38 @@ final class Webhooks
}
}
/**
* A `ping`, to check the receiving end before anything real happens.
*/
public static function ping(Webhook $webhook): WebhookDelivery
{
$delivery = $webhook->deliveries()->create([
'uuid' => (string) Str::uuid(),
'event' => 'ping',
'payload' => ['webhook' => $webhook->id, 'events' => $webhook->events],
]);
DeliverWebhook::dispatch($delivery);
return $delivery->refresh();
}
/**
* One sent again, as a new delivery of the same event and payload.
*/
public static function redeliver(WebhookDelivery $delivery): WebhookDelivery
{
$again = $delivery->webhook->deliveries()->create([
'uuid' => (string) Str::uuid(),
'event' => $delivery->event,
'payload' => $delivery->payload,
]);
DeliverWebhook::dispatch($again);
return $again->refresh();
}
public static function applicationReceived(Application $application): void
{
self::dispatch('application.received', [