Templates / Triage and label inbound emails in Gmail or IMAP with rule-based scoring

Triage and label inbound emails in Gmail or IMAP with rule-based scoring

Ready for 3.0

by Scale On Fajar ✓ · 16 views · created 2026-09-26 · Ticket Management

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 30 nodes and runs on Gmail events. Along the way it connects Gmail. It also calls gmail.googleapis.com over HTTP.

How it runs

Trigger: On Gmail events.

  1. Configure Gmail Triage (Code): runs custom JavaScript code
  2. Fetch Full Gmail Message (HTTP Request): calls an HTTP API
  3. Attach Gmail Context (Code): runs custom JavaScript code
  4. Configure Label Rules (Code): runs custom JavaScript code
  5. Normalize Gmail Message (Code): runs custom JavaScript code
  6. Validate Email and Rules (Code): runs custom JavaScript code
  7. Classify with Weighted Rules (Code): runs custom JavaScript code
  8. Protect OTP and Critical Alerts (Code): runs custom JavaScript code
  9. Build Gmail Action Plan (Code): runs custom JavaScript code
  10. Decide Next Action (Switch): routes items into 2 branches

…plus 19 more steps. See the full node list below.

Services it uses

Gmail

HTTP calls to: gmail.googleapis.com

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

  • Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Watch Gmail Messages).

Nodes used (5)

From the author

Quick overview This workflow deterministically classifies inbound emails using local JavaScript rules (no AI) and routes them into high-priority, low-priority bulk, or general inbox actions, producing prepared outputs you can connect to Gmail or IMAP…

Excerpt from Scale On Fajar's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.