WP Webhooks / Docs / fswa_notification_message
Filter since v3.3.0

fswa_notification_message

Change a rendered notification — subject, title, body, fields, link, severity — before any channel formats and sends it.

$

/ Signature

apply_filters( 'fswa_notification_message', $message, $rule, $ctx )

/ When it fires

Once per matching rule, after the template is rendered and before the message is stored for sending. Every channel on the rule receives the same filtered message, so it runs before any channel-specific formatting — add a fact, rewrite the subject, or drop the log link for a channel that cannot open the admin.

/ Parameters

NameInTypeReqDescription
$messageparamarrayyesThe rendered, channel-neutral message: `event`, `event_label`, `severity` (`success` | `info` | `warning` | `critical` | `neutral`), `subject`, `title`, `body`, `short` (the SMS one-liner), `fields[]` (`{label, value}` facts), `link` (`{label, url}` to the delivery log), plus `webhook_id`, `webhook_name`, `trigger`, `log_id`, `event_uuid`, `site_name`, `site_url`, `fired_at`.
$ruleparamarrayyesThe matching rule row (`id`, `name`, `event`, `webhook_id`, `filters`, `channel_ids`, `template`, `throttle_seconds`, `digest`). For a preview or a Send test without a saved rule it is `['template' => …]` or an empty array.
$ctxparamarrayyesThe delivery context, the same array `fswa_delivery_event` receives.

/ Returns

array The message to send. Text values are plain text — each channel driver escapes for its own target (HTML, mrkdwn, Markdown).

/ Examples

Add the store name to every critical alert and tag the on-call engineer

add_filter( 'fswa_notification_message', function ( array $message, array $rule, array $ctx ) {
    if ( $message['severity'] !== 'critical' ) return $message;
    $message['title']    = '[' . get_option( 'blogname' ) . '] ' . $message['title'];
    $message['fields'][] = [ 'label' => 'On-call', 'value' => '[email protected]' ];
    return $message;
}, 10, 3 );

/ Related

Ready

Your next automation is
one sentence away.

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