Dillo Flows
Money & expenses, template v1

Expense check against your rules

Every submitted expense is checked against the limits you set. Clean ones are recorded as within policy; only the ones that trip a rule stop and ask you, with the reason attached.

Starts when: A form or system you name sends it. Produces: Decision recorded. Steps: 7
Sample run — illustrative, not a record of a real run
expenseId
EXP-0001
employee
Sample Person
amountCents
124000
currency
USD
merchant
Sample Airline
category
Flights
receiptAttached
true
1Rule check2Sort by the check3A person decides4Write it back5Shape the note6Paths join7The result

Sample result: Flagged: amount is over your review threshold. Approved by the reviewer with a note. Decision recorded.

What each step does

Step 1 · Rule check

Your written rules are checked against what arrived. A tripped rule is named, with its reason in plain words.

Step 2 · Sort by the check

The run takes one of two paths, decided by the check before it — never by guessing.

Step 3 · A person decides

The run stops and asks the person named in your settings. The decision window is 72 hours; if it lapses, the run carries on without a decision, and the lapse is on the record. Rejecting always takes a comment. Runs when the check before it matched.

Expense · MerchantExpense · AmountPolicy check · Rules tripped

Step 4 · Write it back

The outcome is posted back through the connection you name. The secret stays sealed; the step carries the name only. Runs when the check before it matched.

Expense · IDPolicy check · Rules tripped

Step 5 · Shape the note

The wording of the note is shaped from the fields picked below. Runs when the check before it did not match.

Expense · ID

Step 6 · Paths join

The two paths join here, and the run continues as one.

Step 7 · The result

This is what the run hands back, written into the run's record where you can read it.

Expense · ID

What you'll fill in

These are the only things the template asks of you. Examples teach the shape — they are never values your flow runs on; what you type (or the stated starting value) is what gets used.

FieldWhat to put in itExample
Review amounts overExpenses above this amount (in cents) stop for your review.10000
Who reviews flagged expensesThe role or person the approval card is addressed to.Finance approver
Send decisions toThe connection, by name, that decisions are posted back through. Optional — leave unset and decisions stay in your runs record only.A connection you name — never a key pasted here

Set it up

  1. Fill in the fields below.
  2. Name the connections it needs — by name only.
  3. Look at the trigger preview: what would start a run, counted before anything is armed.
  4. Review the steps, the rules, and every place a person is asked.
  5. Create it — then run it once yourself, and read the run's record.
Creating never arms the trigger. The flow is created switched off: no runs start for things that already match. Arming is a separate tap on the created flow, after you have seen the preview count.

Use this template

Expenses above this amount (in cents) stop for your review.

The role or person the approval card is addressed to.

The connection, by name, that decisions are posted back through. Optional — leave unset and decisions stay in your runs record only.

Connections are named, sealed, and never shown again. Add one in the console's setup, then pick it here by name.

Sign in to preview what this trigger would match in your space.

The definition

The whole mechanism, before you take it. Package checksums: sha256:b3aab48bc2d0… · sha256:3d180b8d1422… · sha256:38e93c8c8aad…. A flow made from this template carries this template's name and version in its record, and exports in the standard bundle with that provenance.

Advanced · the three files, as written
{
  "trigger.json": {
    "template": {
      "slug": "expense-check-against-your-rules",
      "version": 1,
      "name": "Expense check against your rules",
      "category": "money-expenses",
      "outcome": "Every submitted expense is checked against the limits you set. Clean ones are recorded as within policy; only the ones that trip a rule stop and ask you, with the reason attached.",
      "outputName": "Decision recorded",
      "fits_when": [
        "expenses"
      ],
      "needs": []
    },
    "trigger": {
      "type": "webhook.received",
      "source": "webhook",
      "manifestFields": {
        "expenseId": "string!",
        "employee": "string!",
        "amountCents": "int!",
        "currency": "string!",
        "merchant": "string!",
        "category": "string",
        "receiptAttached": "bool!"
      }
    },
    "inputConvention": "envelope",
    "variables": [
      {
        "name": "reviewThreshold",
        "kind": "int",
        "label": "Review amounts over",
        "instruction": "Expenses above this amount (in cents) stop for your review.",
        "example": 10000,
        "default": 10000
      },
      {
        "name": "approverRole",
        "kind": "string",
        "label": "Who reviews flagged expenses",
        "instruction": "The role or person the approval card is addressed to.",
        "example": "Finance approver",
        "default": "Approver"
      },
      {
        "name": "resultConnection",
        "kind": "connection",
        "label": "Send decisions to",
        "instruction": "The connection, by name, that decisions are posted back through. Optional — leave unset and decisions stay in your runs record only.",
        "optional": true
      }
    ],
    "sample": {
      "input": {
        "expenseId": "EXP-0001",
        "employee": "Sample Person",
        "amountCents": 124000,
        "currency": "USD",
        "merchant": "Sample Airline",
        "category": "Flights",
        "receiptAttached": true
      },
      "output": "Flagged: amount is over your review threshold. Approved by the reviewer with a note. Decision recorded."
    }
  },
  "flow.json": {
    "name": "Expense check against your rules",
    "inputConvention": "envelope",
    "clefIn": [
      {
        "ruleset": "expense-policy-starter",
        "ids": [
          "expense-has-amount"
        ]
      }
    ],
    "steps": [
      {
        "type": "rulecheck",
        "rules": [
          {
            "ruleset": "expense-policy-starter",
            "ids": [
              "amount-over-review-threshold",
              "receipt-missing"
            ]
          }
        ]
      },
      {
        "type": "branch",
        "conditions": [
          {
            "path": "steps.0.tripped",
            "op": "contains",
            "value": "amount-over-review-threshold"
          },
          {
            "path": "steps.0.tripped",
            "op": "contains",
            "value": "receipt-missing"
          }
        ],
        "join": "any"
      },
      {
        "type": "human",
        "kind": "approval",
        "when": "matched",
        "prompt": {
          "segments": [
            {
              "text": "Review this flagged expense: "
            },
            {
              "field": {
                "source": "trigger",
                "name": "merchant",
                "label": "Expense · Merchant"
              }
            },
            {
              "text": " — "
            },
            {
              "field": {
                "source": "trigger",
                "name": "amountCents",
                "label": "Expense · Amount"
              }
            },
            {
              "text": ". It tripped: "
            },
            {
              "field": {
                "source": "step",
                "stepIndex": 0,
                "path": [
                  "tripped"
                ],
                "label": "Policy check · Rules tripped"
              }
            }
          ]
        },
        "due": 259200,
        "onExpire": "continue"
      },
      {
        "type": "http",
        "method": "POST",
        "url": "https://example.com/decisions",
        "when": "matched",
        "connectionFromVariable": "resultConnection",
        "body": {
          "segments": [
            {
              "text": "Decision for "
            },
            {
              "field": {
                "source": "trigger",
                "name": "expenseId",
                "label": "Expense · ID"
              }
            },
            {
              "text": ": "
            },
            {
              "field": {
                "source": "step",
                "stepIndex": 0,
                "path": [
                  "tripped"
                ],
                "label": "Policy check · Rules tripped"
              }
            }
          ]
        }
      },
      {
        "type": "transform",
        "when": "not-matched",
        "template": {
          "segments": [
            {
              "text": "Within policy: "
            },
            {
              "field": {
                "source": "trigger",
                "name": "expenseId",
                "label": "Expense · ID"
              }
            },
            {
              "text": " recorded without review."
            }
          ]
        }
      },
      {
        "type": "end"
      },
      {
        "type": "output",
        "value": {
          "segments": [
            {
              "text": "Decision recorded for "
            },
            {
              "field": {
                "source": "trigger",
                "name": "expenseId",
                "label": "Expense · ID"
              }
            }
          ]
        }
      }
    ]
  },
  "rules.json": {
    "rulesets": [
      {
        "name": "expense-policy-starter",
        "version": 1,
        "rules": [
          {
            "id": "expense-has-amount",
            "on": "step.payload.amountCents",
            "op": "missing",
            "action": "block",
            "msg": "An expense event without an amount is not consumable."
          },
          {
            "id": "amount-over-review-threshold",
            "on": "step.payload.amountCents",
            "op": "gt",
            "valueFromVariable": "reviewThreshold",
            "action": "flag",
            "msg": "Amount is over your review threshold."
          },
          {
            "id": "receipt-missing",
            "on": "step.payload.receiptAttached",
            "op": "ne",
            "value": true,
            "action": "flag",
            "msg": "No receipt was attached."
          }
        ]
      }
    ],
    "permissions": {
      "approvals": {
        "approveBeforeSteps": [
          2
        ],
        "rejectRequiresComment": true,
        "dueSeconds": 259200,
        "onExpire": "continue"
      },
      "connections": {
        "required": [],
        "optional": [
          {
            "nameFromVariable": "resultConnection",
            "usedBySteps": [
              3
            ]
          }
        ]
      }
    }
  }
}

All templates   See the system: Link Map