Asistente de correo electrónico inteligente con clasificación de IA, borrador de Gmail y notificación de Slack
Este es unTicket Management, AI Summarizationflujo de automatización del dominio deautomatización que contiene 16 nodos.Utiliza principalmente nodos como Set, Code, Gmail, Slack, Switch. Automatización de la gestión de correos con clasificación de OpenAI, borradores de Gmail y recordatorios de Slack
- •Cuenta de Google y credenciales de API de Gmail
- •Bot Token de Slack o URL de Webhook
- •Clave de API de OpenAI
Nodos utilizados (16)
Categoría
{
"id": "FSJP3VvgYM0hlloV",
"meta": {
"instanceId": "1ada9ce9d909de0cc535c0dfb57eee784c801e364e1670e7476e5ce8b69d1197"
},
"name": "Intelligent Email Assistant with AI Classification, Gmail Drafts, and Slack Notifications",
"tags": [
{
"id": "grLYSyd5iJcUTmvb",
"name": "ZenAgent Labs",
"createdAt": "2025-06-29T14:28:06.655Z",
"updatedAt": "2025-06-29T14:28:06.655Z"
}
],
"nodes": [
{
"id": "e777600d-4456-4bcd-b356-231a340e8da7",
"name": "Descripción del Flujo de Trabajo",
"type": "n8n-nodes-base.stickyNote",
"position": [
-700,
140
],
"parameters": {
"width": 550,
"height": 1300,
"content": "## Intelligent Email Assistant with AI Classification, Gmail Drafts, and Slack Notifications\n\n**Created by [ZenAgent Labs](https://zenagentlabs.com)**\n\n\n\n### What it does\nThis workflow automatically processes incoming emails with intelligent AI classification, creating draft responses and sending Slack notifications based on email content.\n\n### How it works\n1. **Monitors emails** with the 'AI-Agent' label\n2. **AI classification** into categories: Inquiry, Support, Newsletter, Action Item\n3. **Adds appropriate labels** to emails automatically\n4. **Creates draft replies** for Support and Inquiry emails\n5. **Sends Slack notifications** for Action Items and Newsletter summaries\n\n### Setup Requirements\n- Gmail OAuth2 credentials configured\n- OpenAI API credentials (or other AI provider)\n- Slack OAuth2 credentials (if notifications desired)\n- Gmail labels created (see setup instructions below)\n\n### How to customize\n- Modify classification categories in the AI Agent\n- Adjust label mappings in the Parse Classification node\n- Customize draft response templates\n- Configure different Slack channels for different email types"
},
"typeVersion": 1
},
{
"id": "5825d614-da89-4262-810b-074f5a788ac4",
"name": "Instrucciones de Configuración de Gmail",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
680
],
"parameters": {
"width": 380,
"height": 580,
"content": "## Gmail Label Setup Instructions\n\n**IMPORTANT:** You need to create these Gmail labels first:\n\n1. **Primary Label:** 'AI-Agent' (trigger label)\n2. **Classification Labels:**\n - 'Inquiry' \n - 'Support'\n - 'Newsletter'\n - 'Action-Item'\n\n**How to get Label IDs:**\n1. Run the Gmail Trigger node once\n2. Check the node output for available labels\n3. Copy the Label IDs and update the Parse Classification code\n4. Replace the Label IDs in the labelMapping object\n\n**Label Mapping (update these after you run the gmail node for the first time!):**\n- Inquiry: Label_123456789\n- Action-Item: Label_123456789\n- Support: Label_123456789\n- Newsletter: Label_123456789"
},
"typeVersion": 1
},
{
"id": "6a4ce1eb-3e14-4f7b-8dd2-884858e9edd3",
"name": "Activador Gmail - Etiqueta de Agente de IA",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
520,
660
],
"parameters": {
"simple": false,
"filters": {
"labelIds": []
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "LwfJ8b1o1ZOBYMwi",
"name": "Gmail ZNTL"
}
},
"typeVersion": 1
},
{
"id": "575d0664-15f9-4c1a-bb85-702aa7406f02",
"name": "Extraer Datos del Correo",
"type": "n8n-nodes-base.set",
"position": [
740,
660
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "email-id",
"name": "emailId",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "email-subject",
"name": "subject",
"type": "string",
"value": "={{ $json.subject }}"
},
{
"id": "email-from",
"name": "sender",
"type": "string",
"value": "={{ $json.from }}"
},
{
"id": "email-body",
"name": "content",
"type": "string",
"value": "={{ $json.text || $json.html }}"
},
{
"id": "timestamp",
"name": "receivedAt",
"type": "string",
"value": "={{ $json.date }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9dc28e85-da76-4a56-bab7-2449eeeabd5a",
"name": "Agente de IA - Clasificador de Correo",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
960,
660
],
"parameters": {
"text": "=Email to analyze:\nFrom: {{ $json.sender }}\nSubject: {{ $json.subject }}\nContent: {{ $json.content }}",
"options": {
"systemMessage": "=You are an AI assistant for email classification. Your task is to analyze incoming emails and categorize them into one of the following categories:\n\n1. **Inquiry** - Requests from partners, prospects, or your network\n2. **Support** - Customer support requests, complaints, or help requests\n3. **Newsletter** - Marketing emails, newsletters, or promotional content\n4. **Actionpoint** - Emails requiring immediate action or follow-up tasks\n\nAnalyze the email content including:\n- Sender information\n- Subject line\n- Email content\n- Tone and urgency\n\nRespond with a JSON object in exactly this format:\n{\n \"category\": \"[One of: Inquiry, Support, Newsletter, Actionpoint]\",\n \"confidence\": [0.0-1.0],\n \"reasoning\": \"Brief explanation of why this category was chosen\",\n \"suggestedResponse\": \"Only for Inquiry and Support emails: A professional, friendly draft response in English\",\n \"summary\": \"Only for Newsletter emails: A summary of essential information. Particularly interesting and noteworthy for me are infos about AI agents and AI automation\"\n}\n\n"
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "32502ca5-832f-4bf6-85b8-18452071d589",
"name": "Modelo de Chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
920,
920
],
"parameters": {
"model": "o3",
"options": {
"responseFormat": "json_object"
}
},
"typeVersion": 1
},
{
"id": "73c4e031-badb-4562-b791-4843c4b12cf9",
"name": "Analizar Clasificación de IA",
"type": "n8n-nodes-base.code",
"position": [
1280,
660
],
"parameters": {
"jsCode": "// Parse AI Agent output and prepare for routing\nconst aiOutput = $input.first().json.output;\nlet classification;\n\ntry {\n // Parse JSON string output from AI Agent\n classification = JSON.parse(aiOutput);\n} catch (error) {\n // Fallback if parsing fails\n classification = {\n category: \"Support\",\n confidence: 0.5,\n reasoning: \"AI response could not be parsed, defaulting to Support\",\n suggestedResponse: \"\"\n };\n}\n\n// Map categories to Gmail Label IDs\n// IMPORTANT: Update these Label IDs with your actual Gmail label IDs\nconst labelMapping = {\n \"Inquiry\": \"Label_123456789\",\n \"Actionpoint\": \"Label_123456789\", \n \"Support\": \"Label_123456789\",\n \"Newsletter\": \"Label_123456789\"\n};\n\n// Combine with original email data and add label ID\nreturn {\n json: {\n ...classification,\n labelId: labelMapping[classification.category] || labelMapping[\"Support\"], // Fallback to Support\n emailId: $('Extract Email Data').first().json.emailId,\n subject: $('Extract Email Data').first().json.subject,\n sender: $('Extract Email Data').first().json.sender,\n content: $('Extract Email Data').first().json.content,\n receivedAt: $('Extract Email Data').first().json.receivedAt\n }\n};"
},
"typeVersion": 2
},
{
"id": "858a4fbf-7ba3-497b-955c-20be5d6148c0",
"name": "Información de Clasificación de IA",
"type": "n8n-nodes-base.stickyNote",
"position": [
920,
140
],
"parameters": {
"width": 380,
"height": 380,
"content": "## AI Classification Logic\n\nThe AI analyzes emails based on:\n- **Sender domain** and content\n- **Keywords** in subject/content\n- **Tone** and urgency indicators\n- **Request patterns**\n\nConfidence values help with accuracy control.\n\n**Classification Categories:**\n- **Inquiry:** Partner/prospect requests\n- **Support:** Customer help requests\n- **Newsletter:** Marketing/promotional content\n- **Actionpoint:** Urgent tasks requiring action"
},
"typeVersion": 1
},
{
"id": "cfa9478c-ed03-4c78-b910-be6e48528888",
"name": "Agregar Etiqueta de Clasificación",
"type": "n8n-nodes-base.gmail",
"position": [
1480,
660
],
"webhookId": "78dd2938-c072-41b1-97c2-e526313dcdba",
"parameters": {
"labelIds": "={{ $json.labelId }}",
"messageId": "={{ $('Gmail Trigger - AI Agent Label').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "LwfJ8b1o1ZOBYMwi",
"name": "Gmail ZNTL"
}
},
"typeVersion": 2.1
},
{
"id": "30ca3a6d-775d-485c-b978-3b902d94bda4",
"name": "Enrutar por Categoría",
"type": "n8n-nodes-base.switch",
"position": [
1680,
660
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Draft",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bcdd0c26-f15f-495d-851f-428448a4809d",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Parse AI Classification').item.json.category }}",
"rightValue": "=Support"
}
]
},
"renameOutput": true
},
{
"outputKey": "Draft",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1e4a4ac3-9a17-4431-ba3c-57143c1c3d4f",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Parse AI Classification').item.json.category }}",
"rightValue": "Inquiry"
}
]
},
"renameOutput": true
},
{
"outputKey": "Newsletter",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "92882b71-a38c-456d-a767-9db4920c95a5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Parse AI Classification').item.json.category }}",
"rightValue": "Newsletter"
}
]
},
"renameOutput": true
},
{
"outputKey": "Actionpoint",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3e4709bf-e84e-4963-af62-2b49f2147ca3",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Parse AI Classification').item.json.category }}",
"rightValue": "Actionpoint"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "none"
}
},
"typeVersion": 3
},
{
"id": "2bb9e810-b62b-43b5-9018-8a4ee43da90e",
"name": "Información de Acciones de Éxito",
"type": "n8n-nodes-base.stickyNote",
"position": [
2440,
280
],
"parameters": {
"color": 4,
"width": 320,
"height": 280,
"content": "## Workflow Actions Summary\n\n✅ **Inquiry/Support emails** → Draft responses created\n✅ **Action Items** → Slack notifications sent\n✅ **Newsletters** → Slack summaries sent\n✅ **All emails** → Automatically labeled\n\n### Extension Possibilities:\n- Log to spreadsheet/database\n- Create tickets in support system\n- Send webhooks to external systems\n- Custom notification channels\n- Integration with CRM systems"
},
"typeVersion": 1
},
{
"id": "713a3bc5-8e0f-46f4-ad9b-87d7adc07dbd",
"name": "Información de Manejo de Errores",
"type": "n8n-nodes-base.stickyNote",
"position": [
2440,
600
],
"parameters": {
"color": 5,
"width": 320,
"height": 240,
"content": "## Error Handling & Monitoring\n\n### Current Features:\n- Fallback classification to 'Support'\n- JSON parsing error handling\n- Confidence scoring for accuracy\n\n### Enhancement Options:\n- Error notifications via Slack/email\n- Retry logic for failed classifications\n- Logging of failed attempts\n- Performance monitoring dashboard\n- Manual review queue for low-confidence items"
},
"typeVersion": 1
},
{
"id": "ba402d17-fb77-419e-87f2-f00414cf0892",
"name": "Crear Borrador de Respuesta",
"type": "n8n-nodes-base.gmail",
"position": [
2080,
460
],
"webhookId": "e8d40041-6c0e-47c1-9c46-68e073deb903",
"parameters": {
"message": "={{ $('Parse AI Classification').item.json.suggestedResponse }}",
"options": {
"threadId": "={{ $('Gmail Trigger - AI Agent Label').item.json.threadId }}"
},
"subject": "=Re: {{ $json.subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "LwfJ8b1o1ZOBYMwi",
"name": "Gmail ZNTL"
}
},
"typeVersion": 2.1
},
{
"id": "59934725-d2f3-4faf-a9db-8a4187a81081",
"name": "Enviar Alerta de Elemento de Acción a Slack",
"type": "n8n-nodes-base.slack",
"position": [
2080,
840
],
"webhookId": "2f189afd-e368-4b6a-910a-1fb14d57fb2e",
"parameters": {
"operation": "postMessage"
},
"typeVersion": 2.2
},
{
"id": "78cce31c-12b8-4c89-b362-07f92be4b3a9",
"name": "Enviar Resumen de Boletín a Slack",
"type": "n8n-nodes-base.slack",
"position": [
2080,
660
],
"webhookId": "1aa89f39-9101-4859-8515-c9796a8335a5",
"parameters": {
"operation": "postMessage"
},
"typeVersion": 2.3
},
{
"id": "f19d4daa-ff84-4421-8170-c7c9c86321f2",
"name": "Instrucciones de Configuración de Slack",
"type": "n8n-nodes-base.stickyNote",
"position": [
1940,
20
],
"parameters": {
"width": 380,
"height": 360,
"content": "## Slack Integration Setup\n\n### Required Configuration:\n1. **Create Slack App** at api.slack.com\n2. **Add OAuth Scopes:**\n - `chat:write`\n - `channels:read`\n - `users:read`\n\n3. **Create Channels:**\n - `#action-items` (for urgent emails)\n - `#newsletters` (for newsletter summaries)\n\n4. **Customize Message Format:**\n - Edit the text templates in Slack nodes\n - Add mentions (@channel, @here)\n - Include custom formatting/emojis\n\n5. **Optional:** Configure different channels per email type"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "60db44aa-f739-4a39-a086-f0726955927a",
"connections": {
"32502ca5-832f-4bf6-85b8-18452071d589": {
"ai_languageModel": [
[
{
"node": "9dc28e85-da76-4a56-bab7-2449eeeabd5a",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"30ca3a6d-775d-485c-b978-3b902d94bda4": {
"main": [
[
{
"node": "ba402d17-fb77-419e-87f2-f00414cf0892",
"type": "main",
"index": 0
}
],
[
{
"node": "ba402d17-fb77-419e-87f2-f00414cf0892",
"type": "main",
"index": 0
}
],
[
{
"node": "78cce31c-12b8-4c89-b362-07f92be4b3a9",
"type": "main",
"index": 0
}
],
[
{
"node": "59934725-d2f3-4faf-a9db-8a4187a81081",
"type": "main",
"index": 0
}
]
]
},
"575d0664-15f9-4c1a-bb85-702aa7406f02": {
"main": [
[
{
"node": "9dc28e85-da76-4a56-bab7-2449eeeabd5a",
"type": "main",
"index": 0
}
]
]
},
"73c4e031-badb-4562-b791-4843c4b12cf9": {
"main": [
[
{
"node": "cfa9478c-ed03-4c78-b910-be6e48528888",
"type": "main",
"index": 0
}
]
]
},
"cfa9478c-ed03-4c78-b910-be6e48528888": {
"main": [
[
{
"node": "30ca3a6d-775d-485c-b978-3b902d94bda4",
"type": "main",
"index": 0
}
]
]
},
"9dc28e85-da76-4a56-bab7-2449eeeabd5a": {
"main": [
[
{
"node": "73c4e031-badb-4562-b791-4843c4b12cf9",
"type": "main",
"index": 0
}
]
]
},
"6a4ce1eb-3e14-4f7b-8dd2-884858e9edd3": {
"main": [
[
{
"node": "575d0664-15f9-4c1a-bb85-702aa7406f02",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Gestión de tickets, Resumen de IA
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Fabian ZNTL
@zntlCompartir este flujo de trabajo