AutomationFlowsAI & RAG › Smart Email Classifier & Auto-responder with AI

Smart Email Classifier & Auto-responder with AI

ByIan Dikhtiar @ian-dikhtiar on n8n.io

This n8n workflow automates email management by classifying incoming messages, drafting replies, and sending alerts—all powered by AI.

Event trigger★★★★★ complexityAI-powered32 nodesSentiment AnalysisLm Chat Azure Open AiGmailAgentGmail ToolTelegramGoogle Calendar ToolGmail Trigger
AI & RAG Trigger: Event Nodes: 32 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3242 — we link there as the canonical source.

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "195a93cf-a96f-48f6-8859-5676f808583a",
      "name": "Sentiment Analysis",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "maxTries": 2,
      "position": [
        -360,
        -1680
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "b723c3e9-10f8-463d-bd22-c79dda0c26b0",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -940,
        -1300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "005bc73d-89e4-4fa1-b2f1-bd4c03953e7b",
      "name": "Spam",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -580,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "574d56fd-bad6-4e94-94bd-a50ce782d239",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -380,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "f33087a3-0624-4046-b8dd-59c52e136553",
      "name": "Important",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -80,
        -1980
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "5eac42f2-4c6f-4d56-96be-884bff586aa3",
      "name": "Promotion",
      "type": "n8n-nodes-base.gmail",
      "position": [
        280,
        -1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "ebffdbd3-158d-4ac0-b3d5-576888de850a",
      "name": "Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        100,
        -1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "c731ca19-0f80-425c-abe7-daa72921d4b0",
      "name": "Personal",
      "type": "n8n-nodes-base.gmail",
      "position": [
        480,
        -1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "6aea58ec-7e76-4ac1-a8ad-bbd89b90c148",
      "name": "Call request",
      "type": "n8n-nodes-base.gmail",
      "position": [
        840,
        -1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "803ccc0b-a092-4dea-b4ae-26fe986dc514",
      "name": "Needs Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        660,
        -1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "517bec35-ebfd-4fc3-8446-553b4987d726",
      "name": "important?",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "maxTries": 2,
      "position": [
        -960,
        -1960
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "b3ed6d90-08fd-4c30-8655-9cd1207ce13f",
      "name": "Draft Reply",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        -580,
        -1420
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "39976e80-aeb5-416a-af06-76797ce83eda",
      "name": "$INPUTS$",
      "type": "n8n-nodes-base.set",
      "position": [
        -600,
        -1680
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "0fee173a-4031-4b7e-a05a-da99a279f611",
      "name": "Draft",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        -360,
        -1200
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "a263b61f-871d-4e86-bb8e-eb98f1f5260d",
      "name": "Get emails",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        -460,
        -1240
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "dfe8bf62-8f16-4cba-85eb-440557283451",
      "name": "needs reply?",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "maxTries": 2,
      "position": [
        240,
        -1980
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "710da104-10b8-4cdb-95a8-c7969898e605",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        720,
        -1960
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c9b6b19c-2de6-4766-90b7-2e47a168c4f9",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        700,
        -1300
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "a0554154-1ca0-450f-b429-75b6a3b479de",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -560,
        -1200
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "83a94679-424f-4378-8be8-2bfdfb9e28f1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -2040
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "efb81140-83a8-475c-a8f2-b69d7a2d9bbb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -2040
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "12d1089a-091d-40e3-b12b-17d2152c6af9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -1760
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "772f089a-3a63-4195-98b0-ecb79ff65ea1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -1760
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "dc549de3-19d4-4b1f-b20b-d25fef6402e0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -1760
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "82b70e0c-edd2-4abd-80d6-e3b2c8a4300c",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -940,
        -1680
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "4268c088-d0a6-4342-affa-140c2fabb8cb",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -1460
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0501ba81-480d-4cea-9fa6-0552ab86adca",
      "name": "json schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -380,
        -1440
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "e8e84173-60dc-4567-a4c9-e555f28ed1dd",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -2320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "8fcb7dbd-b117-4245-b09c-b6941d03e9cf",
      "name": "Write draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        100,
        -1300
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "d2863b87-b083-4c2e-a3cb-e9cd2bec14d1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -1460
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0ad8c055-c00d-45fd-a3cd-e087c7417f8f",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -2320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2d7acb3a-21b2-4373-805f-c975916e2084",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -2320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Spam": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft": {
      "ai_tool": [
        [
          {
            "node": "Draft Reply",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "main": [
        []
      ]
    },
    "$INPUTS$": {
      "main": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Personal": {
      "main": [
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Important": {
      "main": [
        [
          {
            "node": "needs reply?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Promotion": {
      "main": [
        [
          {
            "node": "important?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get emails": {
      "ai_tool": [
        [
          {
            "node": "Draft Reply",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "important?": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Important",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft Reply": {
      "main": [
        [
          {
            "node": "Write draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Reply": {
      "main": [
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write draft": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "json schema": {
      "ai_outputParser": [
        [
          {
            "node": "Draft Reply",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Call request": {
      "main": [
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notification": {
      "main": [
        [
          {
            "node": "important?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "needs reply?": {
      "main": [
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "$INPUTS$",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "Draft Reply",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Spam",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Important",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Promotion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Personal",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Call request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Needs Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment Analysis",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "important?",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Draft Reply",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "needs reply?",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow automates email management by classifying incoming messages, drafting replies, and sending alerts—all powered by AI.

Source: https://n8n.io/workflows/3242/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Use cases are many: Manage your Gmail inbox, schedule calendar events, and handle contact details — all from one central AI-powered assistant. Perfect for freelancers managing clients, agency owners w

Agent, Gmail Tool, Google Gemini Chat +10
AI & RAG

This workflow automatically transforms your messy inbox into a neatly organized space while ensuring you never miss a critical message. It connects to your Gmail account and triggers for every new ema

Gmail Trigger, Output Parser Structured, Gmail Tool +8
AI & RAG

This workflow is for professionals and small business owners who receive a high volume of emails and want to automate triage, labeling, and draft reply generation — without losing the human touch befo

Gmail, Gmail Trigger, Agent +4
AI & RAG

Keep your Gmail inbox organized and stress-free with this AI-powered workflow. Ideal for freelancers, small business owners, and productivity enthusiasts who receive a high volume of mixed emails. Thi

Gmail Trigger, Output Parser Structured, Gmail +4
AI & RAG

Automate your personal productivity with this intelligent n8n workflow that integrates Telegram, Google Sheets, and OpenAI (GPT-4o). This system uses multiple AI agents to manage work hours, tasks, fi

Agent, OpenAI Chat, Telegram +9