Skip to content

Your first workflow ​

In this tutorial you build a workflow that sorts incoming invoices: every email whose subject contains “invoice” is categorised by AI, and supplier invoices are filed in a folder of your mailbox. You test it on a real email without touching anything, then publish it.

It takes about fifteen minutes.

Before you start ​

You need:

  • an account on a Mankomail instance — see Self-hosting or Cloud;
  • a mailbox you can connect: Google, Microsoft 365 or IMAP;
  • for a Google or Microsoft mailbox, the organisation's OAuth application registered by an administrator in Administration › OAuth applications — see Google and Microsoft;
  • an AI provider configured by an administrator in Connections, section Artificial intelligence — see Integrations.

Without an AI provider

You can still follow the tutorial. During a test run, the AI node is skipped and its output is fabricated; the test run shows “AI skipped: no key on this instance”. The published workflow needs a real provider to categorise.

Step 1 — Connect a mailbox ​

  1. In the navigation, open Mailboxes.
  2. In the Connect a mailbox section, pick your provider, then click Connect a Google mailbox or Connect a Microsoft mailbox. You are sent to the provider to authorise access, then brought back.
  3. For any other provider, click Connect an IMAP mailbox, fill in the address, the IMAP and SMTP servers and the password, then click Connect the mailbox. The credentials are tried on a real connection before anything is saved.

The mailbox appears in Connected mailboxes, with the status Active. Its history is synchronised in the background, most recent mail first: you can carry on without waiting for the Backfill to finish.

If the page says The OAuth application is not configured, an administrator must first register the organisation's application. See Mailboxes and the mirror for what the mirror stores and how synchronisation works.

Step 2 — Create the workflow ​

  1. Open Workflows.
  2. In the New workflow section, type a name, for example Supplier invoices, then click Create.

The editor opens. The canvas already holds a trigger, Email received: a new workflow listens to incoming email by default. The workflow is a Draft — it does not run on your mail until you publish it.

Step 3 — Filter with a condition ​

Without a condition, the trigger listens to every email in your mailboxes. Narrow it down:

  1. Double-click the Email received node to open its settings.
  2. Under Conditions, click Add a condition.
  3. Set Field to Subject, Operator to contains, and Value to invoice.

Your changes are kept as you type. If you add several conditions, choose All (every condition must match) or Any (one is enough).

Conditions are evaluated before any processing: an email that does not match never enters the workflow. See Triggers and conditions for every available field, and Scope for the senders that are excluded before any workflow.

Step 4 — Categorise with AI ​

  1. Close the trigger settings. On the canvas, click the + on the output of Email received (Connect what follows). The panel on the right shows the node palette.
  2. Search for categorize and click Categorize. The node is added, linked to the trigger, and its settings open.
  3. Under Categories, click Add and fill in:
    • Name: Supplier invoice;
    • Description: what an email of this category looks like, for example “An invoice sent by a supplier, to be paid by us.”
  4. Add a second category, for example Customer invoice, with its own description.
  5. Leave When no category fits on Exit through "Other".

Each category becomes an output of the node on the canvas, plus an other output. The node uses the instance's default model unless you link a provider node to its Model port. See Categorize.

Step 5 — File the email ​

  1. On the canvas, click the + on the Supplier invoice output of the Categorize node (Connect what follows “Supplier invoice”).
  2. Search for move and click Move.
  3. Under Labels to add, click Add, then in Folder or label, pick a folder or a label from your mailbox's list.

To archive the email at the same time, add INBOX under Labels to remove. See Move.

The other outputs stay unconnected: an email that lands on Customer invoice or other simply ends there.

Prefer a draft reply?

Instead of Move, connect Compose (AI) to an output to have the model write a reply using the recipient's profile, followed by Send with What to do with it set to Save as draft. See Compose (AI) and Send.

Step 6 — Test on a real email ​

A test run plays the draft on a real email from your mailbox, with simulated effects: nothing is moved, sent or written to an outside service.

  1. In the editor toolbar, click Test. The panel on the right switches to test runs.
  2. Click Pick the test email. In Add an email from your mailbox, search for an invoice you received, then click it to keep it.
  3. Make sure it is selected as the active test email, then click Close.
  4. Click Run test.

The draft is saved, then each node lights up on the canvas as it runs. In the panel, each step shows its output port and its data. Actions that were simulated read Would have: … — here, the folder the email would have been filed in.

AI nodes call the model for real during a test run, so the categorisation you see is the one the published workflow would make.

If the test run does not start, the panel lists the blocking errors: click a row to open the node that is missing something. To test only part of the graph, open a node and use Test up to here. See Test runs.

Step 7 — Publish ​

  1. Click Publish in the toolbar.
  2. The Publish the workflow dialog checks the graph. If it is valid, click Publish.

The workflow now shows Published. From now on, each new incoming email that matches the trigger starts one run. Later changes stay in the draft until you publish again. See Versions.

To stop the workflow, click Unpublish.

Step 8 — Follow the runs ​

  1. At the top of the editor, switch from Editor to Runs.
  2. The list shows every run of the workflow, tests included. Filter with Live to see runs triggered by real email.
  3. Click a run to inspect it on the canvas: the path the email took, the data at each step, and the error if one occurred.

To see what happened to every email you received — processed, excluded, or matched by no workflow — open Activity › Received. See Runs and Errors and retries.

Where to go next ​