Dillo Flows
Money & expenses, template v1

Invoice intake and coding suggestion

Each invoice email that arrives is read, its details are pulled out as named fields, and account codes are suggested. You check the draft before it becomes the invoice record.

Starts when: Email received. Produces: Invoice record drafted. Steps: 5
Sample run — illustrative, not a record of a real run
messageId
msg-sample-1
threadId
thr-sample-1
from
billing@sample-vendor.example
to
["you@example.com"]
subject
Invoice 1042
snippet
Invoice 1042 for services…
receivedAt
2026-11-04T10:00:00Z
labelIds
["INBOX"]
hasAttachments
true
1Write it back2Pull out the details3Shape the note4A person decides5The result

Sample result: Invoice drafted: Sample Vendor, amount and due date pulled out, codes suggested. Approved by the checker. Invoice record drafted.

What each step does

Step 1 · Write it back

The outcome is posted back through the connection you name. The secret stays sealed; the step carries the name only.

Message · ID

Step 2 · Pull out the details

An AI step does this part. Today it runs on a simulated stand-in, labelled simulated on every run, until a real model is wired. This step reads text that arrived from outside — an email, a document, a form. Treat its output as a draft from untrusted input: that is why a person checks what it produces before anything leaves.

Message fetch · Body

Step 3 · Shape the note

The wording of the note is shaped from the fields picked below.

Message · From

Step 4 · 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.

Invoice draft · Note

Step 5 · The result

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

Message · 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
Mailbox to read fromThe connection, by name, that can fetch the full message.A connection you name — never a key pasted here
Who checks invoice draftsThe role or person who approves each drafted record.Bookkeeper

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

The connection, by name, that can fetch the full message.

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

The role or person who approves each drafted record.

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

The definition

The whole mechanism, before you take it. Package checksums: sha256:63f10434743d… · sha256:b0cd62a89ee8… · sha256:fb8ccaa284a1…. 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": "invoice-intake-and-coding-suggestion",
      "version": 1,
      "name": "Invoice intake and coding suggestion",
      "category": "money-expenses",
      "outcome": "Each invoice email that arrives is read, its details are pulled out as named fields, and account codes are suggested. You check the draft before it becomes the invoice record.",
      "outputName": "Invoice record drafted",
      "fits_when": [
        "supplier_invoices"
      ],
      "needs": [
        "connection:mail"
      ]
    },
    "trigger": {
      "type": "email.message.received",
      "source": "gmail",
      "manifestFields": {
        "messageId": "string!",
        "threadId": "string!",
        "from": "string!",
        "to": "string[]!",
        "subject": "string",
        "snippet": "string",
        "receivedAt": "iso!",
        "labelIds": "string[]!",
        "hasAttachments": "bool!"
      }
    },
    "inputConvention": "envelope",
    "variables": [
      {
        "name": "mailConnection",
        "kind": "connection",
        "label": "Mailbox to read from",
        "instruction": "The connection, by name, that can fetch the full message."
      },
      {
        "name": "approverRole",
        "kind": "string",
        "label": "Who checks invoice drafts",
        "instruction": "The role or person who approves each drafted record.",
        "example": "Bookkeeper",
        "default": "Approver"
      }
    ],
    "sample": {
      "input": {
        "messageId": "msg-sample-1",
        "threadId": "thr-sample-1",
        "from": "billing@sample-vendor.example",
        "to": [
          "you@example.com"
        ],
        "subject": "Invoice 1042",
        "snippet": "Invoice 1042 for services…",
        "receivedAt": "2026-11-04T10:00:00Z",
        "labelIds": [
          "INBOX"
        ],
        "hasAttachments": true
      },
      "output": "Invoice drafted: Sample Vendor, amount and due date pulled out, codes suggested. Approved by the checker. Invoice record drafted."
    }
  },
  "flow.json": {
    "name": "Invoice intake and coding suggestion",
    "inputConvention": "envelope",
    "steps": [
      {
        "type": "http",
        "method": "GET",
        "connectionFromVariable": "mailConnection",
        "url": {
          "segments": [
            {
              "text": "https://example.com/messages/"
            },
            {
              "field": {
                "source": "trigger",
                "name": "messageId",
                "label": "Message · ID"
              }
            }
          ]
        }
      },
      {
        "type": "ai",
        "task": "extract",
        "untrustedInput": true,
        "text": {
          "segments": [
            {
              "text": "Invoice message: "
            },
            {
              "field": {
                "source": "step",
                "stepIndex": 0,
                "path": [
                  "body"
                ],
                "label": "Message fetch · Body"
              }
            }
          ]
        }
      },
      {
        "type": "transform",
        "template": {
          "segments": [
            {
              "text": "Invoice draft from "
            },
            {
              "field": {
                "source": "trigger",
                "name": "from",
                "label": "Message · From"
              }
            },
            {
              "text": " — check the pulled-out details and suggested codes."
            }
          ]
        }
      },
      {
        "type": "human",
        "kind": "approval",
        "prompt": {
          "segments": [
            {
              "text": "Check this invoice draft: "
            },
            {
              "field": {
                "source": "step",
                "stepIndex": 2,
                "path": [
                  "text"
                ],
                "label": "Invoice draft · Note"
              }
            }
          ]
        },
        "due": 259200,
        "onExpire": "continue"
      },
      {
        "type": "output",
        "value": {
          "segments": [
            {
              "text": "Invoice record drafted for message "
            },
            {
              "field": {
                "source": "trigger",
                "name": "messageId",
                "label": "Message · ID"
              }
            }
          ]
        }
      }
    ]
  },
  "rules.json": {
    "rulesets": [],
    "permissions": {
      "approvals": {
        "approveBeforeSteps": [
          3
        ],
        "rejectRequiresComment": true,
        "dueSeconds": 259200,
        "onExpire": "continue"
      },
      "connections": {
        "required": [
          {
            "nameFromVariable": "mailConnection",
            "usedBySteps": [
              0
            ]
          }
        ],
        "optional": []
      }
    }
  }
}

All templates   See the system: Link Map