← Back to Catherene Baker — Business Automation & Operations Systems for Small Business Owners

<aside> 🔧

An automated system that reads, classifies, and labels incoming emails using AI, built with n8n and Google Gemini.

</aside>

The Problem

Inboxes accumulate a mix of urgent, financial, promotional, and routine emails with no way to quickly tell what needs attention. Manual sorting wastes time, and important emails can get buried.

The Solution

Built an automated triage system that classifies incoming emails by category using AI, validates the classification before acting on it, and automatically applies labels so priority items are visible at a glance.

How It Works

  1. Gmail trigger detects new incoming email
  2. Pre-filter step skips obvious noise (newsletters, no-reply senders) before spending AI calls
  3. AI (Google Gemini) classifies the email into a category and returns structured JSON
  4. A validation step checks the AI's output before trusting it, with a fallback to manual review if parsing fails
  5. A routing step directs each email to the correct label based on category
  6. Every email gets tagged automatically, no manual sorting required

Tech Stack

The Hard Part

One challenge was a routing step that appeared broken. Testing showed no output no matter what I changed. After adding debug fields to inspect the raw data, I found the issue wasn't a bug in the logic at all. I was testing with different emails each time and only checking one output branch, so the workflow was actually working correctly, just routing to different branches than I expected. This reinforced the importance of verifying assumptions with real data before assuming code is broken.

Screenshots