# n8n workflow that sorts support emails into Gmail labels (Returns, Warranty, Quotes, Other) with the Text Classifier node and Claude. Paste it into an empty n8n workflow.

> Source: <https://gist.github.com/alzanalzamora/eb94b56e57369f540f3a36f2e85005f0>
> Published: 2026-10-12 09:53:10+00:00

**Key takeaway:** Pairing n8n's Text Classifier node with a Claude model and a fallback category lets a Gmail-triggered workflow auto-label support mail into Returns, Warranty, Quotes and Other without dropping unmatched emails.

|  | { | 
|  | "name": "Support email sorter", | 
|  | "nodes": [ | 
|  | { | 
|  | "parameters": { | 
|  | "content": "## Setup steps\n1. In Gmail, create four labels: **Returns, Warranty, Quotes, Other**.\n2. **Gmail Trigger:** choose your Gmail credential and change the filter to your support address, for example `to:yourname+support@gmail.com`.\n3. **Anthropic Chat Model:** choose your Anthropic credential and a Claude model.\n4. In each **Add ... label** node, choose your Gmail credential and pick the matching label.\n5. Run a test with **Fetch Test Event**, then publish the workflow.\n\nEmails that fit no category go to the Other branch and get the Other label, so none are dropped.", | 
|  | "height": 340, | 
|  | "width": 460 | 
|  | }, | 
|  | "type": "n8n-nodes-base.stickyNote", | 
|  | "typeVersion": 1, | 
|  | "position": [ | 
|  | -520, | 
|  | -160 | 
|  | ], | 
|  | "id": "e6a58e30-b529-4474-b7a6-8e64691d957a", | 
|  | "name": "Setup steps" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "pollTimes": { | 
|  | "item": [ | 
|  | { | 
|  | "mode": "everyMinute" | 
|  | } | 
|  | ] | 
|  | }, | 
|  | "simple": false, | 
|  | "filters": { | 
|  | "q": "to:yourname+support@gmail.com" | 
|  | }, | 
|  | "options": {} | 
|  | }, | 
|  | "type": "n8n-nodes-base.gmailTrigger", | 
|  | "typeVersion": 1.4, | 
|  | "position": [ | 
|  | 0, | 
|  | 80 | 
|  | ], | 
|  | "name": "Gmail Trigger", | 
|  | "id": "4a861507-1003-4528-9ea6-9f9b7370ae32" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "inputText": "={{ $json.subject }}\n{{ $json.text }}", | 
|  | "categories": { | 
|  | "categories": [ | 
|  | { | 
|  | "category": "Returns", | 
|  | "description": "The customer wants to send an item back, exchange it, or get a refund." | 
|  | }, | 
|  | { | 
|  | "category": "Warranty", | 
|  | "description": "A product broke, stopped working or has a defect, and the customer wants it repaired or replaced." | 
|  | }, | 
|  | { | 
|  | "category": "Quotes", | 
|  | "description": "The customer asks for a price, a bulk or business order, or a quote before buying." | 
|  | } | 
|  | ] | 
|  | }, | 
|  | "options": { | 
|  | "fallback": "other" | 
|  | } | 
|  | }, | 
|  | "type": "@n8n/n8n-nodes-langchain.textClassifier", | 
|  | "typeVersion": 1.1, | 
|  | "position": [ | 
|  | 224, | 
|  | 80 | 
|  | ], | 
|  | "name": "Text Classifier", | 
|  | "id": "1682084f-1849-48df-bb8b-ebf1b3d4eced" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "model": { | 
|  | "__rl": true, | 
|  | "value": "claude-haiku-5-5", | 
|  | "mode": "list", | 
|  | "cachedResultName": "Claude Haiku 5.5" | 
|  | }, | 
|  | "options": {} | 
|  | }, | 
|  | "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic", | 
|  | "typeVersion": 1.6, | 
|  | "position": [ | 
|  | 296, | 
|  | 376 | 
|  | ], | 
|  | "name": "Anthropic Chat Model", | 
|  | "id": "8c8039fb-752f-4a3a-9489-069e6411f939" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "operation": "addLabels", | 
|  | "messageId": "={{ $json.id }}", | 
|  | "labelIds": [] | 
|  | }, | 
|  | "type": "n8n-nodes-base.gmail", | 
|  | "typeVersion": 2.2, | 
|  | "position": [ | 
|  | 576, | 
|  | -16 | 
|  | ], | 
|  | "name": "Add Warranty label", | 
|  | "id": "12618590-5636-48ad-b3ad-1856de3130af" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "operation": "addLabels", | 
|  | "messageId": "={{ $json.id }}", | 
|  | "labelIds": [] | 
|  | }, | 
|  | "type": "n8n-nodes-base.gmail", | 
|  | "typeVersion": 2.2, | 
|  | "position": [ | 
|  | 576, | 
|  | -208 | 
|  | ], | 
|  | "name": "Add Returns label", | 
|  | "id": "01721f9d-08ad-4285-9cd3-ef8c4adde52c" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "operation": "addLabels", | 
|  | "messageId": "={{ $json.id }}", | 
|  | "labelIds": [] | 
|  | }, | 
|  | "type": "n8n-nodes-base.gmail", | 
|  | "typeVersion": 2.2, | 
|  | "position": [ | 
|  | 576, | 
|  | 176 | 
|  | ], | 
|  | "name": "Add Quotes label", | 
|  | "id": "67c5558c-2064-4937-bd12-0c4b4ad991ff" | 
|  | }, | 
|  | { | 
|  | "parameters": { | 
|  | "operation": "addLabels", | 
|  | "messageId": "={{ $json.id }}", | 
|  | "labelIds": [] | 
|  | }, | 
|  | "type": "n8n-nodes-base.gmail", | 
|  | "typeVersion": 2.2, | 
|  | "position": [ | 
|  | 576, | 
|  | 368 | 
|  | ], | 
|  | "name": "Add Other label", | 
|  | "id": "27557aaa-8749-43a8-91bc-1acd523bc5e0" | 
|  | } | 
|  | ], | 
|  | "pinData": {}, | 
|  | "connections": { | 
|  | "Gmail Trigger": { | 
|  | "main": [ | 
|  | [ | 
|  | { | 
|  | "node": "Text Classifier", | 
|  | "type": "main", | 
|  | "index": 0 | 
|  | } | 
|  | ] | 
|  | ] | 
|  | }, | 
|  | "Anthropic Chat Model": { | 
|  | "ai_languageModel": [ | 
|  | [ | 
|  | { | 
|  | "node": "Text Classifier", | 
|  | "type": "ai_languageModel", | 
|  | "index": 0 | 
|  | } | 
|  | ] | 
|  | ] | 
|  | }, | 
|  | "Text Classifier": { | 
|  | "main": [ | 
|  | [ | 
|  | { | 
|  | "node": "Add Returns label", | 
|  | "type": "main", | 
|  | "index": 0 | 
|  | } | 
|  | ], | 
|  | [ | 
|  | { | 
|  | "node": "Add Warranty label", | 
|  | "type": "main", | 
|  | "index": 0 | 
|  | } | 
|  | ], | 
|  | [ | 
|  | { | 
|  | "node": "Add Quotes label", | 
|  | "type": "main", | 
|  | "index": 0 | 
|  | } | 
|  | ], | 
|  | [ | 
|  | { | 
|  | "node": "Add Other label", | 
|  | "type": "main", | 
|  | "index": 0 | 
|  | } | 
|  | ] | 
|  | ] | 
|  | } | 
|  | }, | 
|  | "active": false, | 
|  | "settings": { | 
|  | "executionOrder": "v1" | 
|  | } | 
|  | } |
