Technique
Webhook Filtering: Send On Only the Events That Matter
Providers let you choose which kinds of event to send. Almost none let you say which ones: only failures, only production, only above a certain amount. That second filter is the difference between a channel people read and a channel people mute.
17 November 2026 · 4 min read
Two levels of filtering
At the provider you pick event types: invoice.paid, push, orders/create. Always do this first. It reduces what is sent at all.
In between you filter on what the event contains. This is what a provider's settings page rarely offers, and it is what an automation's conditions are for.
How a condition works
A condition is a field, an operator and a value. The field is a path into the request, written the same way as in a template but without the braces.
| Operator | True when |
|---|---|
| equals / does not equal | The field, as text, is exactly the value |
| contains / does not contain | The value appears somewhere in the field |
| starts with / ends with | The field begins or ends with the value |
| exists / does not exist | The field is present and not empty |
| is greater than / is less than | Both sides are compared as numbers |
Three rules cover nearly every surprise:
- All conditions must hold. Conditions in one automation are joined with AND.
- Comparisons are on text, and case matters.
true,42and"42"all compare as you would expect, butFaileddoes not equalfailed. Add| lowerto the field when the sender is inconsistent. - No conditions means always.
Ten patterns worth copying
| You want | Field | Operator | Value |
|---|---|---|---|
| Only one event type | body.type | equals | invoice.payment_failed |
| A family of events | body.type | starts with | customer.subscription. |
| Only live mode | body.livemode | equals | true |
| Only above an amount | body.data.object.amount | is greater than | 10000 |
| Only the main branch | body.ref | equals | refs/heads/main |
| Only failures | body.workflow_run.conclusion | equals | failure |
| Not from bots | body.sender.type | does not equal | Bot |
| Only a company's addresses | body.email | lower | ends with | @example.com |
| Only when a field is present | body.customer.email | exists | |
| Only orders with several items | body.line_items | length | is greater than | 3 |
The last three show that a field can carry filters, exactly as in a template. length, lower and trim are the useful ones here.
Filtering on things outside the body
The body is not the only thing a request has.
| Field | Example use |
|---|---|
headers.x-github-event | GitHub puts the event name in a header, not the body |
headers.x-shopify-topic | The same for Shopify: orders/create, orders/cancelled |
request.path | Register …/your-id/stripe and …/your-id/github, then route by path |
query.env | Add ?env=staging to the URL you give a staging system |
request.method | Ignore the GET a provider sends to check the URL exists |
provider, event | The sender and event name as webhook.stream recognised them |
Path and query filters are worth knowing about because they let one webhook URL serve several senders, each routed to its own destination.
OR, and if/else
Conditions inside one automation are AND. For OR, use two automations with the same destination and template:
- Automation A:
body.typeequalscharge.dispute.created - Automation B:
body.typeequalsinvoice.payment_failed
The same trick gives you if/else. One automation with body.amount is greater than 50000 posts to the sales channel; another with body.amount is less than 50001 posts a quieter message elsewhere.
When the alternatives share a prefix or a substring, one condition will do: starts with invoice. covers every invoice event.
Lists and nested objects
A field that is an array or an object is compared as its JSON text. That makes contains a workable membership test:
| Field | Operator | Value |
|---|---|---|
body.tags | contains | wholesale |
body.labels | contains | "name":"bug" |
It is a substring match, so wholesale also matches a tag called wholesale-eu. Where that matters, include the surrounding quotation marks in the value.
Check a filter before you trust it
- Select a captured request that should match. The automation editor evaluates your conditions against the request you are viewing and says Matches or Does not match.
- Then select one that should not match and confirm it is left alone.
- After saving, watch the Deliveries tab on the next few real requests. A request with no delivery listed was filtered out; one with a delivery shows which automation fired.
Every request is captured whether or not a rule matched it. That is the practical advantage of filtering here and not in code: when someone asks "why did we not hear about that one?", the request is there to look at, and you can see which condition turned it away.
Limits
An automation can have up to ten conditions. A free URL can have 3 automations and a URL with a Pro pass can have 10. There are no regular expressions and no nesting, by design: a rule you can read at a glance is a rule someone else can maintain.
Filter against real traffic
Create a URL, let a handful of real events arrive, and write the conditions with those requests in front of you.
Keep reading
Transform a webhook payload
Reshape webhook JSON into the payload another API expects using a template: pick fields, keep types, set defaults and format values, with a live preview against a real request.
ReadStripe webhooks to Slack
Post Stripe failed payments, new disputes and large checkouts to a Slack channel in plain language, with filters and message templates. No app to install and no code to host.
Read