# The Inbox Beast: an n8n workflow sorts the inbox and feeds a beast

> n8n reads demo mails from Nextcloud, sorts them into do, delegate and ignore, and creates Deck cards, a Talk message and a report. Try it live.

Author: Daniele Michelin · Published: 2026-11-13 · Updated: 2026-11-13 · Language: en
Canonical: https://daniele-michelin.com/en/blog/n8n-nextcloud-inbox-beast/

Unanswered mail makes a beast hungry. An n8n workflow reads a demo inbox from Nextcloud, sorts every mail into do, delegate or ignore and creates real Deck cards, a Talk message and a report. A Code node works out how hungry the beast is.

Try it first: [the Inbox Beast](https://daniele-michelin.com/en/inbox-beast/). One click, a few seconds, and the beast is there.

## What you get

- **A beast in five stages:** from egg to kraken, depending on its hunger. It has a mood and comments on the inbox.

- **Three columns:** Do (you must answer yourself), Delegate (someone on the team, by name) and Ignore (newsletters, sales pitches, anything already answered).

- **A report:** three sentences about the state of the mail and one concrete tip.

- **Real entries in Nextcloud:** up to five cards on the demo Deck board, a message in the Talk room and a Markdown file in the Outbox folder.

- **Two dials:** “Answer the most important mails first” and “How long since you looked at the inbox?”. They simulate what would happen without changing anything.

The five stages of the Inbox BeastFive beasts from egg to kraken, each with its hunger range in percent below.EggpurringHunger 0–9 %HatchlingcontentHunger 10–27 %BeasthungryHunger 28–47 %
- Big beastgrumpyHunger 48–69 %KrakenfuriousHunger 70–100 %The five stages, from egg to kraken. Hunger decides the stage.

## The workflow

**Webhook:** receives a colour and two numbers. The page sends nothing else.

- **Fix the demo space:** a Code node defines which mail account and mailbox, which Deck board, which Talk room and which folder may be used. Every URL of the following nodes is checked against it.

- **Three requests in parallel:** the Nextcloud Mail API fetches the messages of the demo mailbox, the Deck API the board, a PROPFIND lists `Outbox/`.

- **Rules first:** fixed rules sort every mail and give it a priority. The workflow therefore still works when the AI is down.

- **AI:** gpt-oss-120b at IONOS corrects the sorting and writes the report, the quote and the tip. Every answer is validated: unknown categories, invented people and answers about mails that are already answered are dropped.

- **Compute hunger:** a Code node, see below.

- **Clean up, then write:** first the workflow deletes its own earlier cards (they carry a marker in the description) and the oldest reports, then it creates the new ones.

- **Result:** posted to a PHP script with the real HTTP status codes of the writes. The page only says “created” when Nextcloud really answered 2xx.

The workflow in six stepsWebhook, three requests, rules and AI, hunger calculation, writing into Nextcloud, result to the page.1 WebhookYour clickcolour + 2 numbers2 Three requestsMail API: inboxDeck: boardPROPFIND: Outbox3 SortRules firstAI correctsanswer validated4 Hungerage × weightstage 1 to 55 Write≤ 5 Deck cards1 Talk message1 report (.md)6 ResultJSON to the pagereal status codesThe path of a request through the workflow.

## How the hunger is calculated

Every unanswered mail counts with a weight: 8 for do, 5 for delegate, 1 for ignore. The weight grows with age by up to a factor of 4 (after seven days), so each mail counts `weight × (1 + age in h / 48)`. The sum `S` is turned into a value between 0 and 100 percent: `hunger = 100 × (1 − e^(−S/150))`. The stages start at 10, 28, 48 and 70 percent.

The demo inbox holds 14 unanswered mails and the oldest client mail is 120 hours old. That gives 69 percent, a “Big beast”. Answer the three most important mails and hunger drops to 56 percent; with six mails it is 38 percent (stage Beast). Leave everything for three more days and it is 84 percent: kraken.

Hunger of the beast in the demo inboxBar chart: hunger in percent when 0 to 6 important mails are answered, and after 1 to 3 extra days of silence.Kraken ≥ 70Big beast ≥ 48Beast ≥ 2869%063%161%256%352%446%538%676%181%284%3mails answereddays of silenceHunger %Real numbers from the demo: hunger when you answer important mails or let the mails sit longer.

## Safety

The workflow runs in a demo space of a real Nextcloud account: its own folder, its own Deck board, its own Talk room, invented data of the fictional Brightside Studio. It reads one dedicated demo mailbox through the Mail API (a guard checks account and address) and writes only to `Outbox/`, to one Deck stack and to one Talk room. The page limits the runs (20 seconds between runs, three per hour and visitor, 100 per day), and the workflow only deletes what it created itself. One limitation: the Talk room keeps its messages, the workflow does not delete them.

## For your own inbox

The demo reads through the Nextcloud Mail API (account id, mailbox id and a guard on the address). For your own inbox enter your ids in the first Code node; alternatively swap the two Mail nodes for IMAP or Gmail and map the fields `id, from_name, from_email, subject, body, age_hours, answered`. The Code node “Read the inbox” needs only those. The rules are keywords for an invented studio: for real mail you have to adapt them, and the AI sorting is a suggestion, not a verdict.

## Build it yourself

[The workflow as JSON](https://daniele-michelin.com/assets/n8n/inbox-beast.json) contains only placeholders for address, user, Talk room and credentials. You need a Nextcloud with Deck and Talk, an app password as a Basic-Auth credential in n8n and an OpenAI-compatible credential for the AI (the workflow also runs without). Enter board id, stack id and room token in the first Code node. You cannot import the file as it is.
