Webhooks
The platform delivers dispatch jobs, subscription events and scheduled-job firings to your application as signed HTTP POSTs. The SDK verifies the signature before your code runs. The headers, signing string and test vectors are in Webhook signatures; the receiving pattern is in Receive webhooks.
The signature is HMAC-SHA256, hex-encoded, over the X-FlowCatalyst-Timestamp header value
immediately followed by the raw request body. The key is the signing secret of the service account
the delivery is signed with.
Configuration
Section titled “Configuration”| Config key | Env var | Meaning |
|---|---|---|
flowcatalyst.signing_secret |
FLOWCATALYST_SIGNING_SECRET |
The signing secret. If it is unset, validation fails with a 500 that says so. |
flowcatalyst.webhook_auth_token |
FLOWCATALYST_WEBHOOK_AUTH_TOKEN |
Optional. The service account’s webhook auth token. When set, deliveries must also carry it as a bearer token. |
Middleware
Section titled “Middleware”Two aliases name the same middleware:
Route::post('/webhooks/flowcatalyst', [WebhookController::class, 'handle']) ->middleware('flowcatalyst.webhook'); // or 'fc-signature'The signature covers the raw body bytes, so keep the route out of any middleware that rewrites the
body. On failure the middleware answers JSON {"error": "<message>"} with the exception’s status
(401, or 500 for a missing secret).
| Failure | Status |
|---|---|
Missing X-FlowCatalyst-Signature |
401 |
Missing X-FlowCatalyst-Timestamp |
401 |
| Timestamp neither ISO 8601 nor Unix seconds | 401 |
| Timestamp older than the tolerance (300 s) | 401 |
| Timestamp more than 60 s in the future | 401 |
| Signature mismatch (constant-time compare) | 401 |
| Signing secret not configured | 500 |
Bearer gate on and header missing, not Bearer, or wrong |
401 |
The SDK also mounts the scheduled-job process endpoint behind this middleware, so a firing without a valid signature is rejected. See Scheduled jobs.
The bearer gate
Section titled “The bearer gate”Platform deliveries also carry Authorization: Bearer <token>. With webhook_auth_token set, the
middleware requires both the signature and the bearer. It never accepts the bearer instead of the
signature: a static token binds no payload and can be replayed once seen.
Validating by hand
Section titled “Validating by hand”use FlowCatalyst\Exceptions\WebhookValidationException;use FlowCatalyst\Webhook\WebhookValidator;
public function handle(Request $request){ try { WebhookValidator::fromConfig()->validateRequest($request); // tolerance defaults to 300 s } catch (WebhookValidationException $e) { return response()->json(['error' => 'Invalid signature'], 401); }
$payload = $request->json()->all(); return response()->json(['received' => true]);}validate(string $payload, string $signature, string $timestamp, int $tolerance = 300) takes the raw
parts. new WebhookValidator($secret) skips the config lookup. Both return true or throw
WebhookValidationException. The timestamp the router sends is ISO 8601 with milliseconds (for
example 2026-05-24T08:30:00.123Z); a bare Unix-seconds integer is also accepted. The HMAC always
uses the header string exactly as received.
Debugging a mismatch
Section titled “Debugging a mismatch”The platform’s dispatch-job panel has a “Sign” action that builds a delivery without sending it and shows the timestamp, the signature and the body it signed. Save the body to a file byte for byte and check it against this app’s secret:
php artisan flowcatalyst:verify-signature \ --timestamp='2026-09-22T15:16:54.010Z' \ --signature='9f3a…' \ --body-file=body.json--body-file=- reads stdin; --tolerance sets the replay window (default 300). The command prints a
fingerprint of the secret in use, the body size and hash, and the expected signature, then reports
MATCH or not. A mismatch with a well-formed timestamp means the two sides hold different secrets. A
single re-indented space in the body changes the HMAC, so never retype it.
Testing
Section titled “Testing”Sign test requests the way the platform does:
$timestamp = gmdate('Y-m-d\TH:i:s.000\Z');$body = json_encode(['orderId' => 'ORD-1']);$signature = hash_hmac('sha256', $timestamp . $body, config('flowcatalyst.signing_secret'));
$this->call('POST', '/webhooks/flowcatalyst', [], [], [], [ 'HTTP_X_FLOWCATALYST_SIGNATURE' => $signature, 'HTTP_X_FLOWCATALYST_TIMESTAMP' => $timestamp, 'CONTENT_TYPE' => 'application/json',], $body)->assertOk();The SDK’s own tests (WebhookValidatorCompatTest) pin this exact shape against the platform’s
signer.