WP Webhooks / Docs / fswa_error
Action since v1.0.0

fswa_error

Fires after a webhook delivery fails — covers both HTTP error responses and transport errors.

$

/ Signature

do_action( 'fswa_error', $trigger, $url, $payload, $response, $attempt )

/ When it fires

Fires on every failed delivery attempt — 4xx, 5xx, and transport errors (connection refused, timeout, SSL). Fires before the retry decision is made.

/ Parameters

NameInTypeReqDescription
$triggerparamstringyesWordPress action name.
$urlparamstringyesEndpoint URL.
$payloadparamarrayyesThe payload that was sent.
$responseparamarray|WP_Erroryes`wp_remote_post()` response or a `WP_Error` for transport failures.
$attemptparamintCurrent attempt number (1-based).

/ Examples

Alert on permanently failed deliveries

add_action( 'fswa_error', function ( $trigger, $url, $payload, $response, $attempt ) {
    if ( is_wp_error( $response ) ) {
        $message = $response->get_error_message();
    } else {
        $code    = wp_remote_retrieve_response_code( $response );
        $message = "HTTP {$code}";
    }
    error_log( "[fswa] Failed attempt {$attempt}: {$trigger} → {$url} ({$message})" );
}, 10, 5 );

/ Related

Ready

Stop losing webhooks.
Start logging them.

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