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

  1. Open Policies and select "Add a rule".
  2. Select the "Build it step by step" tab.
  3. If you own more than one account, choose one in "Account".
  4. Type a "Rule name".
  5. Choose the "Outcome": auto allow, hold, require approval, prohibit.
  6. If the outcome is hold, enter "Hold minutes", or leave it blank to use the default of 60.
  7. Set "Priority (higher is evaluated first)". It starts at 100.
  8. If you want, add a "Description (optional)". It is shown under the rule's name in your list.
  9. Under "The rule applies when", choose "all of these match" or "any of these match".
  10. For each condition, choose what to test in the first list and fill in the fields that appear. Tick "not" to reverse a condition.
  11. Select "Add a condition" for another condition, or "Add a group" for a group. Select "Remove" to take one out.
  12. 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 builderMatches whenExample in JSON
the action type is one ofThe 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 leastThe 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 belowThe 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 accountNo 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 patternThe 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 valueThe 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 valueThe payload field at "Field path" contains the value.{"payload_path_contains": {"path": "memo", "value": "refund"}}
the action is marked reversibleThe agent's reversible flag equals your choice, "reversible" or "irreversible".{"reversible_is": false}
the agent is one ofThe 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 windowThe 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:

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.

  1. Select "Edit the JSON directly". The box "Condition (JSON in the rule grammar)" shows what you have built so far.
  2. Edit the JSON. It uses all, any and not around the conditions in the table above.
  3. 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.
  4. 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

  1. On the Policies page, select "Edit" in the rule's row.
  2. Change the fields or the condition in the same builder.
  3. 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:
Next:

All help pages

Inbox

Rules

Teams

Ledger

Billing

Account and security

For agent builders

Troubleshooting