TheDocumentation Index
Fetch the complete documentation index at: https://docs.blnkfinance.com/llms.txt
Use this file to discover all available pages before exploring further.
when clause is used to describe a set of conditions that trigger a transaction in Watch.
Rules still evaluate transactions only. If you need extra context, include it in meta_data on the transaction first.
When setting conditions, you can only use the supported fields in the Watch transaction payload: transaction_id, amount, reference, source, destination, description, created_at, and meta_data.
Basic conditions
Basic conditions compare transaction fields to literal values. You can compare numeric fields (e.g.amount), string fields (e.g. currency, source, destination), and metadata (e.g. meta_data.kyc_tier).
For example, this is a simple rule flagging amounts greater than 10,000:
largeTransfer.ws
| Operator | Meaning | Example |
|---|---|---|
== | equal to | currency == "USD" |
!= | not equal to | source != destination |
> | greater than | amount > 4000 |
>= | greater than or equal to | amount >= 4000 |
< | less than | amount < 100 |
<= | less than or equal to | amount <= 100 |
in | value is in a list | meta_data.channel in ("card", "bank_transfer") |
regex | matches a regular expression | description regex "(?i)(gift.?card|crypto)" |
not_regex | does not match a regular expression | description not_regex "(?i)test" |
Combined conditions
To create conditions with two or more filters, Watch supports two logical operators:- and: Every condition must be true.
- or: At least one of the conditions must be true.
highValueTransfer.ws
or, one of two conditions can trigger the same risk action. For example, in a cross-border app you might treat amounts over 10,000 as high-risk regardless of currency; but if the transaction is in PKR, IRR, or SYP, you treat it as high-risk regardless of amount.
highRiskTransaction.ws
Recommended: If your or conditions start to get complex, you should consider using a separate rule for each condition. For example, a complex set of conditions like this …
highRiskTransaction2.ws
… is better written as three separate rules:
This makes your rule set easier to read, reason about, and change in your workflow.
Metadata reference
When setting conditions on information that is not part of the top-level parameters, such as source country, destination country, customer KYC tier, or promo code, pass the value inmeta_data.
You can then reference the value in your rule using dot notation. For example, here’s a rule that flags when a customer has used at least one of the supported promo codes:
promoCodeReuse.ws
Dynamic references
Dynamic references allow you to reuse values from the transaction being evaluated when defining a condition. This works with any field in the transaction payload, including values inmeta_data.
Use dynamic references when the value you want to compare depends on the transaction being evaluated, rather than a fixed value.
To reference a value from the current transaction, use:
sameSourceAndDestination.ws
mismatchedCountries.ws
Aggregate operators
Aggregate conditions evaluate groups of transactions over a defined time window rather than a single transaction. This makes it possible to detect patterns in activity. Here are some examples of aggregate conditions in practice:aggregatedefines the metric to compute, e.g.countorsum.when <filter>selects the transactions to include in the calculation.<window>defines how far back to look from the current transaction.
| Aggregate | Description |
|---|---|
count | Number of matching transactions in the window |
sum | Total of a numeric field (e.g. amount) over the window |
avg | Average value of a numeric field over the window |
max | Largest value of a numeric field in the window |
min | Smallest value of a numeric field in the window |
| Unit | Example | Meaning |
|---|---|---|
| Seconds | "PT30S" | 30 seconds |
| Minutes | "PT30M" | 30 minutes |
| Hours | "PT24H" | 24 hours |
| Days | "P7D" | 7 days |
Use
PT for time units (hours, minutes, seconds) and P for days. Weeks and months are not supported. Use days instead (for example "P7D" for one week or "P30D" for roughly a month).Time-based functions
Time-based functions let you write rules that depend on when a transaction occurs. For example, you might want to review large transactions late at night:lateNightLargeTransfer.ws
When transactions are injected through the API, this is typically the
created_at value.| Function | Description | Example |
|---|---|---|
hour_of_day(timestamp) | Hour of day (0-23) | hour_of_day(timestamp) >= 22 |
day_of_week(timestamp) | Weekday: 0 = Sunday, 6 = Saturday. With in, you can use day names | day_of_week(timestamp) in (0, 6) or day_of_week(timestamp) in ("Saturday", "Sunday") |
day_of_month(timestamp) | Day of month (1-31) | day_of_month(timestamp) == 17 |
day_of_year(timestamp) | Day of year (1-366) | day_of_year(timestamp) <= 31 |
month_of_year(timestamp) | Month (1-12) | month_of_year(timestamp) == 3 |
week_of_year(timestamp) | ISO week number (1-53) | week_of_year(timestamp) == 12 |
year(timestamp) | Year (e.g. 2026) | year(timestamp) == 2026 |
Also note: Time-based conditions support standard comparison operators:==,!=,>,>=,<,<=,in.
ForFor example, to flag high value transactions that occur on a weekend:day_of_week, when using theinoperator, you can use day names instead of numbers. Soday_of_week(timestamp) in ("Saturday", "Sunday")is equivalent today_of_week(timestamp) in (0, 6).
weekendHighValueTransactions.ws
“Previous transaction” function
previous_transaction checks if any transaction in a past time window matches specific criteria. It returns true if at least one matching transaction exists, otherwise false.
Use it to detect patterns like:
- This source had a failed transaction recently
- This destination already received a transaction in the last hour
-
within — How far back to look. Uses ISO 8601 duration strings, e.g.
"PT1H"(1 hour),"P1D"(1 day). -
match — A set of fields that must all match for a transaction to count. You can use literal values, e.g.
meta_data.status: "failed"or dynamic references,source: $current.source.
blockIfPreviousFailed.ws
burstToSameDestination.ws
Note:
- This is a boolean check, not a count. It only answers: “Did at least one matching transaction occur?”
- Uses the same transaction store and time window format as aggregate conditions.