AI Agents

Automatic email canonical tagging in Gmail using OpenAI and Gmail API

13 nodes 206 155 Automatic trigger
Download

Workflow Description

Automatically tag and categorize incoming Gmail messages using an AI agent powered by OpenAI. The workflow monitors new emails, analyzes content intelligently, and applies relevant labels through Gmail API without manual intervention.

How it works

  1. 1.Trigger activates on new Gmail messages to capture email data in real time
  2. 2.AI agent analyzes email content using OpenAI to determine appropriate category or tag
  3. 3.Apply the identified tag to the email through Gmail API integration
  4. 4.Store classification decisions in memory buffer for continuous learning and context
  5. 5.Wait and repeat for each subsequent email automatically

Use cases

  • Organize emails by type, urgency, or department without manual sorting
  • Separate customer inquiries, vendor communications, and internal messages automatically
  • Reduce email management time by delegating classification to intelligent automation

Requirements

  • Active Gmail account with Gmail API enabled
  • Valid OpenAI API key with sufficient credits
  • n8n workflow connected to both Gmail and OpenAI services

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

Gmail OpenAI AI Agent Memory

Details

Trigger Automatic trigger
Nodes 13
Apps 4
Views 206
Downloads 155

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (13)

/

Gmail Trigger

Gmail

#1

OpenAI Chat Model1

OpenAI

#2

Gmail - read labels

Gmail

#3

Gmail - get message

Gmail

#4

Gmail - add label to message

Gmail

#5

Gmail - create label

Gmail

#6

Gmail labelling agent

Agent

#7

Window Buffer Memory

Memory Buffer Window

#8

Wait

Wait

#9

Sticky Note

Sticky Note

#10

Sticky Note1

Sticky Note

#11

Sticky Note2

Sticky Note

#12

Sticky Note3

Sticky Note

#13