Your first flow
In about ten minutes you will build a flow that takes the invoices your suppliers email, keeps only the PDFs, merges them into one file named by date and sender, keeps it in Lumen and emails it to you. Then you will run it and read the run.
You need a Lumen workspace and permission to edit flows in it. Everything here happens in the console at app.go-lumen.ai; the same flow as YAML is at the end, for when you want it in git.
Create a flow from a template
A template is a working flow with sensible settings, so you start from something that runs instead of from an empty canvas.
- In the console, open Flows and choose the Templates tab.
- Find One file from a pile of invoices. The icons under each template are its steps, in order.
- Click the card to use it. The editor opens with the template's trigger and four steps already connected.
Choose the address that starts it
The trigger is When an email arrives. It needs to know which address to listen on.
- Click the trigger tile. Its settings open on the side.
- Under Source, keep A Lumen forwarding address: mail you forward to it arrives the moment it is sent. (Your mailbox reads a connected Gmail or Microsoft 365 inbox instead.)
- Under Which address starts this flow?, pick your workspace's forwarding address.
- Under Attachments, choose Each attachment separately. Every file goes through the flow on its own; the merge step gathers the files of one email back together.
- Leave Only emails with an attachment on, so a plain reply never starts a run, and click Done.
Set a rule in your mail client that forwards supplier invoices to the address. The originals stay in your inbox, and Lumen gets a copy as it arrives.
Add a step
Now add the step that emails you the merged file.
- Hover the line after 4. Keep it in Lumen and click the + at its end.
- Choose Action, then type
emailin Search steps. The list narrows to the Messages steps. - Choose Send it to me by email.
- In its settings, Send it to already holds your own address. Add a Subject and a Message. Keep Attach the files on, then click Done.
- Click Save and enable at the top right.
Every setting of this step, with its type and default, is on its reference page: Send it to me by email.
Run a test
You do not have to wait for an email to see the flow work. Run it on files from your computer.
- Open the flow from Flows. Click Run (the play button in the toolbar).
- Drop two or three PDF invoices into the dialog, or click to choose them.
- Click Run on 2 files (the count matches what you chose).
To try a single step without running the flow, open the step and use its Test tab. A step that changes something outside Lumen, like sending an email, shows what it would do instead of doing it.
See the run
The console opens the run as soon as it starts.
- The status moves from Running to Success in a few seconds.
- The summary shows when it was queued, started and finished, how long it took, the credits it used and how many documents it carried.
- The canvas below repeats the flow: every step that ran has a green check and its own duration, and each edge says how many documents went along it.
- Click a step to see its Input and Output: here, the merged PDF, ready to preview or download. Run from here reruns the flow from that step; Retry reruns it all.
The same flow as YAML
A flow is a plain resource, so the one you just built can live in git and be applied from the CLI or CI. The YAML below is the same flow, plus a manual trigger so lumen run can start it. It validates against the built-in catalog.
- YAML
- CLI
- Console
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: invoices-one-file
namespace: tenant-acme
spec:
displayName: One file from a pile of invoices
triggers:
- id: email
ref: {name: email-arrives}
connectorRef: {name: invoices-inbox}
config: {attachments: separate, requireAttachment: true}
next: [pdfs]
- id: manual
ref: {name: manual-run}
next: [pdfs]
nodes:
- id: pdfs
stepRef: {name: keep-pdfs}
next: [merge]
- id: merge
stepRef: {name: merge-pdfs}
next: [rename]
- id: rename
stepRef: {name: rename-file}
config: {pattern: "{date} from {sender}.pdf"}
next: [keep]
- id: keep
stepRef: {name: keep-in-lumen}
next: [mail]
- id: mail
stepRef: {name: send-email}
config:
to: you@example.com
subject: Invoices merged for this month
body: Hi, the merged invoice PDF is attached.
lumen apply -f invoices-one-file.yaml
lumen run invoices-one-file -f march.pdf -f april.pdf --wait
--wait prints each step as it finishes and exits non-zero if the run fails, so the same two lines work in CI.
The steps above: Flows, Templates, One file from a pile of invoices, set the trigger's address, add Send it to me by email, Save and enable, then Run.






