# Sort Gmail leads, meetings, and trash with OpenAI: n8n workflow

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

Source: https://millionrounds.com/workflow/sort-gmail-leads-meetings-and-trash-with-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Lead generation](https://millionrounds.com/workflows?category=Lead+generation#library)

# Sort Gmail leads, meetings, and trash with OpenAI

Started by an arriving email, and works across Gmail. It hands the judgement calls to OpenAI. 16 steps, 2 branches, 1 loop or waits: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsort-gmail-leads-meetings-and-trash-with-openai)

**16 steps** Medium: a working afternoon

**2** Branches: places the flow splits

**1** Loop or waits

**1** Service it connects to

## The flow

Starts it 1 Model 1 Logic 7 Service 7

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

- 1 **When Email Received1** Gmail trigger *Starts it*
- 2 **Fetch Full Email Message1** Gmail *Service*
- 3 **Execute Pre-Classify Rules1** Code *Logic*
- 4 **Route by Pre-Classification1** Switch *Logic*
- 5 **Label as Team1** Gmail *Service*
- 6 **Skip Processing1** No Op *Logic*
- 7 **Label as Meetings1** Gmail *Service*
- 8 **OpenAI Lead/Trash Classifier1** Open Ai *Model*
- 9 **Calculate Deletion Time1** Code *Logic*
- 10 **Parse Classification Result1** Code *Logic*
- 11 **Label Pending Deletion1** Gmail *Service*
- 12 **Route by LLM Classification1** Switch *Logic*
- 13 **Wait for Deletion Time1** Wait *Logic*
- 14 **Label as Leads1** Gmail *Service*
- 15 **Label for Review1** Gmail *Service*
- 16 **Trash Email Thread1** Gmail *Service*

## How it's built

- **Starts on:** An arriving email
- **Steps:** 16, with 2 branches, 1 loop or waits
- **Size:** Medium: a working afternoon
- **Connects to:** Gmail
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail account, 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?

Plan an afternoon. 16 steps is enough that you should read each one before running it.

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 16 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%2Fsort-gmail-leads-meetings-and-trash-with-openai)
- **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.

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

## Workflows like it

Also lead generation, with the same services where possible, closest in size first.

- [**AI-powered multi-channel lead outreach with JotForm and Gemini** 16 steps · calls a model · Gmail, n8n data table](https://millionrounds.com/workflow/ai-powered-multi-channel-lead-outreach-with-jotform-and-gemi)
- [**Automate lead meeting scheduling with Zoho CRM** 16 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/automate-lead-meeting-scheduling-with-zoho-crm)
- [**Generate personalized cold emails with Anthropic** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/generate-personalized-cold-emails-with-anthropic)
- [**Qualify & route leads across channels with OpenAI and Slack** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/qualify-and-route-leads-across-channels-with-openai-and-slac)
- [**Qualify webhook leads with OpenAI** 16 steps · calls a model · Asana, Gmail](https://millionrounds.com/workflow/qualify-webhook-leads-with-openai)
- [**Qualify, route, and reply to agency leads with OpenAI** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/qualify-route-and-reply-to-agency-leads-with-openai)
