WP Webhooks / Docs / fswa_export_doc
Filter since v2.4.0

fswa_export_doc

Attach top-level blocks to a Build export document before it is serialized.

$

/ Signature

apply_filters( 'fswa_export_doc', $doc, $webhook_ids, $chain_ids, $options )

/ When it fires

Fires once per export, after webhooks, chains, and credentials are collected and just before the JSON is returned. Pro uses it to bolt on an ai_build provenance block (the Build-with-AI transcript) when the exported objects trace back to an AI conversation and the user opted in. Anything you attach here is still subject to the two passes that run last: site-address anonymization, and personal-data redaction of captured values.

/ Parameters

NameInTypeReqDescription
$docparamarrayyesThe full export document (schema version, credentials, webhooks, chains).
$webhook_idsparamint[]yesWebhook IDs included in this export.
$chain_idsparamint[]yesChain IDs included in this export.
$optionsparamarrayThe caller's intent — `conversation_id`, `include_ai_transcript`, `anonymize_site_url`, `keep_captured_values`. Added in 2.5.0; three-argument callbacks keep working.

/ Returns

array The export document, optionally with extra top-level blocks added.

/ Examples

Stamp exports with the source site URL

add_filter( 'fswa_export_doc', function ( $doc, $webhook_ids, $chain_ids, $options = array() ) {
    // Skip the stamp when the user asked for an anonymized build.
    if ( empty( $options['anonymize_site_url'] ) ) {
        $doc['exported_from'] = home_url();
    }

    return $doc;
}, 10, 4 );

/ Related

Ready

Your next automation is
one sentence away.

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