WP Webhooks / Docs / Dynamic URLs via Filter
Feature since v1.0.0

Dynamic URLs via Filter

Rewrite the webhook endpoint URL per-event from PHP using the `fswa_webhook_url` filter.

$

The `fswa_webhook_url` filter receives the configured URL, the outgoing payload, the webhook configuration, the trigger name, and the original pre-mapping payload. Return a modified URL to route different events to different endpoints — useful for REST APIs that embed object IDs in the path.

/ Examples

Route to a specific HubSpot deal by ID

add_filter( 'fswa_webhook_url', function ( $url, $payload, $webhook, $trigger, $original ) {
    if ( (int) $webhook['id'] === 30 ) {
        $deal_id = $payload['_hs_deal_id'] ?? '';
        return "https://api.hubapi.com/crm/v3/objects/deals/{$deal_id}";
    }
    return $url;
}, 10, 5 );

/ Related

Ready

Stop losing webhooks.
Start logging them.

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