# Classify and auto-reply to Gmail with OpenAI: n8n workflow

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

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

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

# Classify and auto-reply to Gmail with OpenAI

Started by an arriving email, and works across Gmail, Google Sheets and Telegram. It hands the judgement calls to OpenAI. 34 steps, 1 branch, 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%2Fclassify-and-auto-reply-to-gmail-with-openai)

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

**1** Branch: places the flow splits

**1** Loop or waits

**3** Services it connects to

## The flow

Starts it 2 Model 5 Logic 2 Service 25

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

- 1 **Gmail Trigger1** Gmail trigger *Starts it*
- 2 **When clicking ‘Execute workflow’** Manual trigger *Starts it*
- 3 **Read_all_Emails** Gmail *Service*
- 4 **FTAI Info** Google Sheets Tool *Service*
- 5 **Email Classifier Agent** Open Ai *Model*
- 6 **Get row(s) in sheet** Google Sheets *Service*
- 7 **Loop Over Items** Split In Batches *Logic*
- 8 **Creating Email1** Open Ai *Model*
- 9 **Switch** Switch *Logic*
- 10 **Send Demo Emails** Gmail *Service*
- 11 **Clean Inbox** Telegram *Service*
- 12 **Delete a message** Gmail *Service*
- 13 **Auto Reply1** Gmail *Service*
- 14 **High Priority1** Gmail *Service*
- 15 **Customer Support1** Gmail *Service*
- 16 **Promotion1** Gmail *Service*
- 17 **Finance/Billing1** Gmail *Service*
- 18 **Mark as Read1** Gmail *Service*
- 19 **Creating Draft1** Open Ai *Model*
- 20 **Promotions** Open Ai *Model*
- 21 **Finance / Billing Dept** Open Ai *Model*
- 22 **Remove From Inbox1** Gmail *Service*
- 23 **Draft1** Gmail *Service*
- 24 **Mark as Read2** Gmail *Service*
- 25 **Send to Finance Dept1** Gmail *Service*
- 26 **Notify (2)1** Telegram *Service*
- 27 **Mark as Read** Gmail *Service*
- 28 **Remove From Inbox2** Gmail *Service*
- 29 **Mark as Read3** Gmail *Service*
- 30 **Remove From Inbox** Gmail *Service*
- 31 **Notify (3)1** Telegram *Service*
- 32 **Remove From Inbox3** Gmail *Service*
- 33 **Notify (1)1** Telegram *Service*
- 34 **Notify (4)1** Telegram *Service*

## How it's built

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

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Sheets and Telegram 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 34 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 34 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%2Fclassify-and-auto-reply-to-gmail-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)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also chat assistants, with the same services where possible, closest in size first.

- [**Assist hospital doctors with Telegram and OpenAI** 34 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/assist-hospital-doctors-with-telegram-and-openai)
- [**Email management system with OpenAI and Pinecone DB** 34 steps · calls a model · Gmail, Pinecone](https://millionrounds.com/workflow/email-management-system-with-openai-and-pinecone-db)
- [**Evaluate job fit and generate application assets** 34 steps · calls a model · Apify, Gmail](https://millionrounds.com/workflow/evaluate-job-fit-and-generate-application-assets)
- [**Manage rent, maintenance and tenant messages with OpenAI** 34 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/manage-rent-maintenance-and-tenant-messages-with-openai)
- [**AI powered RAG chatbot for your docs + Google Drive + Gemini** 35 steps · calls a model · Google Docs, Google Drive](https://millionrounds.com/workflow/ai-powered-rag-chatbot-for-your-docs-google-drive-gemini)
- [**Build a comprehensive multimodal assistant on Telegram** 33 steps · calls a model · Telegram, in-memory vectors](https://millionrounds.com/workflow/build-a-comprehensive-multimodal-assistant-on-telegram)
