Gmail + GPT-4: labeled inbox and draft replies
Your inbox doesn’t get messy in one dramatic moment. It’s the slow pileup: a billing email you meant to answer, an inquiry that turns into a missed lead, and “urgent” threads buried under newsletters.
Freelancers feel this when client comms and money questions collide. Small business owners get hit when they’re switching between sales, delivery, and support all day. And busy marketing leads end up doing inbox triage instead of actual work. This Gmail GPT-4 automation labels new emails by priority and creates draft replies you can review in seconds.
Below, you’ll see how the workflow routes messages into categories, applies the right Gmail labels, and generates consistent draft responses that sound like you (not like a robot).
How This Automation Works
See how this solves the problem:
n8n Workflow Template: Gmail + GPT-4: labeled inbox and draft replies
flowchart LR
subgraph sg0["Gmail Intake Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "Gmail Intake Trigger", pos: "b", h: 48 }
n1@{ icon: "mdi:robot", form: "rounded", label: "Email Category Router", pos: "b", h: 48 }
n2@{ icon: "mdi:message-outline", form: "rounded", label: "Apply Urgent Label", pos: "b", h: 48 }
n3@{ icon: "mdi:robot", form: "rounded", label: "Draft Reply for Urgent", pos: "b", h: 48 }
n4@{ icon: "mdi:message-outline", form: "rounded", label: "Store Urgent Draft", pos: "b", h: 48 }
n5@{ icon: "mdi:message-outline", form: "rounded", label: "Apply Inquiry Label", pos: "b", h: 48 }
n6@{ icon: "mdi:robot", form: "rounded", label: "Draft Reply for Inquiry", pos: "b", h: 48 }
n7@{ icon: "mdi:message-outline", form: "rounded", label: "Store Inquiry Draft", pos: "b", h: 48 }
n8@{ icon: "mdi:message-outline", form: "rounded", label: "Apply Billing Label", pos: "b", h: 48 }
n9@{ icon: "mdi:robot", form: "rounded", label: "Draft Reply for Billing", pos: "b", h: 48 }
n10@{ icon: "mdi:message-outline", form: "rounded", label: "Store Billing Draft", pos: "b", h: 48 }
n11@{ icon: "mdi:brain", form: "rounded", label: "LLM Support Engine", pos: "b", h: 48 }
n0 --> n1
n5 --> n6
n11 -.-> n1
n2 --> n3
n8 --> n9
n6 --> n7
n1 --> n2
n1 --> n5
n1 --> n8
n3 --> n4
n9 --> n10
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n1,n3,n6,n9 ai
class n11 aiModel
The Challenge: Keeping up with email without missing the important stuff
“Just stay on top of your inbox” sounds simple until you’re the one doing it. New messages arrive all day, and they’re not equal: a payment issue needs a fast answer, a general inquiry needs a friendly response, and a truly urgent request can’t wait until you “get to emails later.” Manually scanning, labeling, and writing replies drains focus in tiny chunks. Worse, it’s inconsistent. Some days you respond quickly. Other days you re-read the same thread three times because you’re trying to remember what you promised.
It adds up fast. Here’s where it breaks down in real life.
- You spend the first 30 minutes of the day sorting instead of working, and the inbox refills before lunch.
- Urgent messages look the same as everything else until you open them, which means “urgent” becomes “late” surprisingly often.
- Reply quality varies by mood and time, so customers get different tones and different levels of detail.
- Billing and finance threads get scattered, and that’s how small disputes turn into awkward follow-ups.
The Fix: Auto-label emails and generate ready-to-review drafts
This workflow turns “new email” into an organized decision and a drafted response, automatically. When an email hits your Gmail inbox, n8n triggers instantly and passes the message to an AI classifier that sorts it into categories like High Priority, Inquiry, and Finance/Billing. Based on that category, the workflow applies the right Gmail label, then sends the email content to GPT-4 with a prompt designed for that situation. The result is a professional draft reply saved directly back into Gmail, sitting there waiting for your quick review. You still stay in control, but you’re no longer starting from a blank page every time.
The workflow starts with a Gmail trigger, then routes each message through a classifier. From there it labels the email and generates a category-specific draft reply using GPT-4. Finally, it stores the draft inside Gmail, so your team can approve, tweak, and send as usual.
What Changes: Before vs. After
| What This Eliminates | Impact You’ll See |
|---|---|
|
|
Real-World Impact
Say you receive about 30 meaningful emails a day (not spam, actual stuff). Manually, you might spend 1 minute deciding what each email is, another minute labeling or routing it, and around 5 minutes drafting a reply for the ones that need a response. That’s easily 2 to 3 hours of attention, scattered across the day. With this workflow, classification and labeling happen automatically, and drafts are created in the background; you can often review and send in about 1 minute per email. For many people, that turns into about 2 hours back each day.
Requirements
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail for receiving, labeling, and storing drafts.
- OpenAI (GPT-4) to generate category-specific reply drafts.
- OpenAI API key (get it from your OpenAI dashboard).
Skill level: Beginner. You’ll connect accounts, paste label IDs, and adjust a few prompts.
Need help implementing this? Talk to an automation expert (free 15-minute consultation).
The Workflow Flow
A new Gmail message arrives. The Gmail trigger watches your inbox and fires as soon as an email lands, so the workflow reacts in near real time.
The email gets classified into a meaningful bucket. An AI classifier reads the subject and body, then decides if it’s High Priority, an Inquiry, or Finance/Billing (you can add more categories later).
Gmail labels and GPT-4 drafting happen together. Based on the category, n8n applies the correct Gmail label, then sends the email content to GPT-4 using the matching “Generate Draft” prompt for that type of message.
A draft reply is saved back to Gmail. The workflow creates a draft inside the correct thread, which means your review process stays the same. You just open drafts, skim, tweak if needed, and send.
You can easily modify the categories and draft tone to match your business. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Gmail Trigger
This workflow starts when a new email arrives in Gmail and is polled on a 15-minute interval.
- Add and open Gmail Intake Trigger.
- Set Poll Times to
everyXminutes with Value15. - Keep Simple set to
falseto retrieve full email content. - Credential Required: Connect your Gmail credentials.
Step 2: Connect Gmail for Labels and Draft Storage
Six Gmail action nodes label incoming messages and store AI-generated drafts. Connect Gmail once and reuse across all Gmail nodes.
- Open Apply Urgent Label, Apply Inquiry Label, and Apply Billing Label and connect Gmail credentials.
- Set Message ID in each label node to
{{ $json.id }}. - Set Operation to
addLabelsin each label node. - Replace label IDs: set labelIds to
YOUR_LABEL_ID_HIGH_PRIORITY,YOUR_LABEL_ID_INQUIRY, andYOUR_LABEL_ID_FINANCErespectively. - Open Store Urgent Draft, Store Inquiry Draft, and Store Billing Draft and connect Gmail credentials.
- Confirm Resource is set to
draftfor each draft node. - Set Message to
{{ JSON.parse($json.message.content)['message'] || $json.message.content }}. - Set Subject to
{{ JSON.parse($json.message.content)['subject'] || `Re: ${$('Gmail Intake Trigger').item.json.subject}` }}. - Set Thread ID to
{{ $('Gmail Intake Trigger').item.json.threadId }}in the Options section.
YOUR_LABEL_ID_* placeholders, labels will fail silently. Create labels in Gmail and copy their IDs first.Step 3: Set Up the Email Classifier
The classifier routes incoming emails into Urgent, Inquiry, or Billing paths.
- Open Email Category Router.
- Set Input Text to
{{ $json.text }}. - Confirm categories are configured as:
High Priority,Promotions,Inquiry, andFinance/Billingwith the provided descriptions. - Open LLM Support Engine and set the Model to
gpt-4.1-mini. - Credential Required: Connect your OpenAI credentials in LLM Support Engine (the language model for Email Category Router).
Step 4: Configure AI Drafting for Each Category
Each category uses a dedicated AI prompt to draft a response.
- Open Draft Reply for Urgent and confirm Model is
gpt-4o-miniand JSON Output is enabled. - Ensure the prompt references the incoming email content with
{{ $('Gmail Intake Trigger').item.json.text }}and subject with{{ $('Gmail Intake Trigger').item.json.subject }}. - Repeat the same model and JSON output setup for Draft Reply for Inquiry and Draft Reply for Billing.
- Credential Required: Connect your OpenAI credentials in Draft Reply for Urgent, Draft Reply for Inquiry, and Draft Reply for Billing.
Step 5: Verify Routing and Draft Storage Flow
The flow routes from classification to label application, then to draft creation.
- Confirm the execution order: Gmail Intake Trigger → Email Category Router.
- Verify the category outputs map to: Email Category Router → Apply Urgent Label, Apply Inquiry Label, and Apply Billing Label.
- Check each label node connects to its draft node: Apply Urgent Label → Draft Reply for Urgent → Store Urgent Draft, Apply Inquiry Label → Draft Reply for Inquiry → Store Inquiry Draft, and Apply Billing Label → Draft Reply for Billing → Store Billing Draft.
Step 6: Test and Activate Your Workflow
Run a manual test to verify classification, labeling, and draft creation before turning it on.
- Click Execute Workflow and send a test email that matches one of the categories (e.g., urgent or billing).
- Confirm the email receives the correct label in Gmail.
- Check Gmail Drafts to verify a new draft is created with the generated subject and message.
- Once successful, toggle the workflow to Active for production use.
Watch Out For
- Gmail credentials can expire or need specific permissions. If things break, check the connected Google account in n8n Credentials and re-authenticate first.
- Your Gmail label IDs must match exactly. If the workflow applies the wrong label (or none), confirm the label IDs via Gmail API “List Labels” and update the YOUR_LABEL_ID_XXX placeholders.
- GPT-4 drafts can drift into generic language if your prompts are vague. Add a few example replies and a “do/don’t” tone note early, or you’ll be rewriting drafts constantly.
Common Questions
About 30 minutes if your Gmail labels and OpenAI key are ready.
Yes. No coding required, but someone does need to copy the correct Gmail label IDs and test with a few real emails.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs, which are usually a few cents per drafted reply depending on email length.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
You can add categories by adjusting the Email Category Router classifier and duplicating the matching “Apply Label” and “Draft Reply” path for the new bucket. Common tweaks include adding “Sales Leads,” splitting Finance into “Invoice” vs “Refund,” and tightening prompts so drafts match your exact voice. If you want notifications too, you can route High Priority emails to Slack or Telegram before the draft is stored.
Usually it’s expired Google OAuth access or the wrong Gmail account connected in n8n. Reconnect the Gmail credential, then confirm the trigger is watching the correct mailbox (and not a test account). If labeling fails but drafts work, double-check label IDs because one wrong character is enough to break the “Apply Label” action.
On a typical n8n Cloud plan, you can comfortably handle hundreds to thousands of emails a month, depending on your execution limits.
Often, yes, especially once you want branching logic for multiple categories and different prompts per path. n8n is also easier to keep cost-stable because self-hosting removes per-task pricing, and you can build more complex routing without paying for every extra step. Zapier and Make can still be fine if you want a quick two-action setup, like “new email → draft a reply,” and you don’t care about labeling or category-specific handling. The bigger issue is maintainability: inbox workflows tend to grow over time, and n8n is more forgiving when they do. Talk to an automation expert if you want a quick recommendation based on your volume.
This is what “inbox zero” starts to look like when the sorting and first-draft writing happens automatically. You review, send, and move on.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.