spatie / laravel-webhook-client

Receive webhooks in Laravel apps
https://freek.dev/1383-sending-and-receiving-webhooks-in-laravel-apps
MIT License
1k stars 147 forks source link

Extend InvalidWebhookSignatureEvent with WebhookConfig parameter #214

Closed jansgescheit closed 5 months ago

jansgescheit commented 5 months ago

If the application connects several webhook clients, it is now easy to find out which webhook it is. This allows errors to be dealt with individually.

In our specific example, the external webhook service cannot correctly calculate the signature with a UTF8 payload, so that we can call the GET API of the external service in the event of an error.

e.g.

    public function handle(InvalidWebhookSignatureEvent $event): void
    {
        if ($event->config->processWebhookJobClass !== CustomWebhookJob::class) {
            return;
        }

        // do something specific 
    }
freekmurze commented 5 months ago

Thanks!

joelclermont commented 5 months ago

Love the change, but isn't this an API break? Thankfully my tests/static analysis caught it in my app, but was a bit of a surprise.