▶ Stepthrough Courses All tutorials Blog Glossary Prompts Videos Visual guides Cheat sheets Comparisons Start Learning Free

Gmail AI Triage: Auto-Label Every Email and Draft Replies

Practice it step by step

Start the free practice

You do every step yourself in a practice copy of n8n. It checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, about 14 minutes, and nothing touches your real accounts. Open full screen

Free · Live nowBusiness Automationsn8nOpenAIGmail~14 min40 stepsAdvanced

Updated . Built against the tool’s current screens and checked step by step. How we check this lesson

Most mornings start with sorting: new inquiries, client questions, bills. In this free lesson you build an n8n workflow that sorts the inbox before you open it. An AI Text Classifier decides whether each new email is a lead, a client or an invoice, the matching Gmail label goes on, and client emails get a short reply waiting in Drafts. Nothing is ever sent on its own.

At a glance

QuestionAnswer
What you buildBuild an n8n workflow that reads each new email, sorts it as a lead, a client or an invoice with a Text Classifier, adds the matching Gmail label, and drafts a reply to clients for you to check.
Toolsn8n
TimeAbout 14 minutes, 40 steps in 5 parts
LevelAdvanced, no coding needed
CostFree
Ways to learn itPractice it step by step, watch the video, read the guide with screenshots

The 5 parts, in short

  1. Sort every email: Add the next step, Search for classifier, Text Classifier, What to classify, and 9 more steps.
  2. Add the model: Add a chat model, OpenAI Chat Model, Close the node.
  3. Apply the labels: Connect Lead, Connect Client, Connect Invoice.
  4. Write the reply: Add the reply writer, Search for llm chain, Basic LLM Chain, Change the prompt source, and 6 more steps.
  5. Save it as a draft: Save the reply, Search for gmail, Gmail, Create a draft, and 7 more steps.

Start here first: AI Receipt Extractor: Receipts to Google Sheets with n8n (module 1 of Business Automations)

In the course: Part 9 · n8n Automation Toolkit (Module 42 of the full course)

Part of: Business Automations with n8n (step 5 of 7). Next up: A Support Agent That Answers from Your Own Docs

Gmail AI Triage: Auto-Label Every Email and Draft Replies: step-by-step guide with screenshots

About the screenshots. They come from Stepthrough’s simulated practice environment (a practice copy of n8n), not the live tool, so no real account appears. The buttons and labels match the real screens the lesson was built against. Practice it yourself free at learn.ynteractive.com.

  • Tools: n8n
  • Time: about 14 minutes, 40 steps in 5 parts
  • Level: beginner, no coding needed

Part 1: Sort every email

Step 1: Add the next step

You're Sam at Juniper and Vale Marketing, and every morning starts with sorting the inbox. Let AI do it. This workflow already has a Gmail Trigger with a client email pinned, and three steps that each add one Gmail label. What's missing is the part that decides.

The n8n workflow canvas in Stepthrough’s practice copy, step 1 of 40 (Add the next step): the cursor is on “Gmail Trigger”, highlighted.
Step 1 of 40. The Gmail Trigger checks the inbox every minute, and one client email is pinned to it. The three Label steps are ready. Click the + after Gmail Trigger.

Step 2: Search for classifier

The n8n node list in Stepthrough’s practice copy, step 2 of 40 (Search for classifier): the classifier is filled in (“classifier”).
Step 2 of 40. Type classifier.

Step 3: Text Classifier

It reads some text and sends it down one output per category.

The n8n node list in Stepthrough’s practice copy, step 3 of 40 (Text Classifier): the cursor is on “Text Classifier”, highlighted.
Step 3 of 40. Click Text Classifier.

Step 4: What to classify

Point to Text to Classify and switch it to Expression, then paste this. The sender, the subject and the start of the message are usually enough to tell what an email is.

An n8n node’s settings window in Stepthrough’s practice copy, step 4 of 40 (What to classify): the expression is filled in (“From: {{ $json.From }} Subject: {{…”).
Step 4 of 40. Point to Text to Classify and click Expression first (in Fixed the {{ }} stay plain text). Then paste who it is from, the subject and the snippet.

Step 5: Add a category

Now the categories.

An n8n node’s settings window in Stepthrough’s practice copy, step 5 of 40 (Add a category): the cursor is on “Add Category”, highlighted.
Step 5 of 40. Click Add Category.

Step 6: Name it Lead

An n8n node’s settings window in Stepthrough’s practice copy, step 6 of 40 (Name it Lead): the category is filled in (“Lead”).
Step 6 of 40. In Category, type Lead.

Step 7: Describe it

Add a description. Lead and Client both sound like customers, so spell out the difference. A lead is someone new.

An n8n node’s settings window in Stepthrough’s practice copy, step 7 of 40 (Describe it): the description is filled in (“Someone new asking about our services, prices…”).
Step 7 of 40. In Description, paste: *Someone new asking about our services, prices or availability*.

Step 8: Add a category

Add another category.

An n8n node’s settings window in Stepthrough’s practice copy, step 8 of 40 (Add a category): the cursor is on “Add Category”, highlighted.
Step 8 of 40. Click Add Category.

Step 9: Name it Client

An n8n node’s settings window in Stepthrough’s practice copy, step 9 of 40 (Name it Client): the category is filled in (“Client”).
Step 9 of 40. In Category, type Client.

Step 10: Describe it

A client already works with you and writes about their own project.

An n8n node’s settings window in Stepthrough’s practice copy, step 10 of 40 (Describe it): the description is filled in (“An existing client writing about their own…”).
Step 10 of 40. In Description, paste: *An existing client writing about their own project or account with us*.

Step 11: Add a category

One more.

An n8n node’s settings window in Stepthrough’s practice copy, step 11 of 40 (Add a category): the cursor is on “Add Category”, highlighted.
Step 11 of 40. Click Add Category.

Step 12: Name it Invoice

That one is obvious, so it needs no description. Anything that fits none of the three is dropped and stays unlabeled.

An n8n node’s settings window in Stepthrough’s practice copy, step 12 of 40 (Name it Invoice): the category is filled in (“Invoice”).
Step 12 of 40. In Category, type Invoice.

Step 13: Close the node

Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 13 of 40 (Close the node): the cursor is on “Close the node”, highlighted.
Step 13 of 40. Close the node.

Part 2: Add the model

Step 14: Add a chat model

Give it a model.

The n8n workflow canvas in Stepthrough’s practice copy, step 14 of 40 (Add a chat model): the cursor is on “+”, highlighted.
Step 14 of 40. Click the + under Model.

Step 15: OpenAI Chat Model

OpenAI Chat Model.

The n8n node list in Stepthrough’s practice copy, step 15 of 40 (OpenAI Chat Model): the cursor is on “OpenAI Chat Model”, highlighted.
Step 15 of 40. Click OpenAI Chat Model.

Step 16: Close the node

Your saved OpenAI key is already picked. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 16 of 40 (Close the node): the cursor is on “OpenAI account”, highlighted.
Step 16 of 40. Your saved OpenAI account is picked. Close the node.

Part 3: Apply the labels

Step 17: Connect Lead

The classifier now has one output per category. Connect each one to its label step.

The n8n workflow canvas in Stepthrough’s practice copy, step 17 of 40 (Connect Lead): the cursor is on “Lead”, highlighted.
Step 17 of 40. Drag from the Lead output of Text Classifier to Label: Lead. (Here, click the dot.)

Step 18: Connect Client

Client to Label: Client.

The n8n workflow canvas in Stepthrough’s practice copy, step 18 of 40 (Connect Client): the cursor is on “Client”, highlighted.
Step 18 of 40. Drag from the Client output of Text Classifier to Label: Client. (Here, click the dot.)

Step 19: Connect Invoice

And Invoice to Label: Invoice. Each label step adds its Gmail label to that email.

The n8n workflow canvas in Stepthrough’s practice copy, step 19 of 40 (Connect Invoice): the cursor is on “Invoice”, highlighted.
Step 19 of 40. Drag from the Invoice output of Text Classifier to Label: Invoice. (Here, click the dot.)

Part 4: Write the reply

Step 20: Add the reply writer

Client emails also get a reply ready for you.

The n8n workflow canvas in Stepthrough’s practice copy, step 20 of 40 (Add the reply writer): the cursor is on “+”, highlighted.
Step 20 of 40. Only client emails get a draft. Click the + after Label: Client.

Step 21: Search for llm chain

The n8n node list in Stepthrough’s practice copy, step 21 of 40 (Search for llm): the llm is filled in (“llm”).
Step 21 of 40. Type llm chain.

Step 22: Basic LLM Chain

It sends one prompt to a model and returns the text.

The n8n node list in Stepthrough’s practice copy, step 22 of 40 (Basic LLM Chain): the cursor is on “Basic LLM Chain”, highlighted.
Step 22 of 40. Click Basic LLM Chain.

Step 23: Change the prompt source

It expects a chat message by default, and ours is an email.

An n8n node’s settings window in Stepthrough’s practice copy, step 23 of 40 (Change the prompt source): the cursor is on “Source for Prompt (User Message)”, highlighted.
Step 23 of 40. Open Source for Prompt (User Message).

Step 24: Define below

Define below.

A dropdown menu in n8n in Stepthrough’s practice copy, step 24 of 40 (Define below): the cursor is on “Define below”, highlighted.
Step 24 of 40. Choose Define below.

Step 25: Write the prompt

Switch Prompt to Expression, then paste the prompt. It says what to write and what not to promise, and it pulls the email from the Gmail Trigger by name, because the step right before this one only returns the label result.

An n8n node’s settings window in Stepthrough’s practice copy, step 25 of 40 (Write the prompt): the prompt is filled in (“Write a short reply to this client email for…”).
Step 25 of 40. Point to Prompt (User Message), click Expression, then paste the prompt. It pulls the email from Gmail Trigger by name.
Write a short reply to this client email for Juniper & Vale Marketing.
Thank them and answer only what the email asks. If it needs a decision or a new date, say we'll confirm today. Don't promise anything else.
Plain text, under 100 words, signed "Sam".

From: {{ $('Gmail Trigger').item.json.From }}
Subject: {{ $('Gmail Trigger').item.json.Subject }}
Message: {{ $('Gmail Trigger').item.json.snippet }}

Step 26: Close the node

Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 26 of 40 (Close the node): the cursor is on “Close the node”, highlighted.
Step 26 of 40. Close the node.

Step 27: Add its model

This one needs a model too.

The n8n workflow canvas in Stepthrough’s practice copy, step 27 of 40 (Add its model): the cursor is on “+”, highlighted.
Step 27 of 40. Click the + under Model on Basic LLM Chain.

Step 28: OpenAI Chat Model

OpenAI Chat Model.

The n8n node list in Stepthrough’s practice copy, step 28 of 40 (OpenAI Chat Model): the cursor is on “OpenAI Chat Model”, highlighted.
Step 28 of 40. Click OpenAI Chat Model.

Step 29: Close the node

Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 29 of 40 (Close the node): the cursor is on “Close the node”, highlighted.
Step 29 of 40. Close the node.

Part 5: Save it as a draft

Step 30: Save the reply

Now save that reply as a draft.

The n8n workflow canvas in Stepthrough’s practice copy, step 30 of 40 (Save the reply): the cursor is on “+”, highlighted.
Step 30 of 40. Click the + after Basic LLM Chain.

Step 31: Search for gmail

The n8n node list in Stepthrough’s practice copy, step 31 of 40 (Search for gmail): the gmail is filled in (“gmail”).
Step 31 of 40. Type gmail.

Step 32: Gmail

Gmail.

The n8n node list in Stepthrough’s practice copy, step 32 of 40 (Gmail): the cursor is on “Gmail”, highlighted.
Step 32 of 40. Click Gmail.

Step 33: Create a draft

Under Draft Actions, click Create a draft. It saves a draft and never sends, so you read it first.

The n8n node list in Stepthrough’s practice copy, step 33 of 40 (Create a draft): the cursor is on “Draft Actions”, highlighted.
Step 33 of 40. Scroll down to Draft Actions and click Create a draft.

Step 34: Subject

An n8n node’s settings window in Stepthrough’s practice copy, step 34 of 40 (Subject): the expression is filled in (“Re: {{ $('Gmail Trigger').item.json.Subject }}”).
Step 34 of 40. Paste Re: plus the original subject into Subject.

Step 35: Message

In Message, paste this. It is the text the chain wrote.

An n8n node’s settings window in Stepthrough’s practice copy, step 35 of 40 (Message): the expression is filled in (“{{ $json.text }}”).
Step 35 of 40. Paste {{ $json.text }} into Message: the reply the chain wrote.

Step 36: Add option

Without a recipient, the draft has nobody to go to.

An n8n node’s settings window in Stepthrough’s practice copy, step 36 of 40 (Add option): the cursor is on “Add option”, highlighted.
Step 36 of 40. Click Add option.

Step 37: To Email

To Email.

A dropdown menu in n8n in Stepthrough’s practice copy, step 37 of 40 (To Email): the cursor is on “To Email”, highlighted.
Step 37 of 40. Choose To Email.

Step 38: Reply to the sender

An n8n node’s settings window in Stepthrough’s practice copy, step 38 of 40 (Reply to the sender): the expression is filled in (“{{ $('Gmail Trigger').item.json.From }}”).
Step 38 of 40. Paste the sender from Gmail Trigger.

Step 39: Close the node

Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 39 of 40 (Close the node): the cursor is on “Close the node”, highlighted.
Step 39 of 40. Close the node.

Step 40: Test it

Priya's email goes out the Client side, gets the Client label, and a short reply waits in Drafts. Check it in Gmail, then publish. Read every draft before you send it.

The n8n workflow editor in Stepthrough’s practice copy, step 40 of 40 (Test it): the cursor is on “Execute workflow”, highlighted.
Step 40 of 40. Click Execute workflow. It runs on the pinned client email.

Now do it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive lesson puts you in a practice copy of n8n: you do every step yourself, it checks your work, and “Do it for me” finishes any step you get stuck on. Nothing touches your real accounts.

Practice “Gmail AI Triage: Auto-Label Every Email and Draft Replies” step by step

Gmail AI Triage: Auto-Label Every Email and Draft Replies: video walkthrough

The whole lesson in 2:31, narrated step by step.

Simulated practice environment. Recorded in Stepthrough’s simulated practice environment, not the live tool. Practice it yourself free at learn.ynteractive.com.

2:31 · 4 chapters · 40 steps · narrated with the lesson’s own voice-over

Chapters

Click a chapter to jump the video there.

  1. 0:00 Sort every email
  2. 0:54 Apply the labels
  3. 1:15 Write the reply
  4. 1:48 Save it as a draft

Now do it yourself, free

Watching is the warm-up. The interactive lesson puts you in a practice copy of n8n: you do every step yourself, it checks your work, and “Do it for me” finishes any step you get stuck on. Nothing touches your real accounts.

Practice “Gmail AI Triage: Auto-Label Every Email and Draft Replies” step by step

Full transcript

Sort every email

0:00 You're Sam at Juniper and Vale Marketing, and every morning starts with sorting the inbox. Let AI do it. This workflow already has a Gmail Trigger with a client email pinned, and three steps that each add one Gmail label. What's missing is the part that decides. Click the plus after the Gmail Trigger.

0:15 Type classifier.

0:16 Click Text Classifier. It reads some text and sends it down one output per category.

0:22 Paste this into Text to Classify. The sender, the subject and the start of the message are usually enough to tell what an email is.

0:29 Now the categories. Click Add Category.

0:32 Type Lead.

0:33 Add a description. Lead and Client both sound like customers, so spell out the difference. A lead is someone new.

0:38 Add another category.

0:40 Type Client.

0:41 A client already works with you and writes about their own project.

0:45 One more.

0:46 Type Invoice. That one is obvious, so it needs no description. Anything that fits none of the three is dropped and stays unlabeled.

0:53 Close it.

Apply the labels

0:54 Give it a model. Click the plus under Model.

0:56 OpenAI Chat Model.

0:58 Your saved OpenAI key is already picked. Close it.

1:01 The classifier now has one output per category. Connect each one to its label step. Drag from Lead to Label: Lead.

1:08 Client to Label: Client.

1:10 And Invoice to Label: Invoice. Each label step adds its Gmail label to that email.

Write the reply

1:14 Client emails also get a reply ready for you. Click the plus after Label: Client.

1:19 Type llm.

1:20 Click Basic LLM Chain. It sends one prompt to a model and returns the text.

1:25 It expects a chat message by default, and ours is an email. Open Source for Prompt.

1:30 Define below.

1:31 Paste the prompt. It says what to write and what not to promise, and it pulls the email from the Gmail Trigger by name, because the step right before this one only returns the label result.

1:41 Close it.

1:42 This one needs a model too. Click the plus under its Model.

1:45 OpenAI Chat Model.

1:46 Close it.

Save it as a draft

1:47 Now save that reply as a draft. Click the plus after the chain.

1:51 Type gmail.

1:52 Gmail.

1:53 Under Draft Actions, click Create a draft. It saves a draft and never sends, so you read it first.

1:58 Paste the subject: R E, then the original subject.

2:02 In Message, paste this. It is the text the chain wrote.

2:05 Without a recipient, the draft has nobody to go to. Click Add option.

2:09 To Email.

2:10 Paste the sender from the Gmail Trigger.

2:13 Close it.

2:14 Click Execute workflow. Priya's email goes out the Client side, gets the Client label, and a short reply waits in Drafts. Check it in Gmail, then publish. Read every draft before you send it.

2:24 Simple as that. We show you and you do it. Sign up below to learn AI automation for free.

The n8n inbox triage workflow: Gmail Trigger, a Text Classifier with Lead, Client and Invoice outputs wired to three label steps, then a Basic LLM Chain and Create a draft on the Client branch
The n8n inbox triage workflow: Gmail Trigger, a Text Classifier with Lead, Client and Invoice outputs wired to three label steps, then a Basic LLM Chain and Create a draft on the Client branch

What you will build

You are Sam at Juniper & Vale Marketing, a made-up agency. The workflow already has a Gmail Trigger with one email pinned to it, from Priya at Fernhill Bakery asking to move the October newsletter to Thursday, and three steps that each add a Gmail label: Label: Lead, Label: Client and Label: Invoice.

You add a Text Classifier with an OpenAI Chat Model and three categories. Lead and Client get a one-line description each, because both sound like customers. You connect each of the classifier's outputs to its label step. After Label: Client you add a Basic LLM Chain that writes a short reply, then Gmail's Create a draft saves it, addressed back to the sender. One test run sends Priya's email down the Client branch, labels it, and leaves a draft for Sam to read.

Why descriptions matter

A Text Classifier only knows your categories by their names and descriptions. "Invoice" is obvious. "Lead" and "Client" are not: both are people who might pay you. One plain sentence for each, new versus existing, is what keeps a client's question from being treated as a cold lead. If a type of email keeps landing in the wrong place, sharpen that description first. Anything that fits none of the categories is dropped by default and simply stays unlabeled. Choose Output on Extra, 'Other' Branch under When No Clear Match if you want to catch those too.

Gotchas worth knowing

  • Create the Lead, Client and Invoice labels in Gmail first. Add label to message picks from labels that already exist.
  • The label step only returns the message's id, threadId and labels, so the reply prompt and the draft read the email from the Gmail Trigger by name: $('Gmail Trigger').item.json.snippet.
  • Basic LLM Chain expects a chat message by default. Switch Source for Prompt to Define below.
  • A draft has no recipient unless you add the To Email option. Add Thread ID too if you want the draft to sit under the original email.
  • Gmail's own filters and spam folder still run first. This sorts what reaches your inbox.

What you need

  • An n8n account: n8n Cloud from about €20 a month with a free trial, or the free self-hosted Community Edition.
  • An OpenAI API key with a little credit. Classifying one email and writing a short reply costs a fraction of a cent.
  • Gmail connected in n8n, with the three labels created.

Keep it safe

The workflow only labels and drafts. It never sends, deletes or archives. Read every draft before you send it, and watch the labels for the first week. Emails pass through OpenAI to be classified, so check your company's rules on client data first.

Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of n8n, checks each step, and never touches your real accounts.

Start “Gmail AI Triage: Auto-Label Every Email and Draft Replies”

All free Stepthrough videos

Screenshots

Frequently asked questions

How does the interactive lesson work?
Each step is shown to you first on the left (Watch). Then you do it yourself in a practice copy on the right (Your turn), and every click is checked. If you get stuck, press Do it for me. It is a practice copy, so no real accounts are touched.
Is this free?
Stepthrough is completely free. Running the workflow for real needs your own n8n account, an OpenAI API key with some credit, and Gmail.
Will it send emails for me?
No. Client emails get a reply saved as a draft. You read it, change it if needed, and send it yourself.
Can I add more categories?
Yes. Add another category in the Text Classifier, then a label step for its new output. Keep each description to one clear sentence.
How is this different from Gmail filters?
Filters match fixed words or senders. The classifier reads what the email is about, so a new client's question gets the right label even if it doesn't contain the words a filter looks for.

Start this module free

More in Business Automations

All 5 modules in Business Automations

More n8n tutorials

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

Browse related tutorials