NEW AI agents now first-class: authorize · audit · revoke in one click — your agents submit cleanly, bots stay blocked. Read agent docs →
workflow rules

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 rulesMailbox rules
Triggers ona new submissiona received email (agent mailboxes)
Condition fieldsany field id, or _spamfrom, subject, body, to, _spam
Operatorscontains, not_contains, equals, not_equals, exists
Actionstag · set status · webhook · email · Slackmark 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

actiondoes
add_tagAdds a tag to the submission (value).
set_statusSets status to new / read / archived.
webhookFires a signed webhook event (optional event name) through the retried delivery engine.
notify_emailEmails a fixed address (to, optional subject) a summary of the matched submission — route an enquiry to the right inbox.
slackPOSTs 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." }]
     }'
actiondoes
mark_readMarks the message read.
enrichRuns AI triage on the message (see below). No-op if AI isn't enabled.
auto_replyReplies 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).