Route and log incoming emails with GPT-4, Excel 365 and Telegram
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (8)
- Email Trigger (IMAP)
n8n-nodes-base.emailReadImap - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Microsoft Excel 365
n8n-nodes-base.microsoftExcel - Send Email
n8n-nodes-base.emailSend - Telegram
n8n-nodes-base.telegram - If
n8n-nodes-base.if - OpenAI
@n8n/n8n-nodes-langchain.openAi
What it does
AI Email Analyzer with Department Routing and Excel Logging (n8n Workflow) Overview This workflow automatically analyzes incoming emails using AI, categorizes them, routes them to the appropriate department, logs the results in Excel 365, and sends notifications to the responsible team member via Telegram. It helps teams automate email triage, prioritize issues, and ensure that important messages are routed to the correct department without manual sorting. This workflow is designed to be scalable, easy to configure, and adaptable for multiple business use cases such as support management, internal operations, finance monitoring, and technical issue tracking. Features - AI-powered email analysis - Automatic email categorization - Department routing based on AI classification - Priority detection (High / Medium / Low) - Attachment detection - Action-required detection - Spam filtering - Excel 365 email logging - Department contact lookup from Excel - Telegram notifications to the responsible team member - Modular workflow design for easy extension ------------------------------------------------------------------------ How It Works 1. Email Trigger - The workflow listens for new incoming emails using IMAP, Gmail, or Outlook. 2. Email Data Extraction - Key email information such as sender, subject, and body content is extracted and prepared for analysis. 3. Email Body Limiting - The email body is truncated to avoid excessive token usage when sending content to the AI model. 4. Batch Processing - Emails are processed one by one to prevent rate limits when calling the AI API. 5. AI Email Analysis - The email is sent to an AI model that analyzes the message and returns structured JSON data including: - summary - category - priority - department - attachment detection - action required - spam detection 6. Department Lookup - The workflow looks up the responsible department contact using an Excel 365 sheet that maps departments to their respective PIC (Person in Charge). 7. Email Logging - The analyzed email data is appended to an Excel sheet for tracking and auditing. 8. Telegram Notification - The responsible department PIC receives a Telegram notification containing the email summary and priority details. Setup Steps 1. Import the Workflow Import the workflow JSON file into your n8n instance. 2. Configure Email Trigger Connect your email account using one of the following: - IMAP - Gmail - Outlook Set the trigger to detect new incoming emails. 3. Configure OpenAI Add your OpenAI API credentials in n8n. The AI model is used to analyze incoming email content and generate structured data such as summary, category, department, and priority. 4. Prepare the Excel File Create an Excel file with two sheets. File example: EmailAutomation.xlsx Sheet 1: EmailLog ---------------------------------------------------------------------------------------------------------- Timestamp Sender Subject Category Priority Department Action Attachment Spam Summary Required ----------- -------- --------- ---------- ---------- ------------ ---------- ------------ ------ --------- This sheet stores the processed email records for auditing and tracking. Sheet 2: DepartmentRouting Department PICName Email TelegramChatID ------------ ---------- ------------------- ------------------ Support Andi [email protected] 12345678 Sales Rina [email protected] 23456789 Finance Budi [email protected] 34567890 Technical Dodi [email protected] 45678901 Management CEO [email protected] 56789012 General Admin [email protected] 67890123 This sheet maps departments to the responsible team member and their Telegram chat ID. 5. Configure Telegram Create a Telegram Bot and connect it to n8n. Ensure the Telegram Chat IDs in the Excel routing sheet are correct so notifications are delivered to the right person. 6. Configure Excel Credentials Connect your Excel 365 account to n8n and select the Excel file used for logging and department routing. 7. Test the Workflow Send a test email to you