Triage emails and build a morning digest with a local Ollama LLM

Quick overview This workflow triages emails with a local Ollama LLM (gemma4:e4b), flags urgent messages for immediate alerting, and compiles a morning digest grouped by urgency categories.

How it works Runs manually and generates a sample set of incoming emails. Sends each email to Ollama (gemma4:e4b) with a prompt that classifies it as URGENT, REPLY_TODAY, FYI, or JUNK and returns structured JSON. Parses the LLM output into JSON and falls back to a safe default classification if the response is malformed. Separates emails marked URGENT and formats an urgent alert message for each one. Aggregates all classified emails into a single morning digest text grouped by category with suggested actions and totals. If the workflow errors, captures the failure details and outputs a structured error record.

Setup Set up an Ollama API credential in n8n that points to your Ollama server (for example, http://host.docker.internal:11434). Ensure the specified Ollama model (gemma4:e4b) is available locally, or update the model name in the Ollama Chat Model configuration. Replace the sample email generator with your real email source (for example, Gmail or Microsoft Outlook) and add a delivery step for urgent alerts and the digest (for example, Slack or email).

Requirements n8n 1.19.4 or later (LangChain nodes required) Ollama running locally with a chat model (tested with gemma4:e4b)

Customization Edit the classification prompt in the Classify Email node to add or change urgency categories Swap the Ollama Chat Model for OpenAI or Anthropic by replacing the LLM sub-node Connect Slack, Telegram, or email after the Format Urgent Alert node for instant notifications

0
Downloads
0
Views
8.52
Quality Score
beginner
Complexity
Author:Salahuddin Uqaili(View Original →)
Created:6/4/2026
Updated:7/3/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments