Help: Rules
Build a rule with the form
The rule builder lets you put a rule together from fixed choices. A rule saved from the builder is enabled at once, with no confirmation step. Only an owner of the account can add rules.
Build and save a rule
- Open Policies and select "Add a rule".
- Select the "Build it step by step" tab.
- If you own more than one account, choose one in "Account".
- Type a "Rule name".
- Choose the "Outcome": auto allow, hold, require approval, prohibit.
- If the outcome is hold, enter "Hold minutes", or leave it blank to use the default of 60.
- Set "Priority (higher is evaluated first)". It starts at 100.
- If you want, add a "Description (optional)". It is shown under the rule's name in your list.
- Under "The rule applies when", choose "all of these match" or "any of these match".
- For each condition, choose what to test in the first list and fill in the fields that appear. Tick "not" to reverse a condition.
- Select "Add a condition" for another condition, or "Add a group" for a group. Select "Remove" to take one out.
- Select "Save and enable the rule".
The Policies page opens with the message "Rule saved" and the rule is in force for requests that arrive from now on. If the condition is not valid, the form opens again with a message that starts "Invalid condition" and nothing is saved.
The conditions
The first column is the choice as it appears in the builder. The last column is the same condition in JSON, as "Preview the condition as JSON" shows it.
| Choice in the builder | Matches when | Example in JSON |
|---|---|---|
| the action type is one of | The request's action type is one you ticked: payment, message, delete, post, sign, account change, other. | {"action_type_in": ["payment", "message"]} |
| the amount is at least | The request has an amount in the same currency and it is this much or more. Amounts are in minor units (cents, pence). A request with no amount, or in another currency, does not match. | {"amount_gte": {"minor": 7500, "currency": "USD"}} |
| the amount is below | The request has an amount in the same currency and it is less than this. | {"amount_lt": {"minor": 7500, "currency": "USD"}} |
| the counterparty is new to this account | No request in your account with the same counterparty has been reported as executed. A request without a counterparty counts as new. | {"counterparty_is_new": true} |
| the counterparty matches a pattern | The pattern, a regular expression that ignores case, is found in the counterparty. A request without a counterparty does not match. The pattern can be up to 200 characters. | {"counterparty_matches": "acme"} |
| a payload field equals a value | The payload field at "Field path" equals the value. Use dots to reach a nested field. | {"payload_path_equals": {"path": "target", "value": "agent_permissions"}} |
| a payload field contains a value | The payload field at "Field path" contains the value. | {"payload_path_contains": {"path": "memo", "value": "refund"}} |
| the action is marked reversible | The agent's reversible flag equals your choice, "reversible" or "irreversible". | {"reversible_is": false} |
| the agent is one of | The request comes from one of the listed agents. Enter agent ids one per line. An agent's id is the last part of the address of its page under Agents. | {"agent_id_in": ["the agent's id"]} |
| the local time is within a window | The time in the given time zone is at or after "From" and before "To" when the request arrives. A window whose start is later than its end runs past midnight. Start and end must differ. | {"time_window": {"start": "21:00", "end": "07:00", "tz": "Europe/London"}} |
Groups and the two-level limit
The builder has two levels:
- The top level joins its items with "all of these match" or "any of these match".
- Each item is a "condition" or a "group". A group joins its own conditions with "all of these" or "any of these".
- A group holds conditions only. You cannot put a group inside a group.
- "not" can be ticked on any condition and on any group.
For example, "a payment, and either the amount is at least a figure or the counterparty is new" is one condition plus one group of two conditions, joined by "all of these match".
JSON mode
A condition that needs more than two levels has to be written as JSON.
- Select "Edit the JSON directly". The box "Condition (JSON in the rule grammar)" shows what you have built so far.
- Edit the JSON. It uses
all,anyandnotaround the conditions in the table above. - To go back, select "Load into the builder". JSON that fits the two levels is loaded into the builder. JSON that is deeper stays in JSON mode.
- Select "Save and enable the rule".
If the JSON cannot be read, a message starting "The JSON could not be parsed" appears and nothing is saved.
Edit a rule later
- On the Policies page, select "Edit" in the rule's row.
- Change the fields or the condition in the same builder.
- Select "Save".
Each save creates a new version of the rule. The version number is shown in the "Version" column.
Rules test what the agent submits. funwatcher does not check that an agent's amount, counterparty or payload are accurate. See How rules work.
Previous: Write a rule in plain English
Next: Reorder, enable and disable rules
All help pages
Inbox
- Read a request
- Approve, deny or edit a request
- Held actions
- Expired requests and history
- Request statuses
Rules
- How rules work
- The default rules
- Write a rule in plain English
- Build a rule with the form
- Reorder, enable and disable rules
- Suggested rules
- Set a default policy for an agent
- Export your rules
Teams
Ledger
- What the ledger is
- Browse and filter the ledger
- Export and verify the ledger
- Payload retention
- Monthly statements
Billing
Account and security
- Change your password
- Two-factor authentication and recovery codes
- Rotate or revoke an agent key
- How your data is protected
- Closing an account