דלג לתוכן הראשי

Triggers

A trigger is what starts a run: an email, a schedule, a call to a webhook, a button you press. Every flow has at least one, and a flow can have up to 16. This page lists them all, shows how to pick one, and covers the two controls every trigger shares: a condition that decides whether to start, and a switch that turns it off.

  • Any workspace
  • Console or YAML

Each run starts from exactly one trigger. The trigger hands its first steps whatever arrived (an email and its files, the fields of a form, the text of a chat message), and the steps after it read those values as <trigger id>.<field>, for example {email.subject}.

Choose what starts a flow​

  1. Open a flow in the editor. On a new flow, click Choose what starts this flow. On an existing one, click its trigger, then Change.
  2. Pick one from the list, or type in Search triggers.
  3. Fill in its settings, such as the address or the schedule. A red dot on the trigger tile means a required setting is still missing.
  4. Click Done.
The trigger picker, a side panel titled What starts this flow with a Search triggers box. Under Triggers it lists An email arrives, Another flow starts it, A file lands in a folder, On a schedule, I press Run and A chat message arrives, each with an icon and a one-line description.The trigger picker, a side panel titled What starts this flow with a Search triggers box. Under Triggers it lists An email arrives, Another flow starts it, A file lands in a folder, On a schedule, I press Run and A chat message arrives, each with an icon and a one-line description.
The trigger picker. Scroll for the webhook, form, WhatsApp, Jira, GitHub and test-case triggers.

Every trigger​

Trigger (console title)Catalog nameStarts whenNeedsGuide
An email arrivesemail-arrivesMail reaches a Lumen forwarding address.An email forwarding connectionEmail forwarding
An email arrives, source Your mailboxmailbox-emailA new email lands in a mailbox Lumen reads over IMAP. Checked every 5 minutes unless you change it.A mailbox connectionGmail and mailboxes
On a scheduleon-scheduleThe days and time you choose, or at a fixed interval.NothingWaits and schedules
I press Runmanual-runSomeone presses Run and chooses files, or runs lumen run.NothingYour first flow
A chat message arriveschat-messageSomeone writes in the chat. The flow's reply is what they read back.NothingAgents
A webhook is calledwebhook-receivedAnother system calls your webhook address.A webhook connectionHTTP and webhooks
A form is submittedform-submittedSomeone fills in one of your forms.A formForms
A WhatsApp message arriveswhatsapp-message-receivedSomeone writes to your WhatsApp number or taps a button you sent.A WhatsApp connectionWhatsApp
A Jira issue changesjira-issue-changedAn issue in the projects you pick is created, changes status or changes otherwise. Checked every 5 minutes unless you change it.A Jira connectionJira and GitHub
GitHub activitygithub-activityAn issue or pull request in the repositories you pick is opened, labeled, closed or merged, a review is requested, or a draft is marked ready. Checked every 5 minutes unless you change it.A GitHub connectionJira and GitHub
Another flow starts itflow-calledAnother flow runs it with a Run flow step, on the same documents.NothingRun another flow
Test casesevaluationYou run an evaluation: the flow runs once per row of a table of test cases, in test mode.A test-cases tableTest and evaluate
A file lands in a folderfile-addedPlanned. The catalog lists it, but nothing fires it yet, so a flow that uses it cannot be switched on.

The email trigger is one entry in the editor with a Source setting (A Lumen forwarding address or Your mailbox). In YAML they are two catalog triggers, email-arrives and mailbox-email, with the same outputs. A flow saved with either keeps working as saved.

What each trigger gives the steps​

Every trigger puts its own fields on the document. These are the ones for the email triggers; the others are listed on their guide.

FieldTypeMeaning
from, totextSender and recipients.
subject, bodytextThe subject and the text of the email.
attachmentsnumberHow many files the trigger took (at most 20 per email).
senderVerifiedyes/noTrue when the sending server's own check passed: DMARC passed, or the domain has no DMARC policy and SPF or DKIM passed for an aligned domain.
receivedAtdateWhen it arrived.
messageIdtextThe email's Message-ID.

Email settings​

Setting (console label)YAML keyDefaultNotes
Attachmentsattachmentsseparate for a new trigger in the editorseparate: each file goes through the flow on its own, with the email's sender, subject and body. together: one document holds every file. A trigger saved before this setting existed behaves as together.
Include images in the email bodyincludeInlineoffTakes images shown in the body as attachments too.
Largest mail (MB)maxSizeMB25From 1 to 40. A bigger email starts no run.
Only emails with an attachmentrequireAttachmenton for an address, off for a mailboxTurn it off to start on every email.

A mailbox trigger adds folder (default INBOX), pollMinutes (1 to 60, default 5), afterHandling (markRead, moveTo or leave), includeAttachments, importExisting (0 to 500: take the newest mails already in the folder, once, when the folder is first read) and two optional filters, fromContains and subjectContains.

Start only when​

Start only when is a condition on the trigger's own fields. It is checked the moment the arrival is taken in, before any run exists. An arrival that does not match starts no run and costs nothing.

It is available on the email triggers, A Jira issue changes and GitHub activity. On any other trigger, use a filter as the first node instead.

  1. Open the trigger and scroll to Start only when.
  2. Build the condition in Visual mode (field, operator, value, with Condition and Group to add more), or switch to Text and write it, such as trigger.subject ~ "invoice" AND trigger.senderVerified = true.
  3. Click Done.

On a trigger created in the console the id is trigger, so its fields read trigger.subject. The editor says valid when the text parses.

The Start only when section of the email trigger panel, in Text mode. The condition reads trigger.subject ~ "invoice" AND trigger.senderVerified = true, with the note valid, 2 conditions below it.The Start only when section of the email trigger panel, in Text mode. The condition reads trigger.subject ~ "invoice" AND trigger.senderVerified = true, with the note valid, 2 conditions below it.
A condition in Text mode. The text and the visual builder describe the same condition.

Mail that was checked and did not start a run is listed in the trigger's Recent emails, with the reason (for example Start only when did not match), so you can see what a condition kept out.

A mailbox email that does not match is left where it is: not marked read, not moved.

Use several triggers in one flow​

A flow can start from more than one place. Each trigger lists its own first steps, so the paths can differ, and several triggers can share a step. Each run starts from one trigger and follows only its path.

invoice-intake.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: triggers-invoice-intake
namespace: tenant-acme
spec:
displayName: Invoice intake
triggers:
- id: email
title: A supplier emails an invoice
ref: {name: email-arrives}
connectorRef: {name: invoices-inbox}
config: {attachments: separate, requireAttachment: true}
next: [pdfs]
- id: manual
ref: {name: manual-run}
next: [pdfs]
- id: monday
title: Every Monday
ref: {name: on-schedule}
config: {cron: "0 8 * * 1", timeZone: Asia/Jerusalem}
next: [remind]
nodes:
- id: pdfs
stepRef: {name: keep-pdfs}
next: [keep]
- id: keep
stepRef: {name: keep-in-lumen}
- id: remind
stepRef: {name: notify-in-app}
config: {to: admins, title: "Check the invoices folder"}

What the steps after the trigger can use depends on what it produces: a schedule produces no document, so only steps that need nothing can follow it. The editor and the API refuse a step whose needs are not met.

To branch on which trigger started a run, use the run field run.trigger, which holds the trigger's id (or its catalog name). For example, the condition run.trigger = "manual".

Turn a trigger off​

A disabled trigger keeps its settings and starts nothing, whatever arrives. Use it to pause one entry point of a flow, or to test with the others.

Hover the trigger and click the stop icon in its toolbar, or open its ... menu and choose Disable. Do the same to turn it back on. A disabled trigger is drawn dimmed. When every trigger of a flow is off, the editor warns that nothing starts the flow.

What a disabled trigger does depends on how the arrival comes in:

TriggerWhen it is disabled
Email to a forwarding addressThe email is taken in and logged as not started, with the reason "the trigger was disabled".
MailboxThe mailbox is not read for it.
ScheduleNothing fires. Switching it back on does not replay the time it was off.
WebhookThe call is accepted (202), no run starts, and the response lists the trigger as skipped. The sender is not told to stop or retry.
Form, WhatsApp, chatNothing starts.
Manual runA run asked of it is refused. With no trigger named, the first enabled manual trigger is used.

To pause the whole flow instead, turn off its switch at the top of the editor (suspend: true in YAML). Runs already queued still finish.

Duplicate mail​

A redelivered email does not start a second run. Lumen records every email once, keyed on its Message-ID, and derives each run's identity from that record, the flow and the trigger. If a message arrives again, for example after a mail server retries, a message that was already fully handled starts nothing, and one that was recorded but never queued still starts its runs.

A mailbox is deduplicated the same way, per flow, on the Message-ID. So marking a mail unread or moving it back to the folder does not run it a second time.

This protects against the same message arriving twice. It does not recognize two different emails that carry the same invoice. For that, add the Skip duplicates step: it remembers a key you choose, such as {supplier} {invoiceNumber}, for a number of days, and ends the run quietly when it has seen the key before.

Next steps​