Developer & DevOps

Process Gmail Messages with OpenAI Analysis

23 nodes 285 156 Scheduled trigger
Download

Workflow Description

A scheduled automation that retrieves Gmail messages periodically, sends each message content to OpenAI for analysis or summarization, and processes emails in batches to optimize performance and stay within API limits.

How it works

  1. 1.Set up a recurring schedule to trigger the automation at specified intervals
  2. 2.Fetch emails from Gmail based on defined criteria and filters
  3. 3.Split messages into manageable batches using Split In Batches node
  4. 4.Send each message content to OpenAI API for intelligent analysis or summarization
  5. 5.Apply rate limiting to prevent exceeding API quotas and usage restrictions
  6. 6.Store or forward processed results to your designated destinations

Use cases

  • Automatically summarize important work emails to reduce review time
  • Classify incoming messages by topic or urgency using AI categorization
  • Extract key information from customer emails and create action items
  • Generate smart replies to common inquiries while maintaining personal context

Requirements

  • Active Gmail account with message access permissions
  • Valid OpenAI API key with sufficient quota
  • Clear understanding of email formats and content to be processed
  • Awareness of API rate limits and associated costs per request

Service Value

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

Apps Used

Gmail OpenAI Split In Batches

Details

Trigger Scheduled trigger
Nodes 23
Apps 3
Views 285
Downloads 156

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 (23)

/

Sticky Note

Sticky Note

#1

Sticky Note2

Sticky Note

#2

Sticky Note1

Sticky Note

#3

Sticky Note4

Sticky Note

#4

Sticky Note5

Sticky Note

#5

Sticky Note7

Sticky Note

#6

Sticky Note8

Sticky Note

#7

Sticky Note9

Sticky Note

#8

Sticky Note10

Sticky Note

#9

Sticky Note11

Sticky Note

#10

Remove AI label from email

Gmail

#11

Add email draft to thread

HTTP Request

#12

Convert raw to base64

Code

#13

Build email raw

Set

#14

Convert response to HTML

Markdown

#15

Map fields for further processing

Set

#16

Ask OpenAI Assistant

OpenAI

#17

Get single message content

Gmail

#18

Return last message in thread

Limit

#19

Get thread messages

Gmail

#20

Loop over threads

Split In Batches

#21

Get threads with specific labels

Gmail

#22

Schedule trigger (1 min)

Schedule Trigger

#23