A workflow that automatically classifies incoming emails, applies the matching label, and immediately alerts you when something is urgent.
automatinganalyticalstructuring
Description
A full inbox is one of the most reliable time sinks in a manager's day. The Inbox Router takes over this first sorting step: it reads every new email, assigns it to one of four categories, and automatically applies the matching label in the email tool. This removes the sorting decision from every single message and creates room to process the inbox in batches instead of continuously.
What gets automated is the classification, the label assignment, and the notification for anything urgent: every message is evaluated by sender, subject, and content, and sorted into Urgent, Follow-up, Info, or Spam, tagged with the matching label in the inbox. Messages classified as Urgent additionally trigger an immediate notification, for example in Slack, Teams, or by email, so time-critical customer requests and escalations do not go unnoticed until the next time you check the inbox.
So the workflow does not stay a black box, the router makes visible which tool calls run in the background: fetching new emails, the classification call to the language model, setting the label through the email tool API, and triggering the notification for anything urgent. Anyone who wants to understand how an agent works day to day sees every single step here, not just the final result.
Automatic categorization: Every email lands in Urgent, Follow-up, Info, or Spam based on the same criteria.
Immediate alert on Urgent: Time-critical messages trigger a notification right away, instead of surfacing only the next time you check the inbox.
Consistent triage: Every message is evaluated by the same rules, regardless of workload or how the day is going.
Steps
Every step shows who carries it out: icon, colour and label together indicate whether a person acts, whether it runs automatically, whether a result is produced, or whether an approval is required.
01 · Person
The workflow starts hourly or immediately, as soon as a new email arrives.
02 · Automated
A call to the language model assigns the email to one of four categories based on sender, subject, content, and work context: Urgent, Follow-up, Info, or Spam, with a short rationale.
03 · Automated
The matching label is applied through the email tool's API, visible directly in the inbox.
04 · Automated
Messages classified as Urgent additionally trigger a notification, for example in Slack, Teams, or by email.
05 · Result
An optional daily report summarizes the day: statistics by category, the three most urgent emails, and a recommendation.
Key
PersonAutomatedResultApproval
Requirements and operations
Requirements
Email tool with labelingGmail, Outlook, or a comparable tool, with write access.
Notification toolSlack, Teams, Discord, or email for the Urgent alert.
LLM accessAn API key for OpenAI, Claude, or Gemini.
Labels in the email toolUrgent, Info, Spam, and Follow-up set up in advance.
Testing
Send test emailsSend three to four emails covering all categories (Urgent, Info, Follow-up, Spam) to yourself.
Check labelsVerify that every email received the matching label.
Check the alertVerify that a notification was triggered on Urgent.
Check the reportVerify that the statistics and the three most urgent emails in the daily report are correct.
Go-live
Approval to startActivate the workflow only once every test case runs cleanly.
Review modeLet the workflow run for one to two weeks and review the classifications before switching it on without oversight.
Sharpen the contextAdd senders and typical topics to the prompt, the more precise the work context, the more accurate the classification.
ExpandExtend the workflow as needed with a spam auto-archive, reply drafts, or automatic CRM tasks.
Common issues
Work context too genericAdd senders and typical topics to the prompt, otherwise misclassifications pile up.
Labels missing in the email toolCreate the four labels in advance, before activating the workflow.
No write accessCheck the integration's permissions to the email tool.
Alert does not arriveCheck the webhook URL or channel ID of the notification tool.
Builder Prompt
Copy the prompt below in full into your automation tool or agent builder. As a file: posteingang-route.en.json
GOAL
Build a workflow that automatically sorts incoming emails via AI into one of four categories, Urgent, Follow-up, Info, or Spam, applies the matching label in the email tool, sends an immediate notification when something is Urgent, and optionally dispatches a daily short report.
Adapt the structure to the concepts of your automation tool, for example nodes, steps, zaps, or agent actions. While doing so, preserve the trigger logic, the sequence, the parallelism, and the data flow.
TRIGGER
Type: a new incoming email, for example in Gmail or Outlook. Alternatively, scheduled hourly as a batch over all new emails since the last run.
Filter: only the desired inbox or label, for example the main inbox. Emails already categorized are skipped.
STEPS
1. Extract email data: sender, subject, content, and date received.
2. AI step: classification. Use the classification prompt below exactly. The output is JSON with the fields category, rationale, and priority. After this, step 3 and step 4 run in parallel.
3. Set label: the JSON field category is mapped to the label of the same name in the email tool, Urgent, Follow-up, Info, or Spam. The four labels must already exist in the tool.
4. Condition: only when category equals Urgent, a notification is triggered in Slack, Teams, or by email, with sender, subject, and rationale.
5. Output, optional: a daily inbox report. Use the summary prompt below exactly, over all emails categorized that day. Delivery by email or Slack.
PROMPTS, COPY EXACTLY AND UNCHANGED
Classification prompt:
"""
You are an email triage assistant. Address the user in a professional manner throughout. Analyze the following email and assign it to exactly one of the following categories. If information relevant to the classification is missing, mark your assessment as an assumption rather than presenting it as certain.
Email details:
Sender: [SENDER]
Subject: [SUBJECT]
Content: [EMAIL_CONTENT]
Received on: [DATE_RECEIVED]
Categories:
1. Urgent: time-critical requests, escalations, important customer communication, urgent appointments
2. Follow-up: emails that require a response or action but are not time-critical
3. Info: newsletters, notifications, FYI emails with no action required
4. Spam: advertising, unwanted emails, newsletters from unknown senders
Context of your work:
[WORK_CONTEXT]
Output format, JSON only:
{
"category": "Urgent|Follow-up|Info|Spam",
"rationale": "Short rationale in 1 sentence",
"priority": "high|medium|low"
}
"""
Summary prompt:
"""
Create a concise summary of the email triage results, addressing the user in a professional manner throughout.
Categorized emails:
[EMAIL_LIST]
Statistics:
Total: [TOTAL_COUNT]
Urgent: [URGENT_COUNT]
Follow-up: [FOLLOWUP_COUNT]
Info: [INFO_COUNT]
Spam: [SPAM_COUNT]
Output format:
Create a structured summary with:
1. Heading "Email triage [DATE/TIME]"
2. Statistics overview
3. The three most urgent emails with sender and subject
4. A recommendation on which emails to handle first
Keep the summary to a maximum of 200 words.
"""
DATA FLOW
Step 1 to step 2: [SENDER], [SUBJECT], [EMAIL_CONTENT], [DATE_RECEIVED].
Step 2 to step 3 and 4: the JSON fields category, rationale, and priority.
Daily run to step 5: [EMAIL_LIST], [TOTAL_COUNT], [URGENT_COUNT], [FOLLOWUP_COUNT], [INFO_COUNT], [SPAM_COUNT].
ERROR HANDLING
AI returns no valid JSON: retry once, then set the default category Follow-up and log the error.
Label does not exist: log the error, do not abort the workflow. Create the labels in advance.
Notification fails: check the webhook URL or channel ID, log the error.
No write access in the email tool: report it as an open configuration item.
PLACEHOLDER CONVENTION
All placeholders in square brackets are variables. Map them dynamically to data from previous steps, as described in the data flow. Exception: [WORK_CONTEXT] is not dynamic. Set it manually before activation, with role, topics, and important senders. List such manual placeholders separately at the end.
SELF CHECK BEFORE COMPLETION
Check, before you report the workflow as finished:
1. Are all steps connected correctly, including the parallelism of step 3 and 4 and the Urgent condition?
2. Are both prompts inserted completely and unchanged, and are all placeholders mapped?
3. Is the JSON output from step 2 parsed correctly, with category, rationale, and priority?
4. Are all points listed that require manual configuration: inbox connection, LLM API key, channel ID, the four labels, and [WORK_CONTEXT]?
Working prompts
Prompt for email categorization
Assigns a single email to one of the four categories based on sender, subject, and content.
You are an email triage assistant. Address the user in a professional manner throughout. Analyze the following email and assign it to exactly one of the following categories. If information relevant to the classification is missing, mark your assessment as an assumption rather than presenting it as certain.
Email details:
Sender: [SENDER]
Subject: [SUBJECT]
Content: [EMAIL_CONTENT]
Received on: [DATE_RECEIVED]
Categories:
1. Urgent: time-critical requests, escalations, important customer communication, urgent appointments
2. Follow-up: emails that require a response or action but are not time-critical
3. Info: newsletters, notifications, FYI emails with no action required
4. Spam: advertising, unwanted emails, newsletters from unknown senders
Context of your work:
[WORK_CONTEXT]
Output format, JSON only:
{
"category": "Urgent|Follow-up|Info|Spam",
"rationale": "Short rationale in 1 sentence",
"priority": "high|medium|low"
}
Prompt for the inbox summary
Summarizes the emails categorized on a given day into a short report.
Create a concise summary of the email triage results, addressing the user in a professional manner throughout.
Categorized emails:
[EMAIL_LIST]
Statistics:
Total: [TOTAL_COUNT]
Urgent: [URGENT_COUNT]
Follow-up: [FOLLOWUP_COUNT]
Info: [INFO_COUNT]
Spam: [SPAM_COUNT]
Output format:
Create a structured summary with:
1. Heading "Email triage [DATE/TIME]"
2. Statistics overview
3. The three most urgent emails with sender and subject
4. A recommendation on which emails to handle first
Keep the summary to a maximum of 200 words.
JSON export
Setup
Two routes lead to the same result. Pick the one that fits your setup.
Suitable when you want to build the workflow in your own automation tool.
Open your workflow tool, for example n8n, Make, Zapier or Langdock.
Create a new workflow and give it a name.
Choose the AI-assisted build option if your tool offers one.
Paste the builder prompt from above in full.
Check the result against the step sequence in this document, then add your access credentials and channels.
Suitable when you want to take the workflow over unchanged.
Download the JSON file from the JSON export section.
Open the workflow area of your tool and create a new workflow.
Give it a name and confirm.
Open the menu on the workflow name and choose to import a JSON file.
Upload the file, then add your own access credentials.
Run a test before you activate the workflow.
Last reviewed:
In the workshop this becomes your method.
A single prompt becomes a repeatable method. We show that in the workshop From Prompt to Method.