We write rules using a modified version of SQRL, a SQL-like language that allows you to write rules in a declarative way. You can learn more about SQRL here.
entity(name: string, id: string, relation?: string) to define an entity. Entities are objects that we might want to label, count, or track in our events. For example, a user or a credit card.
Your event might have two of the same entity, but with different IDs. For example, a payment event might have two users: the buyer and the seller. In this case, you can use the
relation parameter to distinguish between the two entities.
addActionLabel(type: string, value: string) to add labels to events. We support special types:
$BLOCK: Indicates the event should be blocked.
$APPROVE: Marks the event as approved.
addLabel(entity: Entity, type: string, value: string) for entities within events. Special labels include:
$BLOCKLIST: Adds the entity to a blocklist.
$ALLOWLIST: Adds the entity to an allowlist.
You can use
get(key: string) and
set(key: string, value: string) to persist data across events. This can be useful for retrieving data from previous events.