WP Webhooks / Docs / Post-Dispatch Scripting
Feature Pro since v1.7.0

Post-Dispatch Scripting

Run PHP code after a successful delivery to process the response and write data back to WordPress.

$

Attach a post-dispatch snippet to a webhook+trigger. It fires via fswa_glue_post_dispatch after a 2xx response. Use it to parse the response, persist returned IDs to post meta, or trigger follow-up logic.

Available variables

$payload — the payload that was sent. $originalPayload — the pre-mapping payload. $responseCode — the HTTP status code. $responseBody — the raw response body.

Shorthand syntax

Curly-brace placeholders resolve to array access for any variable: {{ $originalPayload.args.0.id }}$originalPayload['args'][0]['id'].

Return value

The return value is ignored — use the snippet for side effects: update_post_meta(), wp_mail(), error_log(), etc. To act on the response with another request, chain a webhook after this one with Webhook Chains instead of calling an API here.

/ Examples

Store a HubSpot deal ID returned in the response

// Available: $payload (sent), $originalPayload (pre-mapping), $responseCode, $responseBody
$data = json_decode( $responseBody, true );
if ( isset( $data['id'], $payload['order_id'] ) ) {
    update_post_meta( $payload['order_id'], '_hs_deal_id', $data['id'] );
}

/ Related

Ready

Your next automation is
one sentence away.

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