AutomationMart
Home/Browse/Basic automatic Gmail email labelling with OpenAI and Gmail API
n8n

Basic automatic Gmail email labelling with OpenAI and Gmail API

n8nn8n9 modulesv1.0
GmailOpenAI

Description This workflow automates email categorization in Gmail using the Gmail API and OpenAI's language model. It periodically checks for new emails, reads their content, and categorizes them based on existing Gmail labels. If no matching label is found, the workflow creates a new label and assigns it to the email. Key Features - Polling for Emails: The workflow triggers every 5 minutes to check for new emails using the Gmail Trigger node. - Reading Labels: Existing Gmail labels are fetched

At a glance

Basic automatic Gmail email labelling with OpenAI and Gmail API is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects Gmail, OpenAI. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
Gmail, OpenAI
Modules
9
Price
Free
Version
v1.0
Basic automatic Gmail email labelling with OpenAI and Gmail API workflow diagram

About this workflow

Description This workflow automates email categorization in Gmail using the Gmail API and OpenAI's language model. It periodically checks for new emails, reads their content, and categorizes them based on existing Gmail labels. If no matching label is found, the workflow creates a new label and assigns it to the email. Key Features - Polling for Emails: The workflow triggers every 5 minutes to check for new emails using the Gmail Trigger node. - Reading Labels: Existing Gmail labels are fetched to determine the most relevant match for email categorization. - Dynamic Labeling: If no existing label matches, a new label is created dynamically based on the email's content. - OpenAI Integration: The workflow uses OpenAI's Chat model to analyze email content and suggest or create appropriate labels. - Email Categorization: Labels are applied to emails, ensuring they are organized in Gmail's structure. The workflow also removes less relevant emails (e.g., ads) from the inbox. Nodes in Use 1. Gmail Trigger: Polls Gmail every 5 minutes for new emails. 2. Gmail - Read Labels: Fetches all existing Gmail labels. 3. Gmail - Get Message: Retrieves the full content of a specific email. 4. Gmail - Add Label to Message: Assigns a chosen label to the email. 5. Gmail - Create Label: Creates a new label if necessary. 6. OpenAI Chat Model: Analyzes email content for categorization. 7. Memory Buffer: Retains context for email analysis across multiple iterations. 8. Wait Node: Adds a buffer period to manage email processing. Prerequisites - Gmail API Setup: Ensure Gmail OAuth2 credentials are configured in n8n. - OpenAI API Key: Configure OpenAI credentials for email analysis. - Labeling Standards: Maintain a consistent Gmail label structure for better organization. Instructions 1. Add your Gmail API credentials to the Gmail nodes. 2. Add your OpenAI API credentials to the OpenAI Chat Model node. 3. Activate the workflow. It will start polling for new emails every 5 minutes. 4. Monitor and refine the categorization logic if necessary to ensure alignment with Gmail's organizational needs. Use Case Ideal for individuals or teams handling high email volumes who want to maintain an organized inbox and automate repetitive categorization tasks. Note: You can improve the prompt to get better results from the agent by giving it more personal rules on how to categorize.

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 5

    Click Execute Workflow to test, then activate.

Setup guide

Setup guide included

Purchase to unlock the full step-by-step guide

Related N8n workflows

Save Gmail emails and attachments to Google Sheets and Google Drive

Use this template to save a Gmail message to your Google Sheets spreadsheet as a new row and its attachments to Google Drive.

Free

Send automated emails based on custom webhook triggers and ChatGPT completions

Trigger automated emails using custom webhooks and ChatGPT completions. Connect Custom Webhook, OpenAI and email modules for dynamic communication solutions.

Free

Automate video uploads to YouTube and generate content with ChatGPT

Automate video uploads to YouTube by generating engaging content with ChatGPT. Retrieve files from Dropbox and repeat tasks effortlessly.

Free

Send Slack messages for new Gmail emails matching specified criteria

Every time you receive a Gmail email matching specified criteria Make will automatically post it on Slack.

Free

Automate patient journey with GPT-4, Twilio & Slack notifications

How It Works ⚙️ This workflow is a comprehensive, AI-powered system that acts as a virtual patient assistant for clinics. It automates the entire patient journey from appointment confirmation to post-procedure follow-up. 1. Appointment Trigger: The workflow starts when a new event is created in your Google Calendar for a patient appointment. 2. AI-Powered Education: The new appointment is sent to an OpenAI (GPT-4) node, which acts as a virtual clinic assistant. It instantly generates a personali

Free

🎨 AI design team - generate and review AI images with Ideogram and OpenAI

AI Graphic Design Team - Generate and Review AI Images with Ideogram and OpenAI Description Who is this for? This workflow is perfect for graphic designers, creative agencies, marketing teams, or freelancers who regularly use AI-generated images in their projects. It's specifically beneficial for teams that want to automate the generation, review, and management of AI-created graphics efficiently. What problem does this workflow solve? Design teams often face time-consuming manual reviews and in

Free

Enrich HubSpot companies with Polish CEIDG data using NIP identifiers

This workflow automatically enriches HubSpot company records with official data from the Polish CEIDG (Central Register and Information on Economic Activity) database when a NIP (Polish Tax ID) is added or updated. Who's it for Polish sales teams, marketing agencies, and CRM administrators who work with Polish companies in HubSpot and want to save time on manual data entry while ensuring data accuracy. How it works 1. Trigger: Monitors HubSpot for changes to the "NIP" property on c

Free

Create your first AI agent

Who is this for? This workflow is designed for anyone who wants to automate AI-driven chat responses integrated with Google Docs and Google Sheets, using the Google Gemini (PaLM) language model via n8n. It’s perfect for teams looking to: - Automatically generate AI replies to chat messages, - Pull content dynamically from Google Docs, What this Workflow Does - Receives chat messages via a webhook trigger. - Sends the chat input to the Google Gemini AI Chat Model for generating replies. - Optiona

Free

Reviews

No reviews yet

Be the first to buy and share your experience.

Leave a review

Sign in to share your experience with this workflow.

Log in to review
Free
No ratings yet

Create a free account to purchase workflows.

  • JSON blueprint — instant download
  • Setup guide PDF included
  • 5 downloads · valid 30 days
  • Works with n8n

Need help setting this up?

Book a 3-hour live setup session with an Agility consultant.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free