WP Webhooks / Docs / fswa_notification_inline_send
Filter since v3.3.0

fswa_notification_inline_send

Decide whether a delivery's notifications are sent at the end of the same request or left for cron. On by default for synchronous webhooks, off for queued ones.

$

/ Signature

apply_filters( 'fswa_notification_inline_send', $inline, $ctx )

/ When it fires

Right after a rule has queued at least one notification for a delivery. A queued delivery already runs under cron, so its notifications go out on the next tick; a synchronous delivery ran inline with no cron involved, and without this its alerts would wait for a cron that may never run (DISABLE_WP_CRON on a site that only uses synchronous webhooks). The inline flush happens after the response is produced, and the cron event stays booked as a fallback either way.

/ Parameters

NameInTypeReqDescription
$inlineparamboolyesThe default: `true` when the webhook that produced the event is synchronous, `false` when it was queued.
$ctxparamarrayyesThe delivery context handed to `fswa_delivery_event`: `event`, `webhook` (with `is_synchronous`), `trigger`, `attempt`, `http_code`, `error_message`, `payload`, …

/ Returns

bool `true` to flush on `shutdown` of the current request, `false` to book the one-shot cron event and spawn WP-Cron.

/ Examples

Keep synchronous webhooks fast: always leave sends to cron

add_filter( 'fswa_notification_inline_send', '__return_false' );

Send permanently-failed alerts inline even for queued deliveries

add_filter( 'fswa_notification_inline_send', function ( bool $inline, array $ctx ) {
    return $ctx['event'] === 'permanently_failed' ? true : $inline;
}, 10, 2 );

/ Related

Ready

Your next automation is
one sentence away.

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