# Intelligent Gmail label management with Discord: n8n workflow

> Started by an arriving email, and works across Discord and Gmail. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/intelligent-gmail-label-management-with-discord (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# Intelligent Gmail label management with Discord

Started by an arriving email, and works across Discord and Gmail. It hands the judgement calls to OpenAI. 22 steps, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fintelligent-gmail-label-management-with-discord)

**22 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**1** Loop or waits

**2** Services it connects to

## The flow

Starts it 1 Model 5 Logic 12 Service 4

The steps in the order they run, from what starts it.

- 1 **Gmail Trigger** Gmail trigger *Starts it*
- 2 **OpenAI Chat 10001** Lm Chat Open Ai *Model*
- 3 **OpenAI Chat 10000** Lm Chat Open Ai *Model*
- 4 **Loop Over Items** Split In Batches *Logic*
- 5 **Basic LLM Chain** Chain Llm *Model*
- 6 **Structured Output Parser** Output Parser Structured *Model*
- 7 **Basic LLM Chain1** Chain Llm *Model*
- 8 **Get many labels** Gmail *Service*
- 9 **Merge labels into list (for llm to pick)** Merge *Logic*
- 10 **Add old_labels []** Set *Logic*
- 11 **Send a message** Discord *Service*
- 12 **Filter** Filter *Logic*
- 13 **Merge2** Merge *Logic*
- 14 **Aggregate1** Aggregate *Logic*
- 15 **Code** Code *Logic*
- 16 **Split Out** Split Out *Logic*
- 17 **Merge3** Merge *Logic*
- 18 **Create a label** Gmail *Service*
- 19 **Edit Fields3** Set *Logic*
- 20 **Merge** Merge *Logic*
- 21 **Aggregate2** Aggregate *Logic*
- 22 **Add label to message** Gmail *Service*

## How it's built

- **Starts on:** An arriving email
- **Steps:** 22, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Discord, Gmail
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Discord and Gmail accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 22 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 22 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fintelligent-gmail-label-management-with-discord)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Discord](https://millionrounds.com/workflows?service=Discord#library)[Gmail](https://millionrounds.com/workflows?service=Gmail#library)

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Analyze contract PDFs and score risk with Claude and Postgres** 22 steps · calls a model · Gmail, Postgres](https://millionrounds.com/workflow/analyze-contract-pdfs-and-score-risk-with-claude-and-postgre)
- [**Automated job intelligence system with Decodo** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automated-job-intelligence-system-with-decodo)
- [**Monitor backup and sync logs with Google Cloud Storage** 22 steps · calls a model · GitHub, Gmail](https://millionrounds.com/workflow/monitor-backup-and-sync-logs-with-google-cloud-storage)
- [**Monitor website uptime and send alerts with Uptime Robot** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/monitor-website-uptime-and-send-alerts-with-uptime-robot)
- [**Track investor behavior with NewsAPI and Gemini** 22 steps · calls a model · Gmail, n8n data table](https://millionrounds.com/workflow/track-investor-behavior-with-newsapi-and-gemini)
- [**Triage data exfiltration volume alerts with Splunk** 22 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/triage-data-exfiltration-volume-alerts-with-splunk)
