Mindket

Label new Gmail emails by topic with OpenAI

Newversion 1 · updated

Overview

An n8n workflow that labels each new Gmail email by topic. An OpenAI model picks any of three labels from your list, and the workflow adds the matching labels in Gmail.

Label new Gmail emails by topic with OpenAI is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there and switch it on
  • Your own n8n server: the same file and steps
  • Other topics: change the label names in the prompt, the JSON schema and Gmail
  • Only some mail: add a Search filter to the trigger so that only some emails are labelled

Platform

Connects 2 apps

How it works

Trigger

New email in Gmail

It checks Gmail every minute and runs for each new email, with nothing for you to fill in:

  • No input from you: it reads each new email as it arrives

Actions

  1. The Gmail trigger finds a new email, and Get message content reads its text
  2. A Basic LLM Chain (OpenAI gpt-6-luna) picks one or more of three labels: Partnership, Inquiry and Notification
  3. Gmail returns your label list, and the chosen names are matched to their ids
  4. Add labels to message puts those labels on the email

Result

The new email carries the labels the AI chose, in your Gmail account

Integrations

What you need before you start.

Gmail

Email

Reads each new email and your label list, then adds the chosen labels.

NeedsA Gmail OAuth2 credential and three labels named Partnership, Inquiry and Notification

OpenAI

Language model

Reads the email and picks the labels that fit, on gpt-6-luna.

NeedsAn OpenAI API key

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
9 steps, starting on a Gmail event
AI
1 step calls an AI model: Assign labels for message
Sign-ins
Signs in to: Gmail and OpenAI
API keys
No API key is left in the file
Step types
Mindket’s checker reads 6 of its 7 step types. It does not read: Gmail

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow puts labels on new Gmail emails by topic. Each time an email arrives, an OpenAI model reads it and picks any of three labels, which are Partnership, Inquiry and Notification. The workflow then adds the matching labels in Gmail. Eleven nodes do the work, beside eight sticky notes.

Who it suits

Small businesses and creators whose inbox mixes partner offers, customer questions and automatic notices. Skip it if you want the AI to reply or to archive mail, since it only adds labels.

Who uses it, and how
IndustryWho uses itHow they use itExample
CreatorsNewsletter writersSpot sponsorship offers among general mailA writer sees a sponsorship email labelled Partnership as soon as it arrives.
RetailShop ownersSeparate product questions from the restAn owner finds a pricing question labelled Inquiry and answers it first.
AgenciesAccount managersKeep automatic notices out of the wayA manager sees a delivery notice labelled Notification and leaves it for later.
SupportSmall support teamsRoute mail by topic with Gmail filtersA team builds a Gmail filter on the Inquiry label to forward questions.

You need a little n8n: import a file, add two credentials and create three labels in Gmail.

Where to use it

Any n8n that can reach Gmail and OpenAI will run it. It works on mail as it arrives, so you do not need to open n8n.

  • n8n Cloud: import the file into a new workflow there and switch it on
  • Your own n8n server: the same file and steps
  • Other topics: change the label names in the prompt, the JSON schema and Gmail
  • Only some mail: add a Search filter to the trigger so that only some emails are labelled

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Create the three labels in Gmail before you switch the workflow on.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
GmailA Gmail OAuth2 credential and three labels named Partnership, Inquiry and Notification
OpenAIAn API key, for an OpenAI credential
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. In Gmail, create the labels Partnership, Inquiry and Notification.
  3. Add a Gmail credential and select it in Gmail trigger, Get message content, Get all labels and Add labels to message.
  4. Add an OpenAI credential and select it in OpenAI Chat.
  5. On Gmail trigger, change the polling interval if once a minute is too often.
  6. Switch the workflow on, then send yourself a test email.

How to use it

Once it is on, new email is labelled as it arrives. Open Gmail and look for the labels on the new message. One email can get more than one label, and an email that fits none gets no label.

What to change for a different result
To changeWhere
The labelsThe names in the prompt of Assign labels for message, the list in JSON Parser and the labels in Gmail
What each label meansThe prompt of Assign labels for message
How often it checksPoll Times in Gmail trigger
Which mail it checksFilters in Gmail trigger
The modelModel in OpenAI Chat

Example

A shop owner gets an email that asks about bulk prices and mentions a joint promotion. The model reads the text and answers with the labels Inquiry and Partnership.

Gmail returns the list of your labels, the workflow keeps the two ids that match those names, and both labels appear on the email.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. This one reads an email, asks OpenAI for labels and writes them back. A Gmail label is a tag you can filter on, and one email can carry several.

For experts. The JSON Parser holds a schema that allows only the three label names, and the OpenAI model answers in JSON mode. The Merge corresponding labels node joins your Gmail label list to the chosen names. Unknown names are dropped.

Where to look closer
NodeWhat it doesWhat to know
Gmail triggerGmail Trigger 1, simple output off, polls every minuteIt has no filters, so every new email counts
Get message contentGmail 2.1, Get, full messageIt gives the chain the plain text of the email
Assign labels for messageBasic LLM Chain 1.3 with one instruction messageIt returns an object with a list of labels
JSON ParserStructured Output Parser 1The schema allows only Inquiry, Partnership and Notification
Set label valuesSet 3.2, one array fieldIt keeps the label names as an array
Merge corresponding labelsMerge 2.1, combine by nameIt matches Gmail label names to the chosen names and keeps the Gmail data
Aggregate label IDsAggregate 1It gathers the ids into one list
Add labels to messageGmail 2.1, Add LabelsIt uses the email id from the trigger

Good to know

The original named a model that has been retired, and it still needs your own labels.

  • Models: OpenAI’s deprecations page, read on 12 November 2026, lists gpt-4-turbo and gpt-4-1106-preview as shut down on 23 October 2026, with gpt-5.6-sol as the replacement. The original used gpt-4-turbo-preview, so Mindket’s copy uses gpt-6-luna, which is enough for a three-label sort and costs less than gpt-5.6-sol. The model page does not mention temperature, so the original’s temperature of 0 is left out
  • Labels must match: use the same names in Gmail, in the prompt and in the JSON schema, because a name that is missing in Gmail is dropped without a warning
  • Every new email counts: the trigger has no filter, so each email, newsletters included, goes to OpenAI
  • Polling: the trigger checks Gmail once a minute
  • Billing: every email uses one OpenAI call
  • Your data: the text of each email goes to OpenAI
  • Credentials: the JSON holds none, so add the Gmail and OpenAI credentials yourself

README and files

README

Label new Gmail emails by topic with OpenAI

An n8n workflow that puts labels on new Gmail emails by topic. Each time an email arrives, an OpenAI model reads it and picks any of
three labels. The workflow then adds those labels in Gmail.

What is inside

  • workflow.json: the workflow as n8n exports it, eleven working nodes and eight sticky notes. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The original named gpt-4-turbo-preview, a model that has been retired. Mindket's copy uses gpt-6-luna in OpenAI Chat and
    leaves out the temperature of 0. See Good to know.
  • The sticky note that pointed readers to its author's video, channel and newsletter was replaced by a short list of setup steps.
  • The label names, the prompt, the schema and the Gmail steps are as the original has them.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • A Gmail account and an OAuth2 credential for it.
  • Three Gmail labels named Partnership, Inquiry and Notification.
  • An OpenAI API key.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. In Gmail, create the labels Partnership, Inquiry and Notification.
  3. Add a Gmail credential and select it in Gmail trigger, Get message content, Get all labels and Add labels to message.
  4. Add an OpenAI credential and select it in OpenAI Chat.
  5. On Gmail trigger, change the polling interval if once a minute is too often.
  6. Switch the workflow on, then send yourself a test email.

How a run goes

  1. Gmail trigger finds a new email, and Get message content reads its text.
  2. Assign labels for message asks the OpenAI model which of the three labels fit, and JSON Parser checks the answer.
  3. Set label values keeps the chosen names as a list.
  4. Get all labels lists your Gmail labels, and Split out assigned labels turns the chosen names into items.
  5. Merge corresponding labels matches names to Gmail labels, and Aggregate label IDs gathers their ids.
  6. Add labels to message puts those labels on the email.

Change the look

  • The labels: the prompt in Assign labels for message, the list in JSON Parser and the labels in Gmail.
  • What each label means: the prompt in Assign labels for message.
  • How often it checks: Poll Times in Gmail trigger.
  • Which mail it checks: Filters in Gmail trigger.
  • The model: Model in OpenAI Chat.

Good to know

  • OpenAI's deprecations page, read on 12 November 2026, lists gpt-4-turbo and gpt-4-1106-preview as shut down on 23 October
    2026, with gpt-5.6-sol as the replacement. Mindket's copy uses gpt-6-luna, which is enough for a three-label sort. The model
    page does not mention temperature, so the original's temperature of 0 is left out.
  • Use the same label names in Gmail, in the prompt and in the JSON schema. A name that is missing in Gmail is dropped.
  • The trigger has no filter, so every new email goes to OpenAI.
  • The trigger checks Gmail once a minute, and every email uses one OpenAI call.
  • The text of each email goes to OpenAI.
Files
NOTICE.md  637 B
README.md  3 KB
workflow.json  11 KB

3 files, 15 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Productivity

See all in Productivity

Frontend Slides

zarazhangrui · Skill

Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…

New32.3k

IPTV

iptv-org · Kit

Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…

New144k

upscaler

uwg · Kit

Holds a set of image upscaling models gathered from the OpenModelDB community, for people who want to enlarge low-resolution pictures with AI on their own comp…

New