PushizoDocs
Analytics & data

Event Streams: webhook body template and event filter

Event Streams lets you transform the body of outgoing webhooks (docs/webhooks.md) into the format the receiver expects and receive only the events you care about (ADR-0030). In the dashboard: Developer → Webhooks → endpoint…

Event Streams lets you transform the body of outgoing webhooks (docs/webhooks.md) into the format the receiver expects and receive only the events you care about (docs/adr/0030-event-streams-ve-veri-ambari.md). Configure it in the dashboard under Developer → Webhooks → endpoint form → Event Streams, or through the API with the body_template, body_content_type and filters fields.

Body template (Liquid)

If the template is empty, the standard body is sent. In the template, the event is available as event:

FieldExample
event.idwhe_01J… (for deduplication on the receiver side)
event.typedelivery.clicked
event.created_at2026-10-15T09:30:00.000Z
event.app_idapp_01J…
event.dataData specific to the event type (see the webhook event catalog)

application/json (default): variable output is automatically escaped as JSON string content, so it is safe to use inside quotes. To embed an object as-is, use the json and raw filters together. The output must be valid JSON.

{
  "text": "{{ event.type }} — campaign {{ event.data.campaign_id }}",
  "user": "{{ event.data.user.external_id }}",
  "event": {{ event | json | raw }}
}

text/plain: no escaping is applied; the output is sent as-is (Content-Type: text/plain; charset=utf-8).

{{ event.type }} {{ event.data.delivery_id }} {{ event.created_at }}

Rules:

  • Templates can be at most 64 KB and rendered output at most 1 MB. The include/render/layout tags and unknown filters are not allowed; render time and memory are limited.
  • In batch mode (high-volume delivery.* events), the template is rendered separately for each event: for the JSON type the results are sent as an array ([…, …]), for the text type as lines.
  • The signature (Pushizo-Signature) is calculated over the body that is sent; verification does not change.
  • A template error (render error, invalid JSON, oversized output) is recorded as a permanent failure at delivery time without sending the request (with an explicit error message such as template_invalid_json: …, visible in the delivery history). You can fix the template and deliver again with Resend. A template with a syntax error is rejected when you save it.

Event filter

If there is no filter, all subscribed events are sent. Conditions are combined with all (every one) or any (any one); up to 20 conditions.

FieldDescription
event_typeEvent type
app_idApp ID
campaign_idCampaign (data.campaign_id, data.message.campaign_id or data.campaign.id)
message_idMessage (data.message_id or data.message.id)
channelChannel (data.channel or data.subscription.channel)
event_nameCustom event name (event.received, conversion.created)
journey_idJourney
user_external_idThe user's external_id
data.<path>Any field in the body (up to 5 segments), e.g. data.event.properties.plan

Operators: eq, neq, in, not_in (list of values), starts_with, contains (substring in text, element in an array), exists, not_exists. Comparisons are made as text (120 equals "120").

{
  "match": "all",
  "conditions": [
    { "field": "campaign_id", "op": "eq", "value": "cmp_01JABC…" },
    { "field": "channel", "op": "in", "value": ["ios_push", "android_push"] }
  ]
}

The filter is applied when the event is produced: no delivery record is created for events that do not match. If you change the filter later, pending deliveries that no longer match are closed with the filtered_out error. For event.received, the existing event name filter (event_filters.event_names) remains required and is applied together with the Event Streams filter.

Preview

See the result before saving; no request is sent:

curl -X POST "$API/v1/apps/$APP_ID/webhooks/preview" -H "Authorization: Bearer $HS_KEY" -H 'content-type: application/json' -d '{
  "event_type": "delivery.clicked",
  "data": { "campaign_id": "cmp_01JABC…", "channel": "ios_push" },
  "body_template": "{\"text\": \"{{ event.type }}\"}",
  "filters": { "match": "all", "conditions": [{ "field": "campaign_id", "op": "eq", "value": "cmp_01JABC…" }] }
}'

Response: matched (whether it passes the filter), failed_conditions, body (rendered output), content_type and, if there is an error, error.code (render_error, invalid_json, body_too_large). If data is not provided, the sample data for the event type is used.

On this page