Files
encuesta-terminacion-volunt…/encuesta.json
T
2026-06-15 18:11:14 +00:00

3382 lines
149 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"$json": {
"updatedAt": "2026-06-15T18:08:22.538Z",
"createdAt": "2026-04-28T16:51:28.159Z",
"id": "5M9rWs6osbDQt4qQ",
"name": "Encuesta de terminacion voluntaria",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "terminacion",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-880,
496
],
"id": "f8fed230-ab60-4c83-b3c6-f0ad77f93e99",
"name": "Webhook",
"webhookId": "fd843241-33df-4d2d-97d5-59c19c4723ac"
},
{
"parameters": {
"content": "## Es terminación voluntaria?\n\nSolo envía la encuesta a los que tuvieron una terminación voluntaria.",
"height": 240,
"width": 672
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-896,
400
],
"typeVersion": 1,
"id": "8a0602f3-e512-4d66-96a0-cdb8b9ae7791",
"name": "Sticky Note"
},
{
"parameters": {
"httpMethod": "POST",
"path": "encuesta",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-880,
800
],
"id": "479a1053-7cd1-4eab-8be4-02f256077857",
"name": "Webhook1",
"webhookId": "fd843241-33df-4d2d-97d5-59c19c4723ac"
},
{
"parameters": {
"promptType": "define",
"text": "=¿Por qué elegiste dejar la empresa?\n{{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }}",
"options": {
"systemMessage": "## Rol\nEres un analista de RRHH especializado en encuestas de salida para agencias de trade marketing en Latinoamérica (promotores, merchandisers, gestores de experiencia, supervisores, fuerza de campo).\n\nRecibirás respuestas abiertas a la pregunta: \"¿Por qué elegiste dejar la empresa?\" Tu tarea es clasificar cada respuesta en los campos indicados y devolver ÚNICAMENTE un array JSON — sin comentarios, sin markdown, sin texto adicional.\n\n---\n\n## Campos de salida\n### 1. `homologacion` (OBLIGATORIO)\nElegir uno de los labels que resuma correctamente el motivo por el que el empleado dejó la empresa, basado en\n- \"¿Por qué elegiste dejar la empresa?\"\n\n### 2. 'homologado 2' (OPCIONAL)\nUsar 'homologado 2' si en el campo \"¿Por qué elegiste dejar la empresa?\" detectas dos motivos. \n\n### 3. 'sentimiento' (OBLIGATORIO) \nClasifica el sentimiento general de la respuesta en una de estas etiquetas: \n- Positivo: Habla bien de la empresa o marca, la salida es más por motivos personales o proyectos sin queja importante. \n- Neutro: Relato descriptivo, sin mucha carga emocional, mezcla de aspectos buenos y malos sin polarizar. \n- Negativo: Quejas claras, frustración, maltrato, sensación de injusticia, falta de apoyo, burnout. \nEn caso de duda entre neutro y negativo, elige negativo si hay queja directa sobre la empresa, marca, jefe o condiciones de trabajo.\n\n**Labels:**\n- Si el motivo dice que fue motivo personal y no especfica mas nada → `\"Motivos Personales\"`\n- Si el motivo es porque está siendo mejor pagado en otro trabajo → '\"Remuneración\"'\n- Si el motivo es una queja sobre un supervisor → `\"Liderazgo / Jefe Directo\"`\n- Si el motivo es por otro trabajo, traslado o proceso migratorio para trabajar en otro pais → `\"Otro Trabajo / Traslado de Agencia\"`\n- Si no se dio ningún motivo → `\"No quiso responder\"`\n- Si el motivo fue por ambiente laboral o compañeros → '\"Ambiente Laboral / Compañeros\"'\n- Si el motivo es que siente que los horarios no le permiten equilibrar su vida personal y laboral → '\"Work Life Balance / Horarios\"'\n- Si el motivo es una queja de las condiciones físicas del punto de trabajo, del cliente al que representa, o de la marca asignada → '\"Marca / Cliente / Condiciones del Punto\"'\n- Si el motivo es una queja de falta de capacitación, procesos poco claros o desorganización interna → '\"Onboarding / Procesos / Organización\"'\n- Si el motivo es si siente que no tuvo las herramientas, recursos o apoyo necesario para hacer su trabajo → '\"Way of Work / Soporte Operativo\"'\n- Si el motivo es si siente que el trabajo no era lo que le ofrecieron o prometieron al momento de ser contratado → '\"Reclutamiento / Expectativa vs Realidad\"'\n- Si el motivo no fue declarado o la respuesta no concuerda con la pregunta → '\"Motivo No Declarado\"'\n- Si no encuentras que categoría usar → '\"Otros\"'\n\n### 4. `sugerencia` (OBLIGATORIO)\nTexto literal del campo \"¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?\"\nUsar `null` si el campo está vacío o no fue respondido.\n\n---\n\n---\n\n## REGLAS DE FORMATO ESTRICTAS\n- Devuelve ÚNICAMENTE el contenido del array, sin corchetes [ ] que lo envuelvan\n- No uses bloques de código ni backticks de ningún tipo\n- No incluyas saltos de línea \\n dentro de los valores de texto\n- Cada objeto JSON debe estar en una sola línea continua\n- Separa cada objeto con una coma y un salto de línea entre ellos\n- No agregues ningún texto antes ni después de los objetos JSON\n- Tu output debe ser solo un JSON a la vez.\n\n## Formato de salida\nDevuelve un array JSON. Cada elemento debe tener esta estructura exacta:\n{\n \"homologacion\": \"string (obligatorio)\",\n \"homologado_2\": \"string | null\",\n \"sentimiento\": \"Positivo | Neutro | Negativo\"\n \"insight_rrhh\": \"una frase breve con recomendación de mejora o hallazgo clave\"\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-496,
800
],
"id": "9644f4c2-2037-4fe1-866c-3485ba95c35f",
"name": "AI Agent"
},
{
"parameters": {
"jsCode": "const now = new Date();\n\nconst mes = String(now.getMonth() + 1).padStart(2, '0');\nconst dia = String(now.getDate()).padStart(2, '0');\nconst año = now.getFullYear();\n\nconst horas = String(now.getHours()).padStart(2, '0'); // 24 horas\nconst minutos = String(now.getMinutes()).padStart(2, '0');\nconst segundos = String(now.getSeconds()).padStart(2, '0');\n\nconst timestamp = `${mes}/${dia}/${año} ${horas}:${minutos}:${segundos}`;\n\nreturn [\n {\n json: {\n timestamp\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-688,
800
],
"id": "6a8a01b8-7c7d-465a-b9d1-31af0741e620",
"name": "Code in JavaScript"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA",
"mode": "list",
"cachedResultName": "TeamGLM_Encuesta_Salida_Homologada",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1596883141,
"mode": "list",
"cachedResultName": "Respuestas",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit#gid=1596883141"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Homologacion_IA": "={{ $('Edit Fields').item.json.cleaned.homologacion }}",
"Subcategoria_IA": "={{ $('Edit Fields').item.json.cleaned.homologado_2 }}",
"Sentimiento_IA": "={{ $('Edit Fields').item.json.cleaned.sentimiento }}",
"Insight_RRHH": "={{ $('Edit Fields').item.json.cleaned.insight_rrhh }}",
"Timestamp": "={{ $('Webhook1').item.json.body.timestamp }}",
"Email Address": "={{ $('Webhook1').item.json.body.email }}",
"Nombre Completo": "={{ $json.name }}",
"Posición": "={{ $('Webhook1').item.json.body['Posición'] }}",
"Cuenta o Proyecto": "={{ $('Webhook1').item.json.body['Cuenta o Proyecto'] }}",
"Pais": "={{ $('Webhook1').item.json.body.Pais }}",
"Me siento cómodo recomendando a otra persona para trabajar en la organización. ": "={{ $('Webhook1').item.json.body['Me siento cómodo recomendando a otra persona para trabajar en la organización. '] }}",
"¿Por qué elegiste dejar la empresa?": "={{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }}",
"¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?": "={{ $('Webhook1').item.json.body['¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?'] }}",
"Número de Identidad (Cédula)": "={{ $('Webhook1').item.json.body['Número de Identidad (Cédula)'] }}",
"Podría considerar regresar a la organización en el futuro.": "={{ $('Webhook1').item.json.body[\"Podría considerar regresar a la organización en el futuro.\"] }}",
"Numero de telefono": "={{ $('Webhook1').item.json.body['Número de Telefono'] }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Timestamp",
"displayName": "Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Email Address",
"displayName": "Email Address",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Nombre Completo",
"displayName": "Nombre Completo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Pais",
"displayName": "Pais",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Cuenta o Proyecto",
"displayName": "Cuenta o Proyecto",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Posición",
"displayName": "Posición",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Podría considerar regresar a la organización en el futuro.",
"displayName": "Podría considerar regresar a la organización en el futuro.",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"displayName": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Por qué elegiste dejar la empresa?",
"displayName": "¿Por qué elegiste dejar la empresa?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"displayName": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Número de Identidad (Cédula)",
"displayName": "Número de Identidad (Cédula)",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Numero de telefono",
"displayName": "Numero de telefono",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Homologacion ",
"displayName": "Homologacion ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Homologado 2",
"displayName": "Homologado 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Jefe Directo",
"displayName": "Jefe Directo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Column 2",
"displayName": "Column 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Viene de agencia anterior",
"displayName": "Viene de agencia anterior",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Cedula",
"displayName": "Cedula",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "PDV",
"displayName": "PDV",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "TRADE PARTNER",
"displayName": "TRADE PARTNER",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "MES",
"displayName": "MES",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Homologacion_IA",
"displayName": "Homologacion_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subcategoria_IA",
"displayName": "Subcategoria_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sentimiento_IA",
"displayName": "Sentimiento_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Insight_RRHH",
"displayName": "Insight_RRHH",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
352,
800
],
"id": "b306db08-66b4-40d1-ad58-a433973938dc",
"name": "Añadir a Responses",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
"name": "Eidan - Google Sheets account"
}
}
},
{
"parameters": {
"jsCode": "return items.map(item => {\n let text = item.json.output;\n\n if (typeof text === \"string\") {\n text = text\n .replace(/^\\s*```json\\s*/i, \"\")\n .replace(/\\s*```\\s*$/, \"\")\n .replace(/^\\s*\\n\\s*/i, \"\")\n .replace(/\\s*\\n\\s*$/, \"\")\n .trim();\n }\n\n return {\n json: {\n cleaned: text\n }\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-192,
800
],
"id": "af8f8247-1479-42ae-a869-2a726f29e7dc",
"name": "Code in JavaScript1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b393c9e7-f0f4-4d2e-b6c7-ba1c844373c6",
"name": "cleaned",
"value": "={{ $json.cleaned }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-16,
800
],
"id": "6a6292ef-d64e-46eb-9053-66a1a4ac06a2",
"name": "Edit Fields"
},
{
"parameters": {
"modelName": "models/gemini-3.1-pro-preview",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-496,
1008
],
"id": "f451f7bd-983c-4154-9fd6-41b98297d9aa",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "tFqBJras00HUi1hA",
"name": "Eidan - Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "2b23d314-ad3e-474c-8402-29dca1169155",
"leftValue": "={{ $json.body.employees[0].fields['Tipo de despido'] }}",
"rightValue": "Resignation (Voluntary)",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-704,
496
],
"id": "61902e21-a6d9-4f56-90c3-d6c158007621",
"name": "If"
},
{
"parameters": {
"content": "## Webhook\n\nRecibe la información del empleado que llenó el formulario",
"height": 240,
"width": 224
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-944,
688
],
"typeVersion": 1,
"id": "59f2ade7-80fa-49b1-a82a-34ff5767b574",
"name": "Sticky Note1"
},
{
"parameters": {
"sendTo": "={{ $('Webhook').item.json.body.employees[0].fields['Correo electrónico personal'] }}",
"subject": "GomezLee Marketing: Encuesta de salida Queremos escuchar tu opinión",
"message": "=<!DOCTYPE html>\n<html lang=\"es\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Carta de Terminación de Empleo</title>\n</head>\n<body style=\"margin: 0; padding: 0; background-color: #f4f4f4; font-family: Roboto;\">\n\n <div style=\"max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 10px; overflow: hidden;\">\n\n <!-- Header -->\n <div style=\"background-color: #2d3748; padding: 22px 28px; display: flex; align-items: center;\">\n <div>\n <p style=\"color: rgba(255,255,255,0.6); font-size: 15px; margin: 0 0 4px 0;\">Recursos Humanos</p>\n <p style=\"color: #ffffff; font-size: 17px; font-weight: bold; margin: 0;\">Encuesta de Salida Laboral</p>\n </div>\n <div style=\"margin-left: auto; display: flex; align-items: center;\">\n <img src=\"https://drive.usercontent.google.com/download?id=1p3YgNhbcBHY5JalWgNODL0ynrRu3OmhO&export=view&authuser=0\" \n alt=\"GLM Logo\" \n style=\"height: 60px; width: auto;\">\n </div>\n</div>\n\n <!-- Body -->\n <div style=\"padding: 24px 28px;\">\n\n <p style=\"color: #555555; font-size: 15px; margin: 0 0 16px;\">\n Hola <strong style=\"color: #111111;\">{{ $('Webhook').item.json.body.employees[0].fields.Nombre }}</strong>,\n </p>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 14px;\">\n Queremos agradecerte el tiempo que estuviste con nosotros y el aporte que hiciste al equipo. Para nosotros es muy importante entender cómo viviste tu experiencia en la empresa y qué podemos mejorar para los que se quedan y los que se sumen en el futuro.\n </p>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Por eso, te compartimos esta breve encuesta de salida. Responderla te tomará menos de 10 minutos y tus respuestas serán tratadas de forma confidencial por el área de Recursos Humanos.\n </p>\n\n <!-- Encuesta -->\n <div style=\"background-color: #f9f9f9; border-radius: 8px; border: 1px solid #e0e0e0; padding: 18px 22px; margin-bottom: 22px;\">\n <div style=\"display: flex; align-items: center; gap: 10px; margin-bottom: 10px;\">\n <img src=\"https://www.gstatic.com/images/branding/product/2x/forms_48dp.png\" alt=\"Google Forms\" width=\"20\" style=\"vertical-align: middle;\">\n <p style=\"font-size: 16px; font-weight: bold; color: #111111; margin: 0; display: inline-block; vertical-align: middle; margin-left: 8px;\">Encuesta de Salida Laboral</p>\n </div>\n \n <a href=\"https://docs.google.com/forms/d/e/1FAIpQLSdNPGaTHVl-4Qe0Y0VXNv_3MUGWACV5J_Rb36yyvDNQVj0t5w/viewform?usp=header\"\n style=\"display: inline-block; background-color: #2d3748; color: #ffffff; font-size: 15px; font-weight: bold; padding: 9px 20px; border-radius: 6px; text-decoration: none;\">\n Completar encuesta\n </a>\n </div>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Agradecemos mucho tu colaboración y te deseamos muchos éxitos en esta nueva etapa.\n </p>\n\n<p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Saludos\n </p>\n\n </div>\n </div>\n\n</body>\n</html>",
"options": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
96,
496
],
"id": "af09893e-1d95-40c6-92c0-6b137adc34c0",
"name": "Send a message",
"webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {
"content": "### Si la razón es Motivos Personales, envía un correo a RRHH para pedirle mas información a esa persona",
"height": 208,
"width": 560
},
"type": "n8n-nodes-base.stickyNote",
"position": [
496,
720
],
"typeVersion": 1,
"id": "269efabc-ebc1-4ae6-bf03-f842a43772a1",
"name": "Sticky Note2"
},
{
"parameters": {
"url": "=https://api.bamboohr.com/api/gateway.php/glm/v1/employees/{{ $json.body.employees[0].id }}?fields=terminationDate",
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-496,
496
],
"id": "fb3f7890-7fb7-477a-b66c-fccdd22bfaa1",
"name": "Fecha de terminacion",
"credentials": {
"httpBasicAuth": {
"id": "vXrW3oJWVhNbzB07",
"name": "GLM Credential"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "2b23d314-ad3e-474c-8402-29dca1169155",
"leftValue": "={{ $json.pass }}",
"rightValue": "Resignation (Voluntary)",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-112,
496
],
"id": "65780c3c-be2e-410e-9326-1492a702d326",
"name": "Terminacion fue este mes?"
},
{
"parameters": {
"jsCode": "const terminationDate = $json.terminationDate;\n\nif (!terminationDate) return [{ json: { pass: false } }];\n\nconst termDate = new Date(terminationDate);\nconst now = new Date();\n\nconst sameMonth = termDate.getMonth() === now.getMonth();\nconst sameYear = termDate.getFullYear() === now.getFullYear();\n\nreturn [{ json: { pass: sameMonth && sameYear } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-304,
496
],
"id": "1ec58f88-4170-4689-aadf-a28f36951856",
"name": "Code in JavaScript3"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "bcb2b317-d609-4f88-bd66-46524555345e",
"leftValue": "={{\n (() => {\n const allowed = [\"motivos personales\", \"motivo no declarado\"];\n const homol = ($json.Homologacion_IA ?? \"\").toLowerCase().trim();\n const sub = ($json.Subcategoria_IA ?? \"\").toLowerCase().trim();\n \n const homolOk = homol === \"\" || allowed.includes(homol);\n const subOk = sub === \"\" || allowed.includes(sub);\n const anyFilled = homol !== \"\" || sub !== \"\";\n \n return anyFilled && homolOk && subOk;\n })()\n}}",
"rightValue": "true",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
528,
800
],
"id": "8b2b94e9-4880-45ca-9cb0-e250dd28bd60",
"name": "Es motivo personal?"
},
{
"parameters": {
"jsCode": "const pais = $input.first().json.Pais;\n\nconst emailMap = {\n \"Guatemala\": \"rgalvez@gomezleemarketing.com\",\n \"El Salvador\": \"cmalta@gomezleemarketing.com\",\n \"Honduras\": \"mchang@gomezleemarketing.com\",\n \"Nicaragua\": \"yestrada@gomezleemarketing.com\",\n \"Costa Rica\": \"lchaves@gomezleemarketing.com\",\n \"Mexico\": \"ccastro@gomezleemarketing.com\",\n \"Colombia\": \"rrhhcolombia@gomezleemarketing.com\",\n \"Jamaica\": \"lnicomejack@gomezleemarketing.com\",\n \"Republica Dominicana\": \"nlaureano@gomezleemarketing.com\",\n \"Panama\": \"dpenalba@gomezleemarketing.com\",\n \"Trinidad and Tobago\": \"lnicomejack@gomezleemarketing.com\"\n};\n\nconst hhrr_email = emailMap[pais] ?? \"\";\n\nreturn [{ json: { hhrr_email } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
752,
800
],
"id": "f03cf81c-1336-46d8-82f5-25cedd8b79e0",
"name": "Paises"
},
{
"parameters": {
"pollTimes": {
"item": []
},
"simple": false,
"maxResults": 1,
"filters": {
"q": "Motivo de Salida Actualizado",
"readStatus": "read"
},
"options": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"position": [
-944,
1184
],
"id": "f70a31a6-8f6c-402e-b3fc-9a9c4020a144",
"name": "Gmail Trigger",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.body }}",
"options": {
"systemMessage": "## Rol\nEres un analista de RRHH especializado en encuestas de salida para agencias de trade marketing en Latinoamérica (promotores, merchandisers, gestores de experiencia, supervisores, fuerza de campo).\n\nRecibirás respuestas abiertas a la pregunta: \"¿Por qué elegiste dejar la empresa?\" Tu tarea es clasificar cada respuesta en los campos indicados y devolver ÚNICAMENTE un array JSON — sin comentarios, sin markdown, sin texto adicional.\n\n---\n\n## Campos de salida\n### 1. `homologacion` (OBLIGATORIO)\nElegir uno de los labels que resuma correctamente el motivo por el que el empleado dejó la empresa, basado en\n- \"¿Por qué elegiste dejar la empresa?\"\n\n### 2. 'homologado 2' (OPCIONAL)\nUsar 'homologado 2' si en el campo \"¿Por qué elegiste dejar la empresa?\" detectas dos motivos. Usar los labels que resuma correctamente el motivo por el que el empleado dejó la empresa.\n\n### 3. 'sentimiento' (OBLIGATORIO) \nClasifica el sentimiento general de la respuesta en una de estas etiquetas: \n- Positivo: Habla bien de la empresa o marca, la salida es más por motivos personales o proyectos sin queja importante. \n- Neutro: Relato descriptivo, sin mucha carga emocional, mezcla de aspectos buenos y malos sin polarizar. \n- Negativo: Quejas claras, frustración, maltrato, sensación de injusticia, falta de apoyo, burnout. \nEn caso de duda entre neutro y negativo, elige negativo si hay queja directa sobre la empresa, marca, jefe o condiciones de trabajo.\n\n### 4. 'motivo' (OBLIGATORIO)\nDebes sacar el motivo de renuncia en el prompt. Debes poner todo el texto del motivo, no dejarlo por la mitad.\n\n**Labels:**\n- Si el motivo es personal → `\"Motivos Personales\"`\n- Si el motivo es porque está siendo mejor pagado en otro trabajo → '\"Remuneración\"'\n- Si el motivo es una queja sobre un supervisor → `\"Liderazgo / Jefe Directo\"`\n- Si no encuentras que categoría usar → '\"Otros\"'\n- Si el motivo es por otro trabajo → `\"Otro Trabajo / Traslado de Agencia\"`\n- Si no se dio ningún motivo → `\"No quiso responder\"`\n- Si el motivo fue por ambiente laboral o compañeros → '\"Ambiente Laboral / Compañeros\"'\n- Si el motivo es que siente que los horarios no le permiten equilibrar su vida personal y laboral → '\"Work Life Balance / Horarios\"'\n- Si el motivo es una queja de las condiciones físicas del punto de trabajo, del cliente al que representa, o de la marca asignada → '\"Marca / Cliente / Condiciones del Punto\"'\n- Si el motivo es una queja de falta de capacitación, procesos poco claros o desorganización interna → '\"Onboarding / Procesos / Organización\"'\n- Si el motivo es si siente que no tuvo las herramientas, recursos o apoyo necesario para hacer su trabajo → '\"Way of Work / Soporte Operativo\"'\n- Si el motivo es si siente que el trabajo no era lo que le ofrecieron o prometieron al momento de ser contratado → '\"Reclutamiento / Expectativa vs Realidad\"'\n\n---\n\n---\n\n## REGLAS DE FORMATO ESTRICTAS\n- Devuelve ÚNICAMENTE el contenido del array, sin corchetes [ ] que lo envuelvan\n- No uses bloques de código ni backticks de ningún tipo\n- No incluyas saltos de línea \\n dentro de los valores de texto\n- Cada objeto JSON debe estar en una sola línea continua\n- Separa cada objeto con una coma y un salto de línea entre ellos\n- No agregues ningún texto antes ni después de los objetos JSON\n- Tu output debe ser solo un JSON a la vez.\n- Debes ignorar los saludos y firmas del mensaje, por ejemplo:\n - Las firmas en correos se ven asi:\n GomezLee Marketing\n John Doe\n Coordinador RH Nicaragua\n jdoe@gomezleemarketing.com\n 9999 8888 Cl\n\n## Formato de salida\nDevuelve un array JSON. Cada elemento debe tener esta estructura exacta:\n{\n \"nombre_completo\": \"string (obligatorio)\"\n \"homologacion\": \"string (obligatorio)\",\n \"homologado_2\": \"string | null\",\n \"sentimiento\": \"Positivo | Neutro | Negativo\"\n \"insight_rrhh\": \"una frase breve con recomendación de mejora o hallazgo clave\",\n \"motivo\": \"<motivo de renuncia que se detecto en el prompt>\"\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-560,
1184
],
"id": "26b6c331-df9c-4db1-8934-b50d6b821300",
"name": "AI Agent1"
},
{
"parameters": {
"modelName": "models/gemini-3.1-pro-preview",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-560,
1392
],
"id": "05cd6b45-8cc4-4f5a-91bf-6d950a552b10",
"name": "Google Gemini Chat Model1",
"credentials": {
"googlePalmApi": {
"id": "tFqBJras00HUi1hA",
"name": "Eidan - Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "fb89d102-d52e-4be0-9373-ec58e8ef9742",
"name": "output",
"value": "={{ $json.output }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-256,
1184
],
"id": "e8a81e0f-deed-4c24-8a33-8c20231c5ba3",
"name": "Edit Fields1"
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA",
"mode": "list",
"cachedResultName": "TeamGLM_Encuesta_Salida_Homologada",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1596883141,
"mode": "list",
"cachedResultName": "Respuestas",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit#gid=1596883141"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Homologacion_IA": "={{ $('Edit Fields1').item.json.output.homologacion }}",
"Subcategoria_IA": "={{ $('Edit Fields1').item.json.output.homologado_2 }}",
"Sentimiento_IA": "={{ $('Edit Fields1').item.json.output.sentimiento }}",
"Insight_RRHH": "={{ $('Edit Fields1').item.json.output.insight_rrhh }}",
"Nombre Completo": "={{ $json.name }}",
"¿Por qué elegiste dejar la empresa?": "={{ $('Edit Fields1').item.json.output.motivo }}"
},
"matchingColumns": [
"Nombre Completo"
],
"schema": [
{
"id": "Timestamp",
"displayName": "Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Email Address",
"displayName": "Email Address",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Nombre Completo",
"displayName": "Nombre Completo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Pais",
"displayName": "Pais",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Cuenta o Proyecto",
"displayName": "Cuenta o Proyecto",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Posición",
"displayName": "Posición",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Podría considerar regresar a la organización en el futuro.",
"displayName": "Podría considerar regresar a la organización en el futuro.",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"displayName": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "¿Por qué elegiste dejar la empresa?",
"displayName": "¿Por qué elegiste dejar la empresa?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"displayName": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Número de Identidad (Cédula)",
"displayName": "Número de Identidad (Cédula)",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Numero de telefono",
"displayName": "Numero de telefono",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologacion ",
"displayName": "Homologacion ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologado 2",
"displayName": "Homologado 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Jefe Directo",
"displayName": "Jefe Directo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Column 2",
"displayName": "Column 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Viene de agencia anterior",
"displayName": "Viene de agencia anterior",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Cedula",
"displayName": "Cedula",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "PDV",
"displayName": "PDV",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "TRADE PARTNER",
"displayName": "TRADE PARTNER",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "MES",
"displayName": "MES",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologacion_IA",
"displayName": "Homologacion_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subcategoria_IA",
"displayName": "Subcategoria_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sentimiento_IA",
"displayName": "Sentimiento_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Insight_RRHH",
"displayName": "Insight_RRHH",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
112,
1184
],
"id": "6c5ac11b-3891-4331-9639-b4ede15f8ba5",
"name": "Añadir a Responses1",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
"name": "Eidan - Google Sheets account"
}
}
},
{
"parameters": {
"sendTo": "={{ $json.hhrr_email }}",
"subject": "Seguimiento requerido Encuesta de Salida",
"message": "=<!DOCTYPE html>\n<html>\n<body style=\"margin:0; padding:0; background:#f4f4f4;\">\n\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"font-family:Arial,sans-serif; margin:0 auto; border:1px solid #e0e0e0; background:#ffffff;\">\n\n <!-- HEADER -->\n <tr>\n <td style=\"background-color:#2d3748; padding:22px 28px; border-top-left-radius: 10px; border-top-right-radius: 10px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <p style=\"margin:0 0 3px 0; font-size:11px; color:rgba(255,255,255,0.55);\">Recursos Humanos</p>\n <p style=\"margin:0; font-size:16px; font-weight:bold; color:#ffffff;\">Seguimiento Requerido</p>\n </td>\n <td style=\"vertical-align:middle; text-align:right;\">\n <img src=\"https://drive.usercontent.google.com/download?id=1p3YgNhbcBHY5JalWgNODL0ynrRu3OmhO&export=view&authuser=0\"\n alt=\"GLM Logo\"\n width=\"120\"\n style=\"height:auto; display:block; margin-left:auto;\">\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- INTRO TEXT -->\n <tr>\n <td style=\"padding:24px 28px 16px 28px;\">\n <p style=\"margin:0 0 12px 0; font-size:14px; color:#333333; line-height:1.7;\">Estimado equipo de <strong>Recursos Humanos</strong>,</p>\n <p style=\"margin:0 0 12px 0; font-size:14px; color:#444444; line-height:1.8;\">El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró <strong>\"Motivos Personales\"</strong> o el motivo fue no declarado como razón de renuncia voluntaria.</p>\n <p style=\"margin:0; font-size:14px; color:#444444; line-height:1.8;\">Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida.</p>\n </td>\n </tr>\n\n <!-- EMPLOYEE CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0; background:#ffffff;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">👤</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Datos del empleado/a</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:0 16px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td width=\"80\" style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top; border-bottom:1px solid #f0f0f0;\">Nombre</td>\n <td style=\"padding:10px 0; font-size:13px; color:#222222; vertical-align:top; border-bottom:1px solid #f0f0f0;\">{{ $('Webhook1').item.json.body['Nombre Completo'] }}</td>\n </tr>\n <tr>\n <td style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top; border-bottom:1px solid #f0f0f0;\">Teléfono</td>\n <td style=\"padding:10px 0; font-size:13px; color:#222222; vertical-align:top; border-bottom:1px solid #f0f0f0;\">{{ $('Webhook1').item.json.body['Número de Telefono'] }}</td>\n </tr>\n <tr>\n <td style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top;\">Correo</td>\n <td style=\"padding:10px 0; font-size:13px; vertical-align:top;\"><a href=\"#\" style=\"color:#4CAF50; text-decoration:none;\">{{ $('Webhook1').item.json.body.email }}</a></td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- ACTIONS CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">✅</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Acciones requeridas</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:14px 16px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; width:22px; font-size:13px; font-weight:700; color:#4CAF50;\">1.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Contactar al/la empleado/a en un plazo no mayor a <strong>3 días hábiles</strong>.</td>\n </tr>\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; font-size:13px; font-weight:700; color:#4CAF50;\">2.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Realizar la conversación de manera empática y confidencial.</td>\n </tr>\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; font-size:13px; font-weight:700; color:#4CAF50;\">3.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Registrar los hallazgos respondiendo este correo con el formato indicado.</td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- FORMAT CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">📋</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Formato de respuesta</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:14px 16px;\">\n <p style=\"margin:0 0 8px 0; font-size:13px; color:#555555;\">Responda con el asunto <strong>exactamente</strong> así:</p>\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:14px;\">\n <tr>\n <td width=\"3\" bgcolor=\"#4CAF50\">&nbsp;</td>\n <td style=\"background:#f7f7f7; padding:9px 12px; font-family:Courier New,monospace; font-size:13px; color:#222222;\">Motivo de Salida Actualizado</td>\n </tr>\n </table>\n <p style=\"margin:0 0 8px 0; font-size:13px; color:#555555;\">Incluya en el cuerpo:</p>\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:10px;\">\n <tr>\n <td width=\"3\" bgcolor=\"#4CAF50\">&nbsp;</td>\n <td style=\"background:#f7f7f7; padding:10px 12px; font-family:Courier New,monospace; font-size:13px; color:#555555; line-height:1.9;\">\n Nombre completo: [nombre del empleado]<br>\n Motivo: [motivo real de salida]\n </td>\n </tr>\n </table>\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:top; font-size:13px; padding-right:6px;\">⚠️</td>\n <td style=\"font-size:12px; color:#999999; line-height:1.5;\">Mantener el formato exacto para el correcto registro en el sistema.</td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- CLOSING -->\n <tr>\n <td style=\"padding:8px 28px 24px 28px;\">\n <p style=\"margin:0 0 4px 0; font-size:14px; color:#444444;\">Agradecemos su gestión oportuna.</p>\n <p style=\"margin:0; font-size:14px; color:#444444;\">Saludos,</p>\n </td>\n </tr>\n\n <!-- FOOTER -->\n <tr>\n <td style=\"background:#f7f7f7; border-top:1px solid #e0e0e0; padding:12px 28px;\">\n <p style=\"margin:0; font-size:11px; color:#aaaaaa;\">Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing.</p>\n </td>\n </tr>\n\n</table>\n\n</body>\n</html>\n",
"options": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
928,
800
],
"id": "99ff8288-d1b6-46ac-830b-961e29372428",
"name": "Enviar revision",
"webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-1136,
1648
],
"id": "22aa2d29-e0a3-4a88-a66b-263400b580d8",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"method": "POST",
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $('Valores').item.json.repo_name }}/contents/{{ $('Valores').item.json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"message\": \"{{ $json.message }}\",\n \"content\": \"{{ $json.content }}\",\n \"branch\": \"{{ $json.branch }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-176,
1760
],
"id": "4c4644de-dfe1-468e-9b64-de32e31c7da5",
"name": "Subir archivo",
"retryOnFail": false,
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
}
},
{
"parameters": {
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $json.repo_name }}/contents/{{ $json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": []
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-784,
1648
],
"id": "1a7c30de-8279-489b-8658-475f816fcdd4",
"name": "Obtener archivo",
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"method": "PUT",
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $('Valores').item.json.repo_name }}/contents/{{ $('Valores').item.json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"message\": \"{{ $json.message }}\",\n \"content\": \"{{ $json.content }}\",\n \"sha\": \"{{ $json.sha }}\",\n \"branch\": \"{{ $json.branch }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-176,
1552
],
"id": "21758ff9-fba7-45bc-9ae9-2c39cb4b8be8",
"name": "Actualizar archivo",
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
}
},
{
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"value": "5M9rWs6osbDQt4qQ",
"mode": "list",
"cachedResultName": "Encuesta de terminacion voluntaria (#5M9rWs6osbDQt4qQ)"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.n8n",
"typeVersion": 1,
"position": [
-528,
1552
],
"id": "da89a0fa-8a71-4b5b-8a12-931321c686d9",
"name": "Get a workflow1",
"credentials": {
"n8nApi": {
"id": "73Ydc9X8h5HXvFrt",
"name": "Eidan - n8n account"
}
}
},
{
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"value": "5M9rWs6osbDQt4qQ",
"mode": "list",
"cachedResultName": "Encuesta de terminacion voluntaria (#5M9rWs6osbDQt4qQ)"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.n8n",
"typeVersion": 1,
"position": [
-528,
1760
],
"id": "c7ec06a9-863f-4e2e-b0bc-ab0e58eb1f09",
"name": "Get a workflow2",
"credentials": {
"n8nApi": {
"id": "73Ydc9X8h5HXvFrt",
"name": "Eidan - n8n account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "3519ad4c-6d66-4963-ab76-ee5517d88d67",
"name": "repo_name",
"value": "encuesta-terminacion-voluntaria",
"type": "string"
},
{
"id": "0df99f1e-1354-43b9-9d20-9f994cc82cf6",
"name": "file_name",
"value": "encuesta",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-960,
1648
],
"id": "30b21b9a-a62e-4f30-8a8c-d3247d917327",
"name": "Valores"
},
{
"parameters": {
"jsCode": "const sha = $('Obtener archivo').first().json.sha;\nconst data = { $json };\n\nreturn [{\n json: {\n message: \"Update \" + $('Valores').first().json.file_name + \".json\",\n content: Buffer.from(JSON.stringify(data, null, 2)).toString(\"base64\"),\n sha: sha,\n branch: \"main\"\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-352,
1552
],
"id": "a25dcd9c-c6b2-4f6c-8091-96850848eea7",
"name": "Code in JavaScript2"
},
{
"parameters": {
"jsCode": "const sha = $json.sha; // viene del GET anterior\nconst data = { $json };\n\nconst base64 = Buffer.from(JSON.stringify(data, null, 2)).toString(\"base64\");\n\nreturn [{\n json: {\n message: \"Create \" + $('Valores').first().json.file_name + \".json\",\n content: base64,\n sha: sha,\n branch: \"main\"\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-352,
1760
],
"id": "dbacc193-fbeb-4a24-9ca5-15a19c7cc59e",
"name": "Code in JavaScript4"
},
{
"parameters": {
"jsCode": "const name = $('Webhook1').first().json.body['Nombre Completo'];\nconst trimmedName = name.trim();\n\nreturn [{ json: { name: trimmedName } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
160,
800
],
"id": "776bfd32-d5d8-4bc2-a973-43aa0d0ab6b7",
"name": "Eliminar espacios vacios"
},
{
"parameters": {
"jsCode": "const name = $input.first().json.output.nombre_completo;\nconst trimmedName = name.trim();\n\nreturn [{ json: { name: trimmedName } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-80,
1184
],
"id": "5c923ea6-8837-4c7d-b223-4158f650b5e7",
"name": "Eliminar espacios vacios1"
},
{
"parameters": {
"content": "## Webhook\n\nRecibe el nuevo motivo del empleado",
"height": 256,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-976,
1056
],
"typeVersion": 1,
"id": "853d3d99-ce54-4ddd-aed9-81fca72fd1c3",
"name": "Sticky Note3"
},
{
"parameters": {
"jsCode": "const text = $input.first().json.text;\n\nconst cutMarker = 'gomezlee marketing';\nconst cutIndex = text.toLowerCase().indexOf(cutMarker);\n\nlet cleaned = text;\n\nif (cutIndex !== -1) {\n cleaned = text.slice(0, cutIndex).trim();\n}\n\nreturn [{ json: { body: cleaned } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-720,
1184
],
"id": "62d87e71-05aa-459b-a301-67d7cafb5643",
"name": "Limpiar texto"
},
{
"parameters": {
"content": "## Limpiar texto\n\nEliminar la firma y mensaje de confidencialidad del texto",
"height": 256,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-768,
1056
],
"typeVersion": 1,
"id": "37987422-8a55-472c-9ab0-13695aac0319",
"name": "Sticky Note4"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Webhook1": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Añadir a Responses": {
"main": [
[
{
"node": "Es motivo personal?",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Eliminar espacios vacios",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Fecha de terminacion",
"type": "main",
"index": 0
}
]
]
},
"Fecha de terminacion": {
"main": [
[
{
"node": "Code in JavaScript3",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript3": {
"main": [
[
{
"node": "Terminacion fue este mes?",
"type": "main",
"index": 0
}
]
]
},
"Terminacion fue este mes?": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Es motivo personal?": {
"main": [
[
{
"node": "Paises",
"type": "main",
"index": 0
}
],
[]
]
},
"Paises": {
"main": [
[
{
"node": "Enviar revision",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Limpiar texto",
"type": "main",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Eliminar espacios vacios1",
"type": "main",
"index": 0
}
]
]
},
"When clicking Execute workflow": {
"main": [
[
{
"node": "Valores",
"type": "main",
"index": 0
}
]
]
},
"Obtener archivo": {
"main": [
[
{
"node": "Get a workflow1",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a workflow2",
"type": "main",
"index": 0
}
]
]
},
"Get a workflow1": {
"main": [
[
{
"node": "Code in JavaScript2",
"type": "main",
"index": 0
}
]
]
},
"Get a workflow2": {
"main": [
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Valores": {
"main": [
[
{
"node": "Obtener archivo",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript2": {
"main": [
[
{
"node": "Actualizar archivo",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript4": {
"main": [
[
{
"node": "Subir archivo",
"type": "main",
"index": 0
}
]
]
},
"Eliminar espacios vacios": {
"main": [
[
{
"node": "Añadir a Responses",
"type": "main",
"index": 0
}
]
]
},
"Eliminar espacios vacios1": {
"main": [
[
{
"node": "Añadir a Responses1",
"type": "main",
"index": 0
}
]
]
},
"Limpiar texto": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"timeSavedMode": "fixed",
"errorWorkflow": "lX5ITf9s4TSQglsM",
"timezone": "America/Santo_Domingo",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"staticData": {
"node:Gmail Trigger": {
"Gmail Trigger": {
"lastTimeChecked": 1780760249,
"pendingMessageIds": [
"19ea7fe6cbb29000"
],
"possibleDuplicates": [
"19e9d9507d932c5f",
"19e9d6394360cfbf",
"19ecc16dba75868b",
"19ecc14b03ec9362",
"19ea8063013aaa8b"
]
}
}
},
"meta": {
"templateCredsSetupCompleted": true
},
"pinData": {},
"versionId": "160df4d6-78d0-4099-8085-6f595d4cef6f",
"activeVersionId": "6da058c1-2180-4992-a66e-9272e756a7b9",
"versionCounter": 1596,
"triggerCount": 4,
"shared": [
{
"updatedAt": "2026-04-28T16:51:28.169Z",
"createdAt": "2026-04-28T16:51:28.169Z",
"role": "workflow:owner",
"workflowId": "5M9rWs6osbDQt4qQ",
"projectId": "0bH6HfYEL8n6SDmr",
"project": {
"updatedAt": "2026-04-22T14:25:04.701Z",
"createdAt": "2026-04-22T14:22:54.790Z",
"id": "0bH6HfYEL8n6SDmr",
"name": "Eidan Then <ethen@gomezleemarketing.com>",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "de14e7e5-491b-4983-abb2-f88af42e92fd"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-06-15T17:54:09.000Z",
"createdAt": "2026-06-15T17:54:00.452Z",
"versionId": "6da058c1-2180-4992-a66e-9272e756a7b9",
"workflowId": "5M9rWs6osbDQt4qQ",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "terminacion",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-880,
496
],
"id": "f8fed230-ab60-4c83-b3c6-f0ad77f93e99",
"name": "Webhook",
"webhookId": "fd843241-33df-4d2d-97d5-59c19c4723ac"
},
{
"parameters": {
"content": "## Es terminación voluntaria?\n\nSolo envía la encuesta a los que tuvieron una terminación voluntaria.",
"height": 240,
"width": 672
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-896,
400
],
"typeVersion": 1,
"id": "8a0602f3-e512-4d66-96a0-cdb8b9ae7791",
"name": "Sticky Note"
},
{
"parameters": {
"httpMethod": "POST",
"path": "encuesta",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-880,
800
],
"id": "479a1053-7cd1-4eab-8be4-02f256077857",
"name": "Webhook1",
"webhookId": "fd843241-33df-4d2d-97d5-59c19c4723ac"
},
{
"parameters": {
"promptType": "define",
"text": "=¿Por qué elegiste dejar la empresa?\n{{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }}",
"options": {
"systemMessage": "## Rol\nEres un analista de RRHH especializado en encuestas de salida para agencias de trade marketing en Latinoamérica (promotores, merchandisers, gestores de experiencia, supervisores, fuerza de campo).\n\nRecibirás respuestas abiertas a la pregunta: \"¿Por qué elegiste dejar la empresa?\" Tu tarea es clasificar cada respuesta en los campos indicados y devolver ÚNICAMENTE un array JSON — sin comentarios, sin markdown, sin texto adicional.\n\n---\n\n## Campos de salida\n### 1. `homologacion` (OBLIGATORIO)\nElegir uno de los labels que resuma correctamente el motivo por el que el empleado dejó la empresa, basado en\n- \"¿Por qué elegiste dejar la empresa?\"\n\n### 2. 'homologado 2' (OPCIONAL)\nUsar 'homologado 2' si en el campo \"¿Por qué elegiste dejar la empresa?\" detectas dos motivos. \n\n### 3. 'sentimiento' (OBLIGATORIO) \nClasifica el sentimiento general de la respuesta en una de estas etiquetas: \n- Positivo: Habla bien de la empresa o marca, la salida es más por motivos personales o proyectos sin queja importante. \n- Neutro: Relato descriptivo, sin mucha carga emocional, mezcla de aspectos buenos y malos sin polarizar. \n- Negativo: Quejas claras, frustración, maltrato, sensación de injusticia, falta de apoyo, burnout. \nEn caso de duda entre neutro y negativo, elige negativo si hay queja directa sobre la empresa, marca, jefe o condiciones de trabajo.\n\n**Labels:**\n- Si el motivo dice que fue motivo personal y no especfica mas nada → `\"Motivos Personales\"`\n- Si el motivo es porque está siendo mejor pagado en otro trabajo → '\"Remuneración\"'\n- Si el motivo es una queja sobre un supervisor → `\"Liderazgo / Jefe Directo\"`\n- Si el motivo es por otro trabajo, traslado o proceso migratorio para trabajar en otro pais → `\"Otro Trabajo / Traslado de Agencia\"`\n- Si no se dio ningún motivo → `\"No quiso responder\"`\n- Si el motivo fue por ambiente laboral o compañeros → '\"Ambiente Laboral / Compañeros\"'\n- Si el motivo es que siente que los horarios no le permiten equilibrar su vida personal y laboral → '\"Work Life Balance / Horarios\"'\n- Si el motivo es una queja de las condiciones físicas del punto de trabajo, del cliente al que representa, o de la marca asignada → '\"Marca / Cliente / Condiciones del Punto\"'\n- Si el motivo es una queja de falta de capacitación, procesos poco claros o desorganización interna → '\"Onboarding / Procesos / Organización\"'\n- Si el motivo es si siente que no tuvo las herramientas, recursos o apoyo necesario para hacer su trabajo → '\"Way of Work / Soporte Operativo\"'\n- Si el motivo es si siente que el trabajo no era lo que le ofrecieron o prometieron al momento de ser contratado → '\"Reclutamiento / Expectativa vs Realidad\"'\n- Si el motivo no fue declarado o la respuesta no concuerda con la pregunta → '\"Motivo No Declarado\"'\n- Si no encuentras que categoría usar → '\"Otros\"'\n\n### 4. `sugerencia` (OBLIGATORIO)\nTexto literal del campo \"¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?\"\nUsar `null` si el campo está vacío o no fue respondido.\n\n---\n\n---\n\n## REGLAS DE FORMATO ESTRICTAS\n- Devuelve ÚNICAMENTE el contenido del array, sin corchetes [ ] que lo envuelvan\n- No uses bloques de código ni backticks de ningún tipo\n- No incluyas saltos de línea \\n dentro de los valores de texto\n- Cada objeto JSON debe estar en una sola línea continua\n- Separa cada objeto con una coma y un salto de línea entre ellos\n- No agregues ningún texto antes ni después de los objetos JSON\n- Tu output debe ser solo un JSON a la vez.\n\n## Formato de salida\nDevuelve un array JSON. Cada elemento debe tener esta estructura exacta:\n{\n \"homologacion\": \"string (obligatorio)\",\n \"homologado_2\": \"string | null\",\n \"sentimiento\": \"Positivo | Neutro | Negativo\"\n \"insight_rrhh\": \"una frase breve con recomendación de mejora o hallazgo clave\"\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-496,
800
],
"id": "9644f4c2-2037-4fe1-866c-3485ba95c35f",
"name": "AI Agent"
},
{
"parameters": {
"jsCode": "const now = new Date();\n\nconst mes = String(now.getMonth() + 1).padStart(2, '0');\nconst dia = String(now.getDate()).padStart(2, '0');\nconst año = now.getFullYear();\n\nconst horas = String(now.getHours()).padStart(2, '0'); // 24 horas\nconst minutos = String(now.getMinutes()).padStart(2, '0');\nconst segundos = String(now.getSeconds()).padStart(2, '0');\n\nconst timestamp = `${mes}/${dia}/${año} ${horas}:${minutos}:${segundos}`;\n\nreturn [\n {\n json: {\n timestamp\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-688,
800
],
"id": "6a8a01b8-7c7d-465a-b9d1-31af0741e620",
"name": "Code in JavaScript"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA",
"mode": "list",
"cachedResultName": "TeamGLM_Encuesta_Salida_Homologada",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1596883141,
"mode": "list",
"cachedResultName": "Respuestas",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit#gid=1596883141"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Homologacion_IA": "={{ $('Edit Fields').item.json.cleaned.homologacion }}",
"Subcategoria_IA": "={{ $('Edit Fields').item.json.cleaned.homologado_2 }}",
"Sentimiento_IA": "={{ $('Edit Fields').item.json.cleaned.sentimiento }}",
"Insight_RRHH": "={{ $('Edit Fields').item.json.cleaned.insight_rrhh }}",
"Timestamp": "={{ $('Webhook1').item.json.body.timestamp }}",
"Email Address": "={{ $('Webhook1').item.json.body.email }}",
"Nombre Completo": "={{ $json.name }}",
"Posición": "={{ $('Webhook1').item.json.body['Posición'] }}",
"Cuenta o Proyecto": "={{ $('Webhook1').item.json.body['Cuenta o Proyecto'] }}",
"Pais": "={{ $('Webhook1').item.json.body.Pais }}",
"Me siento cómodo recomendando a otra persona para trabajar en la organización. ": "={{ $('Webhook1').item.json.body['Me siento cómodo recomendando a otra persona para trabajar en la organización. '] }}",
"¿Por qué elegiste dejar la empresa?": "={{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }}",
"¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?": "={{ $('Webhook1').item.json.body['¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?'] }}",
"Número de Identidad (Cédula)": "={{ $('Webhook1').item.json.body['Número de Identidad (Cédula)'] }}",
"Podría considerar regresar a la organización en el futuro.": "={{ $('Webhook1').item.json.body[\"Podría considerar regresar a la organización en el futuro.\"] }}",
"Numero de telefono": "={{ $('Webhook1').item.json.body['Número de Telefono'] }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Timestamp",
"displayName": "Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Email Address",
"displayName": "Email Address",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Nombre Completo",
"displayName": "Nombre Completo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Pais",
"displayName": "Pais",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Cuenta o Proyecto",
"displayName": "Cuenta o Proyecto",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Posición",
"displayName": "Posición",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Podría considerar regresar a la organización en el futuro.",
"displayName": "Podría considerar regresar a la organización en el futuro.",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"displayName": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Por qué elegiste dejar la empresa?",
"displayName": "¿Por qué elegiste dejar la empresa?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"displayName": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Número de Identidad (Cédula)",
"displayName": "Número de Identidad (Cédula)",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Numero de telefono",
"displayName": "Numero de telefono",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Homologacion ",
"displayName": "Homologacion ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Homologado 2",
"displayName": "Homologado 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Jefe Directo",
"displayName": "Jefe Directo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Column 2",
"displayName": "Column 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Viene de agencia anterior",
"displayName": "Viene de agencia anterior",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Cedula",
"displayName": "Cedula",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "PDV",
"displayName": "PDV",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "TRADE PARTNER",
"displayName": "TRADE PARTNER",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "MES",
"displayName": "MES",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Homologacion_IA",
"displayName": "Homologacion_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subcategoria_IA",
"displayName": "Subcategoria_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sentimiento_IA",
"displayName": "Sentimiento_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Insight_RRHH",
"displayName": "Insight_RRHH",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
352,
800
],
"id": "b306db08-66b4-40d1-ad58-a433973938dc",
"name": "Añadir a Responses",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
"name": "Eidan - Google Sheets account"
}
}
},
{
"parameters": {
"jsCode": "return items.map(item => {\n let text = item.json.output;\n\n if (typeof text === \"string\") {\n text = text\n .replace(/^\\s*```json\\s*/i, \"\")\n .replace(/\\s*```\\s*$/, \"\")\n .replace(/^\\s*\\n\\s*/i, \"\")\n .replace(/\\s*\\n\\s*$/, \"\")\n .trim();\n }\n\n return {\n json: {\n cleaned: text\n }\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-192,
800
],
"id": "af8f8247-1479-42ae-a869-2a726f29e7dc",
"name": "Code in JavaScript1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b393c9e7-f0f4-4d2e-b6c7-ba1c844373c6",
"name": "cleaned",
"value": "={{ $json.cleaned }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-16,
800
],
"id": "6a6292ef-d64e-46eb-9053-66a1a4ac06a2",
"name": "Edit Fields"
},
{
"parameters": {
"modelName": "models/gemini-3.1-pro-preview",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-496,
1008
],
"id": "f451f7bd-983c-4154-9fd6-41b98297d9aa",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "tFqBJras00HUi1hA",
"name": "Eidan - Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "2b23d314-ad3e-474c-8402-29dca1169155",
"leftValue": "={{ $json.body.employees[0].fields['Tipo de despido'] }}",
"rightValue": "Resignation (Voluntary)",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-704,
496
],
"id": "61902e21-a6d9-4f56-90c3-d6c158007621",
"name": "If"
},
{
"parameters": {
"content": "## Webhook\n\nRecibe la información del empleado que llenó el formulario",
"height": 240,
"width": 224
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-944,
688
],
"typeVersion": 1,
"id": "59f2ade7-80fa-49b1-a82a-34ff5767b574",
"name": "Sticky Note1"
},
{
"parameters": {
"sendTo": "={{ $('Webhook').item.json.body.employees[0].fields['Correo electrónico personal'] }}",
"subject": "GomezLee Marketing: Encuesta de salida Queremos escuchar tu opinión",
"message": "=<!DOCTYPE html>\n<html lang=\"es\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Carta de Terminación de Empleo</title>\n</head>\n<body style=\"margin: 0; padding: 0; background-color: #f4f4f4; font-family: Roboto;\">\n\n <div style=\"max-width: 600px; margin: 40px auto; background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 10px; overflow: hidden;\">\n\n <!-- Header -->\n <div style=\"background-color: #2d3748; padding: 22px 28px; display: flex; align-items: center;\">\n <div>\n <p style=\"color: rgba(255,255,255,0.6); font-size: 15px; margin: 0 0 4px 0;\">Recursos Humanos</p>\n <p style=\"color: #ffffff; font-size: 17px; font-weight: bold; margin: 0;\">Encuesta de Salida Laboral</p>\n </div>\n <div style=\"margin-left: auto; display: flex; align-items: center;\">\n <img src=\"https://drive.usercontent.google.com/download?id=1p3YgNhbcBHY5JalWgNODL0ynrRu3OmhO&export=view&authuser=0\" \n alt=\"GLM Logo\" \n style=\"height: 60px; width: auto;\">\n </div>\n</div>\n\n <!-- Body -->\n <div style=\"padding: 24px 28px;\">\n\n <p style=\"color: #555555; font-size: 15px; margin: 0 0 16px;\">\n Hola <strong style=\"color: #111111;\">{{ $('Webhook').item.json.body.employees[0].fields.Nombre }}</strong>,\n </p>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 14px;\">\n Queremos agradecerte el tiempo que estuviste con nosotros y el aporte que hiciste al equipo. Para nosotros es muy importante entender cómo viviste tu experiencia en la empresa y qué podemos mejorar para los que se quedan y los que se sumen en el futuro.\n </p>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Por eso, te compartimos esta breve encuesta de salida. Responderla te tomará menos de 10 minutos y tus respuestas serán tratadas de forma confidencial por el área de Recursos Humanos.\n </p>\n\n <!-- Encuesta -->\n <div style=\"background-color: #f9f9f9; border-radius: 8px; border: 1px solid #e0e0e0; padding: 18px 22px; margin-bottom: 22px;\">\n <div style=\"display: flex; align-items: center; gap: 10px; margin-bottom: 10px;\">\n <img src=\"https://www.gstatic.com/images/branding/product/2x/forms_48dp.png\" alt=\"Google Forms\" width=\"20\" style=\"vertical-align: middle;\">\n <p style=\"font-size: 16px; font-weight: bold; color: #111111; margin: 0; display: inline-block; vertical-align: middle; margin-left: 8px;\">Encuesta de Salida Laboral</p>\n </div>\n \n <a href=\"https://docs.google.com/forms/d/e/1FAIpQLSdNPGaTHVl-4Qe0Y0VXNv_3MUGWACV5J_Rb36yyvDNQVj0t5w/viewform?usp=header\"\n style=\"display: inline-block; background-color: #2d3748; color: #ffffff; font-size: 15px; font-weight: bold; padding: 9px 20px; border-radius: 6px; text-decoration: none;\">\n Completar encuesta\n </a>\n </div>\n\n <p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Agradecemos mucho tu colaboración y te deseamos muchos éxitos en esta nueva etapa.\n </p>\n\n<p style=\"color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 20px;\">\n Saludos\n </p>\n\n </div>\n </div>\n\n</body>\n</html>",
"options": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
96,
496
],
"id": "af09893e-1d95-40c6-92c0-6b137adc34c0",
"name": "Send a message",
"webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {
"content": "### Si la razón es Motivos Personales, envía un correo a RRHH para pedirle mas información a esa persona",
"height": 208,
"width": 560
},
"type": "n8n-nodes-base.stickyNote",
"position": [
496,
720
],
"typeVersion": 1,
"id": "269efabc-ebc1-4ae6-bf03-f842a43772a1",
"name": "Sticky Note2"
},
{
"parameters": {
"url": "=https://api.bamboohr.com/api/gateway.php/glm/v1/employees/{{ $json.body.employees[0].id }}?fields=terminationDate",
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-496,
496
],
"id": "fb3f7890-7fb7-477a-b66c-fccdd22bfaa1",
"name": "Fecha de terminacion",
"credentials": {
"httpBasicAuth": {
"id": "vXrW3oJWVhNbzB07",
"name": "GLM Credential"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "2b23d314-ad3e-474c-8402-29dca1169155",
"leftValue": "={{ $json.pass }}",
"rightValue": "Resignation (Voluntary)",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
-112,
496
],
"id": "65780c3c-be2e-410e-9326-1492a702d326",
"name": "Terminacion fue este mes?"
},
{
"parameters": {
"jsCode": "const terminationDate = $json.terminationDate;\n\nif (!terminationDate) return [{ json: { pass: false } }];\n\nconst termDate = new Date(terminationDate);\nconst now = new Date();\n\nconst sameMonth = termDate.getMonth() === now.getMonth();\nconst sameYear = termDate.getFullYear() === now.getFullYear();\n\nreturn [{ json: { pass: sameMonth && sameYear } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-304,
496
],
"id": "1ec58f88-4170-4689-aadf-a28f36951856",
"name": "Code in JavaScript3"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "bcb2b317-d609-4f88-bd66-46524555345e",
"leftValue": "={{\n (() => {\n const allowed = [\"motivos personales\", \"motivo no declarado\"];\n const homol = ($json.Homologacion_IA ?? \"\").toLowerCase().trim();\n const sub = ($json.Subcategoria_IA ?? \"\").toLowerCase().trim();\n \n const homolOk = homol === \"\" || allowed.includes(homol);\n const subOk = sub === \"\" || allowed.includes(sub);\n const anyFilled = homol !== \"\" || sub !== \"\";\n \n return anyFilled && homolOk && subOk;\n })()\n}}",
"rightValue": "true",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
528,
800
],
"id": "8b2b94e9-4880-45ca-9cb0-e250dd28bd60",
"name": "Es motivo personal?"
},
{
"parameters": {
"jsCode": "const pais = $input.first().json.Pais;\n\nconst emailMap = {\n \"Guatemala\": \"rgalvez@gomezleemarketing.com\",\n \"El Salvador\": \"cmalta@gomezleemarketing.com\",\n \"Honduras\": \"mchang@gomezleemarketing.com\",\n \"Nicaragua\": \"yestrada@gomezleemarketing.com\",\n \"Costa Rica\": \"lchaves@gomezleemarketing.com\",\n \"Mexico\": \"ccastro@gomezleemarketing.com\",\n \"Colombia\": \"rrhhcolombia@gomezleemarketing.com\",\n \"Jamaica\": \"lnicomejack@gomezleemarketing.com\",\n \"Republica Dominicana\": \"nlaureano@gomezleemarketing.com\",\n \"Panama\": \"dpenalba@gomezleemarketing.com\",\n \"Trinidad and Tobago\": \"lnicomejack@gomezleemarketing.com\"\n};\n\nconst hhrr_email = emailMap[pais] ?? \"\";\n\nreturn [{ json: { hhrr_email } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
752,
800
],
"id": "f03cf81c-1336-46d8-82f5-25cedd8b79e0",
"name": "Paises"
},
{
"parameters": {
"pollTimes": {
"item": []
},
"simple": false,
"maxResults": 1,
"filters": {
"q": "Motivo de Salida Actualizado"
},
"options": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"position": [
-960,
1296
],
"id": "f70a31a6-8f6c-402e-b3fc-9a9c4020a144",
"name": "Gmail Trigger",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.text }}",
"options": {
"systemMessage": "## Rol\nEres un analista de RRHH especializado en encuestas de salida para agencias de trade marketing en Latinoamérica (promotores, merchandisers, gestores de experiencia, supervisores, fuerza de campo).\n\nRecibirás respuestas abiertas a la pregunta: \"¿Por qué elegiste dejar la empresa?\" Tu tarea es clasificar cada respuesta en los campos indicados y devolver ÚNICAMENTE un array JSON — sin comentarios, sin markdown, sin texto adicional.\n\n---\n\n## Campos de salida\n### 1. `homologacion` (OBLIGATORIO)\nElegir uno de los labels que resuma correctamente el motivo por el que el empleado dejó la empresa, basado en\n- \"¿Por qué elegiste dejar la empresa?\"\n\n### 2. 'homologado 2' (OPCIONAL)\nUsar 'homologado 2' si en el campo \"¿Por qué elegiste dejar la empresa?\" detectas dos motivos. Usar los labels que resuma correctamente el motivo por el que el empleado dejó la empresa.\n\n### 3. 'sentimiento' (OBLIGATORIO) \nClasifica el sentimiento general de la respuesta en una de estas etiquetas: \n- Positivo: Habla bien de la empresa o marca, la salida es más por motivos personales o proyectos sin queja importante. \n- Neutro: Relato descriptivo, sin mucha carga emocional, mezcla de aspectos buenos y malos sin polarizar. \n- Negativo: Quejas claras, frustración, maltrato, sensación de injusticia, falta de apoyo, burnout. \nEn caso de duda entre neutro y negativo, elige negativo si hay queja directa sobre la empresa, marca, jefe o condiciones de trabajo.\n\n### 4. 'motivo' (OBLIGATORIO)\nDebes sacar el motivo de renuncia en el prompt. Debes poner todo el texto del motivo, no dejarlo por la mitad.\n\n**Labels:**\n- Si el motivo es personal → `\"Motivos Personales\"`\n- Si el motivo es porque está siendo mejor pagado en otro trabajo → '\"Remuneración\"'\n- Si el motivo es una queja sobre un supervisor → `\"Liderazgo / Jefe Directo\"`\n- Si no encuentras que categoría usar → '\"Otros\"'\n- Si el motivo es por otro trabajo → `\"Otro Trabajo / Traslado de Agencia\"`\n- Si no se dio ningún motivo → `\"No quiso responder\"`\n- Si el motivo fue por ambiente laboral o compañeros → '\"Ambiente Laboral / Compañeros\"'\n- Si el motivo es que siente que los horarios no le permiten equilibrar su vida personal y laboral → '\"Work Life Balance / Horarios\"'\n- Si el motivo es una queja de las condiciones físicas del punto de trabajo, del cliente al que representa, o de la marca asignada → '\"Marca / Cliente / Condiciones del Punto\"'\n- Si el motivo es una queja de falta de capacitación, procesos poco claros o desorganización interna → '\"Onboarding / Procesos / Organización\"'\n- Si el motivo es si siente que no tuvo las herramientas, recursos o apoyo necesario para hacer su trabajo → '\"Way of Work / Soporte Operativo\"'\n- Si el motivo es si siente que el trabajo no era lo que le ofrecieron o prometieron al momento de ser contratado → '\"Reclutamiento / Expectativa vs Realidad\"'\n\n---\n\n---\n\n## REGLAS DE FORMATO ESTRICTAS\n- Devuelve ÚNICAMENTE el contenido del array, sin corchetes [ ] que lo envuelvan\n- No uses bloques de código ni backticks de ningún tipo\n- No incluyas saltos de línea \\n dentro de los valores de texto\n- Cada objeto JSON debe estar en una sola línea continua\n- Separa cada objeto con una coma y un salto de línea entre ellos\n- No agregues ningún texto antes ni después de los objetos JSON\n- Tu output debe ser solo un JSON a la vez.\n- Debes ignorar los saludos y firmas del mensaje, por ejemplo:\n - Las firmas en correos se ven asi:\n GomezLee Marketing\n John Doe\n Coordinador RH Nicaragua\n jdoe@gomezleemarketing.com\n 9999 8888 Cl\n\n## Formato de salida\nDevuelve un array JSON. Cada elemento debe tener esta estructura exacta:\n{\n \"nombre_completo\": \"string (obligatorio)\"\n \"homologacion\": \"string (obligatorio)\",\n \"homologado_2\": \"string | null\",\n \"sentimiento\": \"Positivo | Neutro | Negativo\"\n \"insight_rrhh\": \"una frase breve con recomendación de mejora o hallazgo clave\",\n \"motivo\": \"<motivo de renuncia que se detecto en el prompt>\"\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-560,
1184
],
"id": "26b6c331-df9c-4db1-8934-b50d6b821300",
"name": "AI Agent1"
},
{
"parameters": {
"modelName": "models/gemini-3.1-pro-preview",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-560,
1392
],
"id": "05cd6b45-8cc4-4f5a-91bf-6d950a552b10",
"name": "Google Gemini Chat Model1",
"credentials": {
"googlePalmApi": {
"id": "tFqBJras00HUi1hA",
"name": "Eidan - Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "fb89d102-d52e-4be0-9373-ec58e8ef9742",
"name": "output",
"value": "={{ $json.output }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-256,
1184
],
"id": "e8a81e0f-deed-4c24-8a33-8c20231c5ba3",
"name": "Edit Fields1"
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA",
"mode": "list",
"cachedResultName": "TeamGLM_Encuesta_Salida_Homologada",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": 1596883141,
"mode": "list",
"cachedResultName": "Respuestas",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_vEMMGBclOZxaTeuHLXO_ucN0GmJ03Gm7jzOlzkVMFA/edit#gid=1596883141"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Homologacion_IA": "={{ $json.output.homologacion }}",
"Subcategoria_IA": "={{ $json.output.homologado_2 }}",
"Sentimiento_IA": "={{ $json.output.sentimiento }}",
"Insight_RRHH": "={{ $json.output.insight_rrhh }}",
"Nombre Completo": "={{ $json.name }}",
"¿Por qué elegiste dejar la empresa?": "={{ $json.output.motivo }}"
},
"matchingColumns": [
"Nombre Completo"
],
"schema": [
{
"id": "Timestamp",
"displayName": "Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Email Address",
"displayName": "Email Address",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Nombre Completo",
"displayName": "Nombre Completo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Pais",
"displayName": "Pais",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Cuenta o Proyecto",
"displayName": "Cuenta o Proyecto",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Posición",
"displayName": "Posición",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Podría considerar regresar a la organización en el futuro.",
"displayName": "Podría considerar regresar a la organización en el futuro.",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"displayName": "Me siento cómodo recomendando a otra persona para trabajar en la organización. ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "¿Por qué elegiste dejar la empresa?",
"displayName": "¿Por qué elegiste dejar la empresa?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"displayName": "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Número de Identidad (Cédula)",
"displayName": "Número de Identidad (Cédula)",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Numero de telefono",
"displayName": "Numero de telefono",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologacion ",
"displayName": "Homologacion ",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologado 2",
"displayName": "Homologado 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Jefe Directo",
"displayName": "Jefe Directo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Column 2",
"displayName": "Column 2",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Viene de agencia anterior",
"displayName": "Viene de agencia anterior",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Cedula",
"displayName": "Cedula",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "PDV",
"displayName": "PDV",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "TRADE PARTNER",
"displayName": "TRADE PARTNER",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "MES",
"displayName": "MES",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Homologacion_IA",
"displayName": "Homologacion_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subcategoria_IA",
"displayName": "Subcategoria_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sentimiento_IA",
"displayName": "Sentimiento_IA",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Insight_RRHH",
"displayName": "Insight_RRHH",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
112,
1184
],
"id": "6c5ac11b-3891-4331-9639-b4ede15f8ba5",
"name": "Añadir a Responses1",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
"name": "Eidan - Google Sheets account"
}
}
},
{
"parameters": {
"sendTo": "={{ $json.hhrr_email }}",
"subject": "Seguimiento requerido Encuesta de Salida",
"message": "=<!DOCTYPE html>\n<html>\n<body style=\"margin:0; padding:0; background:#f4f4f4;\">\n\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"font-family:Arial,sans-serif; margin:0 auto; border:1px solid #e0e0e0; background:#ffffff;\">\n\n <!-- HEADER -->\n <tr>\n <td style=\"background-color:#2d3748; padding:22px 28px; border-top-left-radius: 10px; border-top-right-radius: 10px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <p style=\"margin:0 0 3px 0; font-size:11px; color:rgba(255,255,255,0.55);\">Recursos Humanos</p>\n <p style=\"margin:0; font-size:16px; font-weight:bold; color:#ffffff;\">Seguimiento Requerido</p>\n </td>\n <td style=\"vertical-align:middle; text-align:right;\">\n <img src=\"https://drive.usercontent.google.com/download?id=1p3YgNhbcBHY5JalWgNODL0ynrRu3OmhO&export=view&authuser=0\"\n alt=\"GLM Logo\"\n width=\"120\"\n style=\"height:auto; display:block; margin-left:auto;\">\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- INTRO TEXT -->\n <tr>\n <td style=\"padding:24px 28px 16px 28px;\">\n <p style=\"margin:0 0 12px 0; font-size:14px; color:#333333; line-height:1.7;\">Estimado equipo de <strong>Recursos Humanos</strong>,</p>\n <p style=\"margin:0 0 12px 0; font-size:14px; color:#444444; line-height:1.8;\">El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró <strong>\"Motivos Personales\"</strong> o el motivo fue no declarado como razón de renuncia voluntaria.</p>\n <p style=\"margin:0; font-size:14px; color:#444444; line-height:1.8;\">Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida.</p>\n </td>\n </tr>\n\n <!-- EMPLOYEE CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0; background:#ffffff;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">👤</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Datos del empleado/a</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:0 16px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td width=\"80\" style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top; border-bottom:1px solid #f0f0f0;\">Nombre</td>\n <td style=\"padding:10px 0; font-size:13px; color:#222222; vertical-align:top; border-bottom:1px solid #f0f0f0;\">{{ $('Webhook1').item.json.body['Nombre Completo'] }}</td>\n </tr>\n <tr>\n <td style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top; border-bottom:1px solid #f0f0f0;\">Teléfono</td>\n <td style=\"padding:10px 0; font-size:13px; color:#222222; vertical-align:top; border-bottom:1px solid #f0f0f0;\">{{ $('Webhook1').item.json.body['Número de Telefono'] }}</td>\n </tr>\n <tr>\n <td style=\"padding:10px 0; font-size:13px; color:#888888; vertical-align:top;\">Correo</td>\n <td style=\"padding:10px 0; font-size:13px; vertical-align:top;\"><a href=\"#\" style=\"color:#4CAF50; text-decoration:none;\">{{ $('Webhook1').item.json.body.email }}</a></td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- ACTIONS CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">✅</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Acciones requeridas</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:14px 16px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; width:22px; font-size:13px; font-weight:700; color:#4CAF50;\">1.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Contactar al/la empleado/a en un plazo no mayor a <strong>3 días hábiles</strong>.</td>\n </tr>\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; font-size:13px; font-weight:700; color:#4CAF50;\">2.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Realizar la conversación de manera empática y confidencial.</td>\n </tr>\n <tr>\n <td style=\"padding:5px 0; vertical-align:top; font-size:13px; font-weight:700; color:#4CAF50;\">3.</td>\n <td style=\"padding:5px 0; font-size:13px; color:#444444; line-height:1.6;\">Registrar los hallazgos respondiendo este correo con el formato indicado.</td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- FORMAT CARD -->\n <tr>\n <td style=\"padding:0 28px 16px 28px;\">\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #e0e0e0;\">\n <tr>\n <td style=\"padding:14px 16px; border-bottom:1px solid #e0e0e0;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:middle;\">\n <div style=\"width:28px; height:28px; background:#e8f5e9; border-radius:50%; text-align:center; line-height:28px; font-size:14px;\">📋</div>\n </td>\n <td style=\"padding-left:10px; vertical-align:middle;\">\n <span style=\"font-size:14px; font-weight:600; color:#222222;\">Formato de respuesta</span>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:14px 16px;\">\n <p style=\"margin:0 0 8px 0; font-size:13px; color:#555555;\">Responda con el asunto <strong>exactamente</strong> así:</p>\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:14px;\">\n <tr>\n <td width=\"3\" bgcolor=\"#4CAF50\">&nbsp;</td>\n <td style=\"background:#f7f7f7; padding:9px 12px; font-family:Courier New,monospace; font-size:13px; color:#222222;\">Motivo de Salida Actualizado</td>\n </tr>\n </table>\n <p style=\"margin:0 0 8px 0; font-size:13px; color:#555555;\">Incluya en el cuerpo:</p>\n <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:10px;\">\n <tr>\n <td width=\"3\" bgcolor=\"#4CAF50\">&nbsp;</td>\n <td style=\"background:#f7f7f7; padding:10px 12px; font-family:Courier New,monospace; font-size:13px; color:#555555; line-height:1.9;\">\n Nombre completo: [nombre del empleado]<br>\n Motivo: [motivo real de salida]\n </td>\n </tr>\n </table>\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td style=\"vertical-align:top; font-size:13px; padding-right:6px;\">⚠️</td>\n <td style=\"font-size:12px; color:#999999; line-height:1.5;\">Mantener el formato exacto para el correcto registro en el sistema.</td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- CLOSING -->\n <tr>\n <td style=\"padding:8px 28px 24px 28px;\">\n <p style=\"margin:0 0 4px 0; font-size:14px; color:#444444;\">Agradecemos su gestión oportuna.</p>\n <p style=\"margin:0; font-size:14px; color:#444444;\">Saludos,</p>\n </td>\n </tr>\n\n <!-- FOOTER -->\n <tr>\n <td style=\"background:#f7f7f7; border-top:1px solid #e0e0e0; padding:12px 28px;\">\n <p style=\"margin:0; font-size:11px; color:#aaaaaa;\">Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing.</p>\n </td>\n </tr>\n\n</table>\n\n</body>\n</html>\n",
"options": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
928,
800
],
"id": "99ff8288-d1b6-46ac-830b-961e29372428",
"name": "Enviar revision",
"webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-1136,
1648
],
"id": "22aa2d29-e0a3-4a88-a66b-263400b580d8",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"method": "POST",
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $('Valores').item.json.repo_name }}/contents/{{ $('Valores').item.json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"message\": \"{{ $json.message }}\",\n \"content\": \"{{ $json.content }}\",\n \"branch\": \"{{ $json.branch }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-176,
1760
],
"id": "4c4644de-dfe1-468e-9b64-de32e31c7da5",
"name": "Subir archivo",
"retryOnFail": false,
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
}
},
{
"parameters": {
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $json.repo_name }}/contents/{{ $json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": []
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-784,
1648
],
"id": "1a7c30de-8279-489b-8658-475f816fcdd4",
"name": "Obtener archivo",
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"method": "PUT",
"url": "=https://git.digitalcompass.agency/api/v1/repos/EidanThen/{{ $('Valores').item.json.repo_name }}/contents/{{ $('Valores').item.json.file_name }}.json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"message\": \"{{ $json.message }}\",\n \"content\": \"{{ $json.content }}\",\n \"sha\": \"{{ $json.sha }}\",\n \"branch\": \"{{ $json.branch }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-176,
1552
],
"id": "21758ff9-fba7-45bc-9ae9-2c39cb4b8be8",
"name": "Actualizar archivo",
"credentials": {
"httpHeaderAuth": {
"id": "R4tnNpYoEjhBYeUT",
"name": "Eidan - gitea"
}
}
},
{
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"value": "5M9rWs6osbDQt4qQ",
"mode": "list",
"cachedResultName": "Encuesta de terminacion voluntaria (#5M9rWs6osbDQt4qQ)"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.n8n",
"typeVersion": 1,
"position": [
-528,
1552
],
"id": "da89a0fa-8a71-4b5b-8a12-931321c686d9",
"name": "Get a workflow1",
"credentials": {
"n8nApi": {
"id": "73Ydc9X8h5HXvFrt",
"name": "Eidan - n8n account"
}
}
},
{
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"value": "5M9rWs6osbDQt4qQ",
"mode": "list",
"cachedResultName": "Encuesta de terminacion voluntaria (#5M9rWs6osbDQt4qQ)"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.n8n",
"typeVersion": 1,
"position": [
-528,
1760
],
"id": "c7ec06a9-863f-4e2e-b0bc-ab0e58eb1f09",
"name": "Get a workflow2",
"credentials": {
"n8nApi": {
"id": "73Ydc9X8h5HXvFrt",
"name": "Eidan - n8n account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "3519ad4c-6d66-4963-ab76-ee5517d88d67",
"name": "repo_name",
"value": "encuesta-terminacion-voluntaria",
"type": "string"
},
{
"id": "0df99f1e-1354-43b9-9d20-9f994cc82cf6",
"name": "file_name",
"value": "encuesta",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-960,
1648
],
"id": "30b21b9a-a62e-4f30-8a8c-d3247d917327",
"name": "Valores"
},
{
"parameters": {
"jsCode": "const sha = $('Obtener archivo').first().json.sha;\nconst data = { $json };\n\nreturn [{\n json: {\n message: \"Update \" + $('Valores').first().json.file_name + \".json\",\n content: Buffer.from(JSON.stringify(data, null, 2)).toString(\"base64\"),\n sha: sha,\n branch: \"main\"\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-352,
1552
],
"id": "a25dcd9c-c6b2-4f6c-8091-96850848eea7",
"name": "Code in JavaScript2"
},
{
"parameters": {
"jsCode": "const sha = $json.sha; // viene del GET anterior\nconst data = { $json };\n\nconst base64 = Buffer.from(JSON.stringify(data, null, 2)).toString(\"base64\");\n\nreturn [{\n json: {\n message: \"Create \" + $('Valores').first().json.file_name + \".json\",\n content: base64,\n sha: sha,\n branch: \"main\"\n }\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-352,
1760
],
"id": "dbacc193-fbeb-4a24-9ca5-15a19c7cc59e",
"name": "Code in JavaScript4"
},
{
"parameters": {
"jsCode": "const name = $('Webhook1').first().json.body['Nombre Completo'];\nconst trimmedName = name.trim();\n\nreturn [{ json: { name: trimmedName } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
160,
800
],
"id": "776bfd32-d5d8-4bc2-a973-43aa0d0ab6b7",
"name": "Eliminar espacios vacios"
},
{
"parameters": {
"jsCode": "const name = $input.first().json.output.nombre_completo;\nconst trimmedName = name.trim();\n\nreturn [{ json: { name: trimmedName } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-80,
1184
],
"id": "5c923ea6-8837-4c7d-b223-4158f650b5e7",
"name": "Eliminar espacios vacios1"
},
{
"parameters": {
"content": "## Webhook\n\nRecibe el nuevo motivo del empleado",
"height": 256,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
1168
],
"typeVersion": 1,
"id": "853d3d99-ce54-4ddd-aed9-81fca72fd1c3",
"name": "Sticky Note3"
},
{
"parameters": {
"jsCode": "const text = $input.first().json.text;\n\nconst cutMarker = 'gomezlee marketing';\nconst cutIndex = text.toLowerCase().indexOf(cutMarker);\n\nlet cleaned = text;\n\nif (cutIndex !== -1) {\n cleaned = text.slice(0, cutIndex).trim();\n}\n\nreturn [{ json: { body: cleaned } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-720,
1184
],
"id": "62d87e71-05aa-459b-a301-67d7cafb5643",
"name": "Limpiar texto"
},
{
"parameters": {
"content": "## Limpiar texto\n\nEliminar la firma y mensaje de confidencialidad del texto",
"height": 256,
"width": 176
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-768,
1056
],
"typeVersion": 1,
"id": "37987422-8a55-472c-9ab0-13695aac0319",
"name": "Sticky Note4"
},
{
"parameters": {
"pollTimes": {
"item": []
},
"simple": false,
"maxResults": 1,
"filters": {
"q": "Re: Seguimiento requerido Encuesta de Salida"
},
"options": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"position": [
-960,
1040
],
"id": "fe989cda-2bde-4df1-95ed-511e67928a67",
"name": "Gmail Trigger1",
"credentials": {
"gmailOAuth2": {
"id": "QWNicjw1khRm5BVI",
"name": "Eidan - Gmail account"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Webhook1": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Añadir a Responses": {
"main": [
[
{
"node": "Es motivo personal?",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Eliminar espacios vacios",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Fecha de terminacion",
"type": "main",
"index": 0
}
]
]
},
"Fecha de terminacion": {
"main": [
[
{
"node": "Code in JavaScript3",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript3": {
"main": [
[
{
"node": "Terminacion fue este mes?",
"type": "main",
"index": 0
}
]
]
},
"Terminacion fue este mes?": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Es motivo personal?": {
"main": [
[
{
"node": "Paises",
"type": "main",
"index": 0
}
],
[]
]
},
"Paises": {
"main": [
[
{
"node": "Enviar revision",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Limpiar texto",
"type": "main",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Eliminar espacios vacios1",
"type": "main",
"index": 0
}
]
]
},
"When clicking Execute workflow": {
"main": [
[
{
"node": "Valores",
"type": "main",
"index": 0
}
]
]
},
"Obtener archivo": {
"main": [
[
{
"node": "Get a workflow1",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a workflow2",
"type": "main",
"index": 0
}
]
]
},
"Get a workflow1": {
"main": [
[
{
"node": "Code in JavaScript2",
"type": "main",
"index": 0
}
]
]
},
"Get a workflow2": {
"main": [
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Valores": {
"main": [
[
{
"node": "Obtener archivo",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript2": {
"main": [
[
{
"node": "Actualizar archivo",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript4": {
"main": [
[
{
"node": "Subir archivo",
"type": "main",
"index": 0
}
]
]
},
"Eliminar espacios vacios": {
"main": [
[
{
"node": "Añadir a Responses",
"type": "main",
"index": 0
}
]
]
},
"Eliminar espacios vacios1": {
"main": [
[
{
"node": "Añadir a Responses1",
"type": "main",
"index": 0
}
]
]
},
"Limpiar texto": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger1": {
"main": [
[
{
"node": "Limpiar texto",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Eidan Then",
"name": "Version 6da058c1",
"description": "",
"autosaved": true,
"workflowPublishHistory": [
{
"createdAt": "2026-06-15T17:54:09.709Z",
"id": 1405,
"workflowId": "5M9rWs6osbDQt4qQ",
"versionId": "6da058c1-2180-4992-a66e-9272e756a7b9",
"event": "activated",
"userId": "de14e7e5-491b-4983-abb2-f88af42e92fd"
}
]
}
}
}