CarlEOgden
1 month ago
145
1
Laravel

Laravel / Spatie / Mailgon webhooks - invalid signature

Posted 1 month ago by CarlEOgden

Hi

Got a puzzling one, we installed laravel-spatie-webhook-client on our Laravel 7 server and have entered out api key in webhook-config.php

'signing_secret' => 'our number in here',

Once we get it working, we'll store this in the .env file and call it as it should be called.

I've managed to create App\Handle\ProcessWebhook.php

<?php
namespace App\Handler;

use \Spatie\WebhookClient\ProcessWebhookJob;

//The class extends "ProcessWebhookJob" class as that is the class //that will handle the job of processing our webhook before we have //access to it.
class ProcessWebhook extends ProcessWebhookJob
{
	public function handle(){
		$data = json_decode($this->webhookCall, true);
		//Do something with the event
		var_dump($data);
		http_response_code(200); //Acknowledge you received the response
	}
}

But everytime I test it from the Mailgun webhooks page to the url I get an exception:

** Message ** The signature is invalid.

** File ** WebhookFailed.php

** Line ** 11

** Request URI ** /webhook-receiving-url

Any idea what I've done wrong?

Cheers Carl.

Please sign in or create an account to participate in this conversation.