The kernel
Writing rules
A rule tells the kernel: when this happens, and only if…, do this, with this risk level.
Parts of a rule
| Field | What it means |
|---|---|
| Name | A short name you'll recognise, e.g. “Confirm new orders”. |
| When this event happens | An event type: order.created; a family: order.*; or every event: *. |
| Only if (optional) | A condition on the event, e.g. payload.total > 1000. |
| Do this | Create a task, notify the team, assign to a role, reply to the customer, follow up later, tag the record, or open an opportunity. |
| Risk | Simple (green), medium (yellow) or sensitive (red). See How the kernel decides. |
| Who (optional) | The role that handles it: sales, support, shipping, provider… |
| Within (optional) | How many minutes it should take, used for follow-up. |
Conditions
A condition reads a field of the event. Use payload. followed by the field name the source sends (for example payload.total, payload.city, payload.service), or source and customer_ref. Operators: is, is not, >, ≥, <, ≤, contains, is filled.
Examples
| Rule | When | Only if | Do | Risk |
|---|---|---|---|---|
| Confirm new orders | order.created | — | Create a task (support, 30 min) | Green |
| Big orders to sales | order.created | payload.total > 5000 | Assign to sales | Yellow |
| New leads | lead.received | — | Assign to sales (15 min) | Green |
| Refund requests | refund.requested | — | Create a task (owner) | Red |
| Failed payments | payment.failed | — | Reply to the customer | Yellow |
Test before you rely on it
On the Rules page, Send a test event with a type and some fields. You'll see which rules matched and what the kernel decided, without touching your store or customers. Pause a rule any time instead of deleting it.