---
title: "fswa_webhook_payload — Filter Hook"
description: "Filters the per-webhook outgoing payload after field mapping, immediately before HTTP dispatch."
url: "https://wpwebhooks.org/docs/fswa-webhook-payload/"
---

[WP Webhooks](https://wpwebhooks.org/) / [Docs](https://wpwebhooks.org/docs/) / fswa\_webhook\_payload

Filter since v1.0.0

# fswa\_webhook\_payload

Filters the per-webhook outgoing payload after field mapping, immediately before HTTP dispatch.

/ Signature

```
apply_filters( 'fswa_webhook_payload', $payload, $webhook_id, $trigger, $original_payload )
```

/ When it fires

Fires once per webhook delivery, after field mapping and type casting but before the HTTP request is sent. Also fires during synchronous dispatch and queue job execution.

/ Parameters

| Name | In | Type | Req | Description |
| --- | --- | --- | --- | --- |
| $payload | param | array | yes | The mapped payload about to be dispatched. |
| $webhook\_id | param | int | yes | Webhook configuration ID. |
| $trigger | param | string | yes | The WordPress action name. |
| $original\_payload | param | array|null | — | Pre-mapping payload, or \`null\` if no mapping was applied. |

/ Returns

`array` Modified payload. Must remain an array.

/ Examples

Inject site URL and current time into every delivery

```
add_filter( 'fswa_webhook_payload', function ( $payload, $webhook_id, $trigger, $original ) {
    $payload['_meta'] = [
        'site'      => home_url(),
        'sent_at'   => gmdate( 'c' ),
        'webhook'   => $webhook_id,
    ];
    return $payload;
}, 10, 4 );
```

Modify payload only for a specific webhook

```
add_filter( 'fswa_webhook_payload', function ( $payload, $webhook_id, $trigger, $original ) {
    if ( $webhook_id !== 42 ) return $payload;
    // Rename a field for this webhook only
    $payload['contact_email'] = $payload['billing_email'] ?? '';
    unset( $payload['billing_email'] );
    return $payload;
}, 10, 4 );
```

/ Related

[fswa\_payload](https://wpwebhooks.org/docs/fswa-payload/)[Payload Mapping](https://wpwebhooks.org/docs/payload-mapping/)[Code Glue](https://wpwebhooks.org/docs/code-glue/)

/Ready

## Your next automation is  
one sentence away.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [See the Plugin →](https://wpwebhooks.org/wordpress-webhook-plugin/)

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

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","name":"fswa_webhook_payload — Filter Hook — Webhook Actions Docs","description":"Filters the per-webhook outgoing payload after field mapping, immediately before HTTP dispatch.","url":"https://wpwebhooks.org/docs/fswa-webhook-payload/","isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"}}
```
