WP Webhooks / Docs / fswa_glue_post_dispatch
Action Pro since v1.7.0

fswa_glue_post_dispatch

Fires after a successful (2xx) delivery with the full response and both pre/post-mapping payloads.

$

/ Signature

do_action( 'fswa_glue_post_dispatch', $webhook_id, $trigger, $response_code, $response_body, $payload, $webhook, $original_payload )

/ When it fires

Fires only on 2xx responses, after `fswa_webhook_response`. Pro's post-dispatch snippets run at priority 10. Webhook chain dispatch runs at priority 20 — custom hooks at priority < 20 run before chained webhooks fire.

/ Parameters

NameInTypeReqDescription
$webhook_idparamintyesWebhook configuration ID.
$triggerparamstringyesWordPress action name.
$response_codeparamintyesHTTP response status code (always 2xx here).
$response_bodyparamstringyesRaw HTTP response body.
$payloadparamarrayyesThe mapped payload that was sent (post-mapping, post-Code Glue).
$webhookparamarrayyesFull webhook configuration row.
$original_payloadparamarray|nullPre-mapping payload, or `null` if no mapping was applied.

/ Examples

Write a returned external ID back to WordPress meta

add_action( 'fswa_glue_post_dispatch', function ( $webhook_id, $trigger, $code, $body, $payload, $webhook, $original ) {
    if ( $webhook_id !== 42 ) return;
    $data = json_decode( $body, true );
    if ( ! isset( $data['id'] ) ) return;
    $post_id = $original['order_id'] ?? $payload['order_id'] ?? 0;
    if ( $post_id ) {
        update_post_meta( (int) $post_id, '_external_id', sanitize_text_field( $data['id'] ) );
    }
}, 10, 7 );

/ Related

Ready

Stop losing webhooks.
Start logging them.

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