WP Webhooks / Docs / fswa_headers
Filter since v1.0.0

fswa_headers

Filters the HTTP headers sent with each webhook request.

$

/ Signature

apply_filters( 'fswa_headers', $headers, $webhook, $trigger )

/ When it fires

Fires after custom headers configured in the admin panel are merged in, just before the HTTP request args are built.

/ Parameters

NameInTypeReqDescription
$headersparamarrayyesHeaders array. Always includes `Content-Type`, `X-Event-Id`, `X-Event-Timestamp`, `X-Webhook-Id`.
$webhookparamarrayyesFull webhook configuration row.
$triggerparamstringyesWordPress action name.

/ Returns

array Modified headers array (key → value string pairs).

/ Examples

Add an HMAC signature header

add_filter( 'fswa_headers', function ( $headers, $webhook, $trigger ) {
    $secret  = get_option( 'my_webhook_secret' );
    $payload = $headers['X-Event-Id'] ?? '';
    $headers['X-Signature'] = 'sha256=' . hash_hmac( 'sha256', $payload, $secret );
    return $headers;
}, 10, 3 );

/ Related

Ready

Stop losing webhooks.
Start logging them.

$ wp plugin install flowsystems-webhook-actions --activate