Label Gmail inbox emails with GPT-4o and store them in Mem0

Go to Workflow
2 views
Built by Stephan Koning Stephan Koning
Created on May 01, 2026

Description


Who’s it for

This template is for small business owners like contractors, consultants, and agency owners who close deals via email.

How it works

Think of this as a 24/7 personal assistant for your inbox. Every five minutes, the workflow "reads" your new emails. It instantly filters out the junk (like newsletters or internal notifications).

The AI then analyzes the email to figure out what the customer wants. Then automatically puts a label on the email in Gmail (like "Action Required" or "Urgent"). Most importantly, it saves a "memory" of that email.

How to set up

Gmail: Connect your Gmail account using OAuth2 credentials.
AI Models: Add your OpenAI API key to the GPT-4o node.
JigsawStack: Provide API keys for JigsawStack (the optional fallback classifier) and Mem0.ai in the respective HTTP Header Auth credentials.
Domain Filter: In the [Router]: Triage Streams node, update the second rule to match your company's domain (e.g., your-sme-domain.com) to filter out internal emails.

Requirements

n8n version 1.0+
Gmail OAuth2 Credentials
OpenAI API Key
Mem0.ai Account
JigsawStack API Key (Optional but recommended for fallback)

This template as a foundation

You can easily extend it with other worklfows like:

AI Email Drafting:** Automatically generate draft replies based on the "LABELS" powered by Mem0.
Weekly Intelligence Summaries:** Use the Mem0 database to generate a Friday afternoon digest of all deals closed or pending.
Risk Assessment:** Flag emails containing specific liability keywords or "Cold Outreach" for immediate archiving.

Nodes Used (6)

Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
HTTP Request
n8n-nodes-base.httpRequest
Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor
Mistral Cloud Chat Model
@n8n/n8n-nodes-langchain.lmChatMistralCloud
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi