Skip to main content

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

Workflow preview

Workflow preview
100%
Label Gmail inbox emails with GPT-4o and store them in Mem0 preview
Open on n8n.io

1. Workflow Overview

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 ...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.gmailtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.filter, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.lmchatmistralcloud, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Stephan Koning.

Original n8n.io source

1.1 Workflow description

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

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

  1. Gmail: Connect your Gmail account using OAuth2 credentials.
  2. AI Models: Add your OpenAI API key to the GPT-4o node.
  3. JigsawStack: Provide API keys for JigsawStack (the optional fallback classifier) and Mem0.ai in the respective HTTP Header Auth credentials.
  4. 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.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Manual Trigger

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - [Trigger]: Watch Inbox (5m)

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.3

Block 3 - [Batch]: Process Emails

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 4 - [Filter]: Needs Marketing Tag?

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 5 - [Gmail]: Tag as Marketing

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - [LLM]: GPT-4o

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 7 - [LLM]: Mistral

Type / Role
@n8n/n8n-nodes-langchain.lmChatMistralCloud - lmChatMistralCloud
Config choices
Version 1

Block 8 - [API]: Jigsaw Classification

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 9 - [Gmail]: Apply AI Category

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 10 - [Gmail]: Apply Jigsaw Category

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 11 - [Set]: Finalize Payload Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - [Python]: Format Mem0 V2 Schema

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - [API]: Push to Mem0 Long-term

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - [JS]: Sanitize & Detect Marketing

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - [Router]: Triage Streams

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.4

Block 17 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - [AI]: Main Branch Extractor

Type / Role
@n8n/n8n-nodes-langchain.informationExtractor - informationExtractor
Config choices
Version 1.2

Block 19 - [AI]: Internal Branch Extractor

Type / Role
@n8n/n8n-nodes-langchain.informationExtractor - informationExtractor
Config choices
Version 1.2

Block 20 - [Gmail]: Tag Domain (Always runs first. Tags it as "Agentive Concepts")

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 21 - [Gmail]: Apply category for branch

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 22 - End

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 23 - Optional Branch

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 24 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 32 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Label Gmail inbox emails with GPT-4o and store them in Mem0
Complexity advanced
Nodes 32
Categories Ticket Management, AI Summarization
Author Stephan Koning
Published 19 Jan 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12826/12826.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Label Gmail inbox emails with GPT-4o and store them in Mem0 do?

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 ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.