Skip to product information

Gmail AI Email Classifier in n8n: Label New Messages

Gmail AI Email Classifier in n8n: Label New Messages

 (200+Reviews)
Regular price £53.99
Regular price £53.99 Sale price
SAVE Sold out
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
⚡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Gmail AI Email Classifier in n8n: Label New Messages

Gmail AI Email Classifier in n8n: Label New Messages

Regular price £53.99
Regular price £53.99 Sale price
SAVE Sold out

Automatically sort your new Gmail messages with AI (and apply labels in n8n)

The Gmail AI Email Classifier in n8n: Label New Messages workflow watches your inbox, classifies each new email using OpenAI, and then automatically applies the matching Gmail labels—so your team can focus on what matters.

What this workflow does

  • Polls Gmail every minute for new messages using a Gmail Trigger.
  • Normalizes each email (sender, subject, truncated body, and message ID) to prepare content for classification.
  • Sends the email content to OpenAI and expects a strict JSON response including:
    • category
    • priority (optional)
    • short summary
    • whether a reply is needed
    • a short reason
  • Validates and parses the OpenAI output; if the response is invalid, it falls back to the “other” category.
  • Fetches your existing Gmail labels, then maps classified categories (and optional priority) to label IDs using a configured label prefix.
  • Applies the resolved Gmail label(s) to the email only if the expected label exists. If the label is missing, the workflow skips that message.

Use cases

  • Route inbound emails into labels like AI/Urgent, AI/Sales Lead, AI/Support, and AI/Billing.
  • Group newsletter or low-value messages under AI/Newsletter-Spam (when configured).
  • Help SaaS operators and automation engineers keep inbox organization consistent across teams.

Technical details

  • n8n workflow using nodes such as gmail, code, set, if, and sticky note.
  • Gmail OAuth2 credential for reading messages and applying labels.
  • OpenAI credential for AI classification into structured JSON.
  • Configuration includes business name, OpenAI model, optional classification notes, and maximum body length; priority support is optional.

Setup tip: Create the expected Gmail labels (e.g., AI/Urgent, AI/Sales Lead, AI/Support, AI/Billing, AI/Newsletter-Spam, AI/Other) or adjust the prefix/mappings to match your account.

View full details