They are declarative pattern-matching rules, modeled after AWS EventBridge patterns.
status == "ACCEPTED"
, and it would also match if status == "REJECTED"
.
name: ["John"]
: Triggers the job if the name field in the event payload is exactly “John”.name: [{ $startsWith: "Jo" }]
: Triggers the job if the name field starts with “Jo”.name: [{ $endsWith: "hn" }]
: Triggers the job if the name field ends with “hn”.name: [{ $ignoreCaseEquals: "john" }]
: Triggers the job if the name field is equal to “john” regardless of case.paidPlan: [true]
: Triggers the job if the PaidPlan
field in the event payload is true
.isAdmin: [false]
: Triggers the job if the isAdmin
field in the event payload is false
.age [18]
: Triggers the job if the age
field in the event payload is equal to 18
.score: [{ $gt: 90 }]
: Triggers the job if the score field is greater than 90
.score: [{ $gte: 90 }]
: Triggers the job if the score field is greater than or equal to 90
.score: [{ $lt: 90 }]
: Triggers the job if the score field is less than 90
.score: [{ $lte: 90 }]
: Triggers the job if the score field is less than or equal to 90
.age: [{ $gt: 20 }, { $lt: 40 }]
: Triggers the job if the age
field is greater than 20 and less than 40.score: [{ $between: [90, 110] }]
: Triggers the job if the score
field is between 90 and 110.hobbies: [{ $includes: "reading" }]
: Triggers the job if the hobbies array includes the value “reading”.name: [{ $exists: true }]
: Triggers the job if the name
field exists in the event payload.foo: [{ $exists: false }]
: Triggers the job if the foo field does not exist in the event payload.name: ["Alice"], age: [30]
: Triggers the job if the name is “Alice” and the age is 30.name: ["Alice"], age: [{ $gt: 20 }, { $lt: 40 }]
: Triggers the job if the name is “Alice” and the age is between 20 and 40.name: ["Alice", "Bob"]
: Triggers the job if the name is either “Alice” or “Bob”.name: ["Alice", "Bob"], age: [30]
: Triggers the job if the name is either “Alice” or “Bob” and the age is 30.onCustomerSubscriptionCreated
event from Stripe. It is configured to trigger only when certain conditions are met. In this case, the job is triggered when a subscription is created with the following condition: