Developer & DevOps

Connect Gmail with OpenAI

23 nodes 200 118 Scheduled trigger
Download

Workflow Description

A scheduled automation that retrieves Gmail messages and processes them through OpenAI in batches, with efficient handling of large volumes and organized result storage for developer workflows.

How it works

  1. 1.Schedule the automation to run at specified intervals
  2. 2.Fetch and filter emails from Gmail inbox
  3. 3.Divide messages into batches for efficient processing
  4. 4.Send each batch to OpenAI for intelligent analysis
  5. 5.Store and organize processed results in system variables

Use cases

  • Automated analysis of incoming emails to extract insights and key information
  • Batch processing of hundreds of messages while respecting API rate limits
  • Intelligent email classification or smart reply generation at scale

Requirements

  • Active Gmail account with API access enabled
  • Valid OpenAI API key with appropriate permissions
  • Configured schedule frequency for automation triggers

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 200
Downloads 118

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