When X matches, do Y — automatically.
Rules turn a passive inbox into a workflow. Tag a lead, route an urgent enquiry to Slack, auto-reply to an invoice request, or AI-triage every message — all without writing a webhook consumer. Rules run server-side, the moment a submission or email arrives.
What rules do
A rule is conditions + actions. When an
incoming item matches the conditions (all of them, or
any), every action fires. Rules run best-effort
right after the item is stored — they never block or delay the
submit/receive path, and a failing rule can't lose the item.
There are two kinds, with the same shape but different fields:
| Form rules | Mailbox rules | |
|---|---|---|
| Triggers on | a new submission | a received email (agent mailboxes) |
| Condition fields | any field id, or _spam | from, subject, body, to, _spam |
| Operators | contains, not_contains, equals, not_equals, exists | |
| Actions | tag · set status · webhook · email · Slack | mark read · AI-enrich · auto-reply |
Form rules
Manage them on the form's Rules tab, or over the API.
Conditions read submission field ids; _spam matches the spam
flag ("true"/"false").
$ curl -X POST https://login.ollastack.com/api/forms/<formId>/rules \ -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \ -d '{ "name": "Flag refund requests", "matchType": "all", "conditions": [{ "field": "message", "op": "contains", "value": "refund" }], "actions": [ { "type": "add_tag", "value": "refund" }, { "type": "notify_email", "to": "support@acme.com" } ] }'
Needs the forms:write scope (read with forms:read).
Form actions
| action | does |
|---|---|
add_tag | Adds a tag to the submission (value). |
set_status | Sets status to new / read / archived. |
webhook | Fires a signed webhook event (optional event name) through the retried delivery engine. |
notify_email | Emails a fixed address (to, optional subject) a summary of the matched submission — route an enquiry to the right inbox. |
slack | POSTs a short summary to a Slack incoming-webhook url (SSRF-guarded). |
Mailbox rules
For agent mailboxes: manage them on the mailbox's Rules tab or the API. They run on each inbound message — hard spam is never matched, so an auto-reply can't answer a spammer.
$ curl -X POST https://login.ollastack.com/api/mailboxes/<mailboxId>/rules \ -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \ -d '{ "name": "Auto-reply to invoice requests", "conditions": [{ "field": "subject", "op": "contains", "value": "invoice" }], "actions": [{ "type": "auto_reply", "body": "Thanks — your invoice is attached shortly." }] }'
| action | does |
|---|---|
mark_read | Marks the message read. |
enrich | Runs AI triage on the message (see below). No-op if AI isn't enabled. |
auto_reply | Replies to the sender with a fixed body (subject gets Re:, threading kept). Counts against your send quota. |
Needs the mail.agent:write scope.
AI enrichment
Enrichment runs an LLM over a lead or email and stores a structured
triage on it: category, sentiment, urgency, a one-line summary,
extracted entities, and a suggested reply. Use it as the
enrich rule action, turn on auto-enrich per
mailbox, or call it on demand:
$ curl -X POST https://login.ollastack.com/api/mailboxes/<id>/messages/<msgId>/enrich \ -H "Authorization: Bearer <token>" $ curl -X POST https://login.ollastack.com/api/forms/<id>/submissions/<subId>/enrich \ -H "Authorization: Bearer <token>"
Returns 503 if AI enrichment isn't configured on the server.
It's dormant-by-default — an operator enables it with an LLM key.
Behaviour + limits
- Best-effort — rules run after the item is stored, never on the critical path. A bad rule can't break a submission or drop an email.
- Match order — every enabled rule is evaluated; all matching rules' actions fire (rules aren't mutually exclusive). Use
matchType: "any"for OR,"all"(default) for AND. - No conditions = matches everything (a blanket rule).
- Spam — form rules can match
_spam; mailbox rules never fire on hard spam (quarantined mail still does).