A rule consists of a JSON objects with these properties:
type- Type of ruledata- The data to operate onoperator- The operator to useoperand- The argument for the operator
This table describes the different rule types, data and operators:
| Rule type | Rule data | Rule operator |
|---|---|---|
| data | ^\d+$ | startswith |
| data | ^\d+$ | endswith |
| data | ^\d+$ | greaterequals |
| data | ^\d+$ | greater |
| data | ^\d+$ | less |
| data | ^\d+$ | lessequals |
| data | ^\d+$ | contains |
| data | ^\d+$ | equals |
| data | ^\d+$ | notequals |
| data | ^\d+$ | notstartswith |
| data | ^\d+$ | notendswith |
| data | ^\d+$ | notcontains |
| data | ^\d+$ | empty |
| data | ^\d+$ | notempty |
| data | ^\d+$ | intlessequals |
| data | ^\d+$ | intgreaterequals |
| data | ^\d+$ | intgreater |
| data | ^\d+$ | intless |
| data | ^\d+$ | intequals |
| data | ^\d+$ | intnotequals |
| subscriber | ^email$ | startswith |
| subscriber | ^email$ | endswith |
| subscriber | ^email$ | greaterequals |
| subscriber | ^email$ | greater |
| subscriber | ^email$ | less |
| subscriber | ^email$ | lessequals |
| subscriber | ^email$ | contains |
| subscriber | ^email$ | equals |
| subscriber | ^email$ | notequals |
| subscriber | ^email$ | notstartswith |
| subscriber | ^email$ | notendswith |
| subscriber | ^email$ | notcontains |
| subscriber | ^subscriptions$ | has_active_subscription_on |
| subscriber | ^subscriptions$ | has_no_active_subscription_on |
| subscription | ^activated$ | after |
| subscription | ^activated$ | before |
| subscription | ^deliveries$ | received |
| subscription | ^deliveries$ | not_clicked |
| subscription | ^deliveries$ | clicked |
| subscription | ^deliveries$ | read_online |
| subscription | ^deliveries$ | read |
| subscription | ^deliveries$ | not_received |
| subscription | ^deliveries$ | not_read |
| subscription | ^deliveries$ | not_read_online |
| subscription | ^(views|clicks)$ | inactivity_after |
| subscription | ^(views|clicks)$ | activity_after |
| subscription | ^(views|clicks)$ | activity_before |
| subscription | ^(views|clicks)$ | inactivity_before |
Putting it together as a ruleset
The ruleset is a list of JSON objects (the rules) and a logical operation and or or:
{"mode": "and", rules:[...]}
And with or:
{"mode": "or", rules:[...]}
A finished ruleset might look like this:
{"mode": "and", rules:[{
"type": "subscription",
"data": "views",
"operator": "inactivity_after",
"operand": "2013-01-01 00:00:00"
}, {
"type": "subscriber",
"data": "email",
"operator": "endswith",
"operand": "@hotmail.com"
}]}
