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.

OperatorTrue when
equals / does not equalThe field, as text, is exactly the value
contains / does not containThe value appears somewhere in the field
starts with / ends withThe field begins or ends with the value
exists / does not existThe field is present and not empty
is greater than / is less thanBoth 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, 42 and "42" all compare as you would expect, but Failed does not equal failed. Add | lower to the field when the sender is inconsistent.
  • No conditions means always.

Ten patterns worth copying

You wantFieldOperatorValue
Only one event typebody.typeequalsinvoice.payment_failed
A family of eventsbody.typestarts withcustomer.subscription.
Only live modebody.livemodeequalstrue
Only above an amountbody.data.object.amountis greater than10000
Only the main branchbody.refequalsrefs/heads/main
Only failuresbody.workflow_run.conclusionequalsfailure
Not from botsbody.sender.typedoes not equalBot
Only a company's addressesbody.email | lowerends with@example.com
Only when a field is presentbody.customer.emailexists
Only orders with several itemsbody.line_items | lengthis greater than3

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.

FieldExample use
headers.x-github-eventGitHub puts the event name in a header, not the body
headers.x-shopify-topicThe same for Shopify: orders/create, orders/cancelled
request.pathRegister …/your-id/stripe and …/your-id/github, then route by path
query.envAdd ?env=staging to the URL you give a staging system
request.methodIgnore the GET a provider sends to check the URL exists
provider, eventThe 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.type equals charge.dispute.created
  • Automation B: body.type equals invoice.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:

FieldOperatorValue
body.tagscontainswholesale
body.labelscontains"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

  1. 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.
  2. Then select one that should not match and confirm it is left alone.
  3. 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.