Why Filter Webhooks?
Services like Stripe or GitHub can send dozens of events per second, but your billing microservice might only care about invoice.payment_succeeded and customer.subscription.deleted.
Filtering at the gateway level keeps downstream application logs clean and avoids wasteful database load.
Filter Syntax
Bunnylynk filters support JSONPath comparisons, regex matching, and boolean combinations (AND, OR, NOT).
Example 1: Match Specific Event Types
{
"filter": {
"body.type": {
"$in": ["payment_intent.succeeded", "charge.refunded"]
}
}
}
Example 2: Numeric & Boolean Conditions
Filter Stripe events with amount greater than $100:
{
"filter": {
"$and": [
{ "body.type": "payment_intent.succeeded" },
{ "body.data.object.amount": { "$gt": 10000 } }
]
}
}
Example 3: Header Matching
Filter based on custom sender headers:
{
"filter": {
"headers.x-environment": { "$eq": "production" }
}
}
Available Operators
| Operator | Meaning | Example |
|---|---|---|
$eq | Equal to | { "body.status": { "$eq": "active" } } |
$ne | Not equal to | { "body.status": { "$ne": "pending" } } |
$in | In array | { "body.event": { "$in": ["created", "updated"] } } |
$gt, $gte | Greater than (or equal) | { "body.total": { "$gte": 50 } } |
$lt, $lte | Less than (or equal) | { "body.retries": { "$lt": 3 } } |
$regex | Regular expression | { "body.email": { "$regex": ".*@company\\.com$" } } |
Next: Learn about Payload Transformations.