Sistema automatizado de clasificación y respuesta de correos con Gmail, GPT y hojas de cálculo
Este es unAI Summarization, Multimodal AIflujo de automatización del dominio deautomatización que contiene 35 nodos.Utiliza principalmente nodos como Set, Gmail, ErrorTrigger, GmailTrigger, GoogleSheets. Sistema automatizado de clasificación y respuesta de correos electrónicos usando Gmail, GPT y Hojas de Cálculo
- •Cuenta de Google y credenciales de API de Gmail
- •Credenciales de API de Google Sheets
- •Clave de API de OpenAI
Nodos utilizados (35)
Categoría
{
"meta": {
"instanceId": "e2e2c9bc62a9282c580eaa52732abefcb4fb323e22933a39566356c65407044d",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "a75f0c4e-9b1e-4f76-81a7-903707c0548a",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-1376,
528
],
"parameters": {
"simple": false,
"filters": {
"labelIds": [
"INBOX"
],
"readStatus": "unread"
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 1.2
},
{
"id": "53354083-ac12-458b-a234-773b6ba38b7e",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
464
],
"parameters": {
"color": 5,
"width": 512,
"height": 224,
"content": "## Label Mail"
},
"typeVersion": 1
},
{
"id": "7e47b472-0331-4bc5-bba8-bda3f42b4e9e",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
720
],
"parameters": {
"color": 5,
"width": 512,
"height": 224,
"content": "## Label Mail"
},
"typeVersion": 1
},
{
"id": "b0c7e415-5528-4387-a029-60486c04b92e",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
976
],
"parameters": {
"color": 5,
"width": 512,
"height": 224,
"content": "## Label Mail"
},
"typeVersion": 1
},
{
"id": "da115060-3031-4b1c-8a10-5b0e79334817",
"name": "etiqueta de reclamaciones",
"type": "n8n-nodes-base.gmail",
"position": [
-608,
528
],
"webhookId": "fff737dc-0d9b-4611-acb0-de62ede274ea",
"parameters": {
"labelIds": [
"Label_2738167986001899947"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "189ecb15-a0dd-427a-9985-f234bcc45ca8",
"name": "etiqueta de información",
"type": "n8n-nodes-base.gmail",
"position": [
-608,
784
],
"webhookId": "8d689704-d3bb-40cb-9fd4-75c4f8bafe2a",
"parameters": {
"labelIds": [
"Label_8719801794646735130"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "18a8ab55-c133-4477-92ef-3e8c32ef97c4",
"name": "otra etiqueta",
"type": "n8n-nodes-base.gmail",
"position": [
-608,
1040
],
"webhookId": "6e72bf33-af69-4da5-a7b9-c7d6e9634a96",
"parameters": {
"labelIds": [
"UNREAD"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "346a2604-416c-4064-9cb1-173d81cd961d",
"name": "Clasificador de Correos",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-1184,
480
],
"parameters": {
"options": {
"fallback": "other"
},
"inputText": "=Subject: {{ $('Gmail Trigger').item.json.subject }}\nText: {{ $('Gmail Trigger').item.json.text }}",
"categories": {
"categories": [
{
"category": "support",
"description": "Emails requesting help, troubleshooting, or guidance regarding products or services. Includes technical issues, user problems, or requests for assistance."
},
{
"category": "sales",
"description": "Emails expressing interest in products or services, requests for quotes, proposals, or meetings with the sales team. Potential client inquiries fall here."
},
{
"category": "complaints",
"description": "Emails expressing dissatisfaction, reporting errors, or filing complaints. Includes customer grievances or urgent service issues."
},
{
"category": "information",
"description": "Emails seeking general information, clarifications, or communication that doesn’t fit Support, Sales, or Complaints."
}
]
}
},
"typeVersion": 1.1
},
{
"id": "bcf2a2b4-2f78-47f3-bd1d-500f3eff0851",
"name": "Establecer 2",
"type": "n8n-nodes-base.set",
"position": [
-400,
528
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
"name": "Decision",
"type": "string",
"value": "Compliants"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f26299b0-795b-46c7-b255-0588a9976f50",
"name": "Establecer 3",
"type": "n8n-nodes-base.set",
"position": [
-400,
784
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
"name": "Decision",
"type": "string",
"value": "Info"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7f458771-5e7f-4fcb-be7d-da4349bda1e6",
"name": "Establecer 4",
"type": "n8n-nodes-base.set",
"position": [
-400,
1040
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
"name": "Decision",
"type": "string",
"value": "Other"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "cf5a3309-f478-418a-9ff3-d8dfb7cc3c8c",
"name": "Nota Adhesiva7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
480
],
"parameters": {
"color": 4,
"height": 192,
"content": "## Set the decision"
},
"typeVersion": 1
},
{
"id": "6262ee85-fef2-4c99-ac5a-c57b0e5e4fff",
"name": "Nota Adhesiva8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
736
],
"parameters": {
"color": 4,
"height": 192,
"content": "## Set the decision"
},
"typeVersion": 1
},
{
"id": "e2abc12a-b6ad-4f15-abc7-13735439ab90",
"name": "Nota Adhesiva9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
992
],
"parameters": {
"color": 4,
"height": 192,
"content": "## Set the decision"
},
"typeVersion": 1
},
{
"id": "41e62dfb-3838-499c-984c-e0057030ab4f",
"name": "Google Sheets2",
"type": "n8n-nodes-base.googleSheets",
"position": [
192,
784
],
"parameters": {
"columns": {
"value": {
"Decision": "={{ $json.Decision }}",
"Original Email": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\nBody: {{ $('Gmail Trigger').item.json.text }}"
},
"schema": [
{
"id": "Original Email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Original Email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Decision",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Decision",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Output Email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Output Email",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=0",
"cachedResultName": "Hoja 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
"cachedResultName": "Log Email Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gEJv4DaO8m5nfe0p",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "cc204b45-f8bb-4f07-98f7-52e55f6e79c2",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
480,
-48
],
"parameters": {
"columns": {
"value": {
"Decision": "={{ $json.Decision }}",
"Output Email": "=Subject: {{ $json.Subject_email }}\nBody: {{ $json.Body_email }}",
"Original Email": "=Subject: {{ $('Gmail Trigger').item.json.headers.subject }}\nBody: {{ $('Gmail Trigger').item.json.text }}"
},
"schema": [
{
"id": "Original Email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Original Email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Decision",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Decision",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Output Email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Output Email",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=0",
"cachedResultName": "Hoja 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
"cachedResultName": "Log Email Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gEJv4DaO8m5nfe0p",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "a4f688e0-5cdb-4454-a344-159add0f83af",
"name": "Sin Operación, no hacer nada",
"type": "n8n-nodes-base.noOp",
"position": [
-48,
784
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3210d7da-9a37-47d2-b66f-28f16b9998b2",
"name": "Sin Operación, no hacer nada1",
"type": "n8n-nodes-base.noOp",
"position": [
288,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0a55cbc0-ef79-496f-af1d-d420761a17cb",
"name": "Nota Adhesiva10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
48
],
"parameters": {
"color": 5,
"width": 884,
"height": 392,
"content": "## Automatic Response Sales"
},
"typeVersion": 1
},
{
"id": "67177cb9-e14b-438b-91b0-af64395dde65",
"name": "Nota Adhesiva11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-352
],
"parameters": {
"color": 5,
"width": 884,
"height": 376,
"content": "## Automatic Response Support"
},
"typeVersion": 1
},
{
"id": "635385df-9465-42ee-8e86-8996d1fe33d2",
"name": "Nota Adhesiva12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
64
],
"parameters": {
"color": 4,
"height": 240,
"content": "## Set the decision"
},
"typeVersion": 1
},
{
"id": "bb0f23e1-caa2-4a3c-843d-c753d05af101",
"name": "Nota Adhesiva13",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
-336
],
"parameters": {
"color": 4,
"height": 240,
"content": "## Set the decision"
},
"typeVersion": 1
},
{
"id": "e81d3f4d-b225-478e-9f85-0ed9064dcad1",
"name": "Añadir etiqueta al hilo",
"type": "n8n-nodes-base.gmail",
"position": [
-288,
288
],
"webhookId": "387c376b-2719-444a-89c3-c0e3473586c1",
"parameters": {
"labelIds": [
"Label_3720213495654917937"
],
"resource": "thread",
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "8b549ecf-6957-4789-9353-379f3fb35b38",
"name": "Crear un borrador: Ventas",
"type": "n8n-nodes-base.gmail",
"position": [
-288,
128
],
"webhookId": "f5d02136-1293-468a-8fcf-b7ada04051a8",
"parameters": {
"message": "={{ $json.message.content.Body }}",
"options": {
"sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}",
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "1aec5594-f0a0-41e0-af09-63fbfafc4f1e",
"name": "Añadir etiqueta al hilo1",
"type": "n8n-nodes-base.gmail",
"position": [
-288,
-128
],
"webhookId": "a772d53d-e42c-4b5f-bf56-7f7156a75130",
"parameters": {
"labelIds": [
"Label_7294717935753585870"
],
"resource": "thread",
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "ebfc12bd-f8bb-4590-b25f-09ab4e9a1fd5",
"name": "Crear un borrador: Soporte",
"type": "n8n-nodes-base.gmail",
"position": [
-288,
-288
],
"webhookId": "f5d02136-1293-468a-8fcf-b7ada04051a8",
"parameters": {
"message": "={{ $json.message.content.Body }}",
"options": {
"sendTo": "={{ $('Gmail Trigger').item.json.from.value[0].address }}",
"threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "cWqq2EMH5CzPA1AE",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "bb8c3533-c0a8-47d1-bf4d-834daaa778d3",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1184,
736
],
"parameters": {
"model": {
"__rl": true,
"mode": "id",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "3yvFVeLWONpgXkMW",
"name": "OpenRouter Account"
}
},
"typeVersion": 1.2
},
{
"id": "91a3f31d-aa81-4df0-967b-b594bcf49513",
"name": "Enviar mensaje a un modelo: Soporte",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-608,
-208
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "id",
"value": "gpt-4.1-mini"
},
"options": {},
"messages": {
"values": [
{
"content": "=Hemos recibido el siguiente mensaje de {{ $('Gmail Trigger').item.json.headers.from.replace(/^From:\\s*/, '').match(/^(.*?)(?=\\s*<)/)[1] }}:\n\n\"{{ $('Gmail Trigger').item.json.text }}\"\n\nRedacta una respuesta profesional en función del mensaje y esta información.\n"
},
{
"role": "assistant",
"content": "=You are an AI assistant for a professional company. \nGenerate a polite and concise email reply to a support request. \nThe output must always be in valid JSON with two fields: Subject and Body.\n\nRules:\n- Subject: short and professional, e.g. \"We received your request\".\n- Body: acknowledge receipt, mention that support will contact them shortly, under 80 words.\n- Keep tone professional and friendly.\n- Personalize with the sender's name if available.\n- Do not add anything outside the JSON.\n\nExamples of proper JSON outputs:\n{\n \"Subject\": \"We received your request\",\n \"Body\": \"Hi John, thank you for reaching out. Our support team will review your issue and contact you shortly.\"\n}\n{\n \"Subject\": \"Support request received\",\n \"Body\": \"Hello Sarah, we’ve received your message. A specialist will contact you soon to assist you.\"\n}\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "3yvFVeLWONpgXkMW",
"name": "OpenRouter Account"
}
},
"executeOnce": false,
"retryOnFail": true,
"typeVersion": 1.8
},
{
"id": "bf409083-7bd8-42ff-a88a-7d0f7f73da69",
"name": "Enviar mensaje a un modelo: Ventas",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-624,
208
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "id",
"value": "gpt-4.1-mini"
},
"options": {},
"messages": {
"values": [
{
"content": "=Hemos recibido el siguiente mensaje de {{ $('Gmail Trigger').item.json.headers.from.replace(/^From:\\s*/, '').match(/^(.*?)(?=\\s*<)/)[1] }}:\n\n\"{{ $('Gmail Trigger').item.json.text }}\"\n\nRedacta una respuesta profesional en función del mensaje y esta información.\n"
},
{
"role": "assistant",
"content": "=You are an AI assistant for a professional company. \nGenerate a polite and concise email reply to a sales inquiry. \nThe output must always be in valid JSON with two fields: Subject and Body.\n\nRules:\n- Subject: short and professional, e.g. \"Thank you for your interest\".\n- Body: thank them for their interest, mention the sales team will get back shortly, under 80 words.\n- Keep tone professional and friendly.\n- Personalize with the sender's name if available.\n- Do not add anything outside the JSON.\n\nExamples of proper JSON outputs:\n{\n \"Subject\": \"Thank you for your interest\",\n \"Body\": \"Hi Anna, thank you for your interest in our services. Our sales team will contact you shortly to discuss your needs.\"\n}\n{\n \"Subject\": \"We appreciate your inquiry\",\n \"Body\": \"Hello Peter, we appreciate your message. A member of our sales team will reach out soon with more details.\"\n}\n\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "3yvFVeLWONpgXkMW",
"name": "OpenRouter Account"
}
},
"retryOnFail": true,
"typeVersion": 1.8
},
{
"id": "639b1fb2-53c4-4231-9347-bc481fc0fc31",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
1232
],
"parameters": {
"color": 3,
"width": 512,
"height": 224,
"content": "## You can add as much as you need"
},
"typeVersion": 1
},
{
"id": "84f2f08a-7ff3-4ed1-916e-939ca497a944",
"name": "Añadir fila en hoja",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1168,
1072
],
"parameters": {
"columns": {
"value": {
"Time": "={{ $now.format('dd-MM-yyyy hh:mm:ss') }}",
"Workflow ID": "={{ $workflow.id }}",
"Execution ID": "={{ $execution.id }}",
"Error Message": "={{ $json.execution.error.message }}",
"Node with Error": "={{ $json.execution.lastNodeExecuted }}"
},
"schema": [
{
"id": "Node with Error",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Node with Error",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Error Message",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Error Message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Time",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Time",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Execution ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Execution ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Workflow ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Workflow ID",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Error"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 390118099,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit#gid=390118099",
"cachedResultName": "Errors"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SutRXvFjLnnbnakCTNN0O4LqsG-y5nPGDXmipk3EAzE/edit?usp=drivesdk",
"cachedResultName": "Log Email Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gEJv4DaO8m5nfe0p",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
},
{
"id": "6b9fa983-ec6c-4a7c-bda7-e922ad9ae19c",
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"position": [
-1344,
1072
],
"parameters": {},
"typeVersion": 1
},
{
"id": "114acc6a-897b-4c73-a596-76f089e93cd0",
"name": "Establecer",
"type": "n8n-nodes-base.set",
"position": [
-64,
-288
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
"name": "Decision",
"type": "string",
"value": "Sales"
},
{
"id": "35d39d93-dbfa-43ec-8100-6df72a2874db",
"name": "Subject_email",
"type": "string",
"value": "={{ $('Message a model: Support').item.json.message.content.Subject }}"
},
{
"id": "ed3606d1-16ca-4089-8398-df6490e9e8ad",
"name": "Body_email",
"type": "string",
"value": "={{ $('Message a model: Support').item.json.message.content.Body }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "32f8f930-2db3-4d3f-9134-11d40cd2f655",
"name": "Establecer 1",
"type": "n8n-nodes-base.set",
"position": [
-64,
128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b47eaf61-7201-45b5-993a-cbcfaa5765f7",
"name": "Decision",
"type": "string",
"value": "Sales"
},
{
"id": "35d39d93-dbfa-43ec-8100-6df72a2874db",
"name": "Subject_email",
"type": "string",
"value": "={{ $('Message a model: Sales').item.json.message.content.Subject }}"
},
{
"id": "ed3606d1-16ca-4089-8398-df6490e9e8ad",
"name": "Body_email",
"type": "string",
"value": "={{ $('Message a model: Sales').item.json.message.content.Body }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "28a2c29e-c959-4a2e-ae80-5afec769d8cd",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2176,
48
],
"parameters": {
"color": 3,
"width": 688,
"height": 1328,
"content": "# Email Automation Workflow\n\n## Overview\n### Automates email classification in Gmail and generates drafts using OpenAI and Google Sheets. Emails are categorized as Support, Sales, Complaints, Information, or Other, labeled accordingly, draft responses are created, and logs and errors are recorded.\n\n---\n\n## Quick Start\n\n1. **Gmail Trigger** \n - Detects new emails every minute.\n\n2. **Email Classification** \n - Categories: `support`, `sales`, `complaints`, `information`, `other`...\n\n3. **Actions by Category** \n - **Support / Sales:** generates Gmail draft with Subject and Body. \n - **Complaints / Information / Other:** applies label to the email.\n\n4. **Google Sheets Logging** \n - **Logs:** `Original Email`, `Decision`, `Output Email`. \n - **Errors:** `Node with Error`, `Error Message`, `Time`, `Execution ID`, `Workflow ID`. \n - Make sure nodes reference the correct `documentId` and `sheetName`.\n\n5. **Error Handling** \n - `Error Trigger` automatically records workflow errors in the Errors sheet.\n\n---\n\n## Quick Start Checklist\n\n- [ ] Configure Gmail OAuth2 credentials. \n- [ ] Set up OpenAI credentials for Support and Sales nodes. \n- [ ] Create Google Sheets with `Logs` and `Errors` sheets and the correct columns. \n- [ ] Verify `documentId` and `sheetName` in all Sheets nodes. \n- [ ] Check classification and labeling nodes. \n- [ ] Test with a sample email to confirm draft creation and logging.\n---\n\nReady to activate: add credentials, check sheet IDs, and test with a sample email.\n"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"114acc6a-897b-4c73-a596-76f089e93cd0": {
"main": [
[
{
"node": "3210d7da-9a37-47d2-b66f-28f16b9998b2",
"type": "main",
"index": 0
}
]
]
},
"32f8f930-2db3-4d3f-9134-11d40cd2f655": {
"main": [
[
{
"node": "3210d7da-9a37-47d2-b66f-28f16b9998b2",
"type": "main",
"index": 0
}
]
]
},
"bcf2a2b4-2f78-47f3-bd1d-500f3eff0851": {
"main": [
[
{
"node": "a4f688e0-5cdb-4454-a344-159add0f83af",
"type": "main",
"index": 0
}
]
]
},
"f26299b0-795b-46c7-b255-0588a9976f50": {
"main": [
[
{
"node": "a4f688e0-5cdb-4454-a344-159add0f83af",
"type": "main",
"index": 0
}
]
]
},
"7f458771-5e7f-4fcb-be7d-da4349bda1e6": {
"main": [
[
{
"node": "a4f688e0-5cdb-4454-a344-159add0f83af",
"type": "main",
"index": 0
}
]
]
},
"189ecb15-a0dd-427a-9985-f234bcc45ca8": {
"main": [
[
{
"node": "f26299b0-795b-46c7-b255-0588a9976f50",
"type": "main",
"index": 0
}
]
]
},
"18a8ab55-c133-4477-92ef-3e8c32ef97c4": {
"main": [
[
{
"node": "7f458771-5e7f-4fcb-be7d-da4349bda1e6",
"type": "main",
"index": 0
}
]
]
},
"6b9fa983-ec6c-4a7c-bda7-e922ad9ae19c": {
"main": [
[
{
"node": "84f2f08a-7ff3-4ed1-916e-939ca497a944",
"type": "main",
"index": 0
}
]
]
},
"a75f0c4e-9b1e-4f76-81a7-903707c0548a": {
"main": [
[
{
"node": "346a2604-416c-4064-9cb1-173d81cd961d",
"type": "main",
"index": 0
}
]
]
},
"346a2604-416c-4064-9cb1-173d81cd961d": {
"main": [
[
{
"node": "91a3f31d-aa81-4df0-967b-b594bcf49513",
"type": "main",
"index": 0
}
],
[
{
"node": "bf409083-7bd8-42ff-a88a-7d0f7f73da69",
"type": "main",
"index": 0
}
],
[
{
"node": "da115060-3031-4b1c-8a10-5b0e79334817",
"type": "main",
"index": 0
}
],
[
{
"node": "189ecb15-a0dd-427a-9985-f234bcc45ca8",
"type": "main",
"index": 0
}
],
[
{
"node": "18a8ab55-c133-4477-92ef-3e8c32ef97c4",
"type": "main",
"index": 0
}
],
[],
[],
[]
]
},
"da115060-3031-4b1c-8a10-5b0e79334817": {
"main": [
[
{
"node": "bcf2a2b4-2f78-47f3-bd1d-500f3eff0851",
"type": "main",
"index": 0
}
]
]
},
"bb8c3533-c0a8-47d1-bf4d-834daaa778d3": {
"ai_languageModel": [
[
{
"node": "346a2604-416c-4064-9cb1-173d81cd961d",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"e81d3f4d-b225-478e-9f85-0ed9064dcad1": {
"main": [
[]
]
},
"8b549ecf-6957-4789-9353-379f3fb35b38": {
"main": [
[
{
"node": "32f8f930-2db3-4d3f-9134-11d40cd2f655",
"type": "main",
"index": 0
}
]
]
},
"bf409083-7bd8-42ff-a88a-7d0f7f73da69": {
"main": [
[
{
"node": "8b549ecf-6957-4789-9353-379f3fb35b38",
"type": "main",
"index": 0
},
{
"node": "e81d3f4d-b225-478e-9f85-0ed9064dcad1",
"type": "main",
"index": 0
}
]
]
},
"ebfc12bd-f8bb-4590-b25f-09ab4e9a1fd5": {
"main": [
[
{
"node": "114acc6a-897b-4c73-a596-76f089e93cd0",
"type": "main",
"index": 0
}
]
]
},
"91a3f31d-aa81-4df0-967b-b594bcf49513": {
"main": [
[
{
"node": "1aec5594-f0a0-41e0-af09-63fbfafc4f1e",
"type": "main",
"index": 0
},
{
"node": "ebfc12bd-f8bb-4590-b25f-09ab4e9a1fd5",
"type": "main",
"index": 0
}
]
]
},
"a4f688e0-5cdb-4454-a344-159add0f83af": {
"main": [
[
{
"node": "41e62dfb-3838-499c-984c-e0057030ab4f",
"type": "main",
"index": 0
}
]
]
},
"3210d7da-9a37-47d2-b66f-28f16b9998b2": {
"main": [
[
{
"node": "cc204b45-f8bb-4f07-98f7-52e55f6e79c2",
"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 - Resumen de IA, IA Multimodal
¿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
Sergio Afonso
@sergioafonsoFundador de altIAgency, especializado en diseñar y escalar automatizaciones empresariales con n8n y ecosistemas de IA. Mi experiencia combina la integración de flujos complejos con la creación de agentes inteligentes orientados a procesos reales, monetizables y eficientes. Comparto soluciones que transforman operaciones manuales en sistemas automáticos, con un enfoque en escalabilidad, precisión y valor empresarial.
Compartir este flujo de trabajo