diff --git a/encuesta.json b/encuesta.json
index 6505cbb..22e493e 100644
--- a/encuesta.json
+++ b/encuesta.json
@@ -1,6 +1,6 @@
{
"$json": {
- "updatedAt": "2026-06-18T19:08:15.057Z",
+ "updatedAt": "2026-07-24T15:56:12.330Z",
"createdAt": "2026-04-28T16:51:28.159Z",
"id": "5M9rWs6osbDQt4qQ",
"name": "Encuesta de terminacion voluntaria",
@@ -48,8 +48,8 @@
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
- -880,
- 800
+ -912,
+ 864
],
"id": "479a1053-7cd1-4eab-8be4-02f256077857",
"name": "Webhook1",
@@ -67,7 +67,7 @@
"typeVersion": 3.1,
"position": [
-496,
- 800
+ 864
],
"id": "9644f4c2-2037-4fe1-866c-3485ba95c35f",
"name": "AI Agent"
@@ -80,7 +80,7 @@
"typeVersion": 2,
"position": [
-688,
- 800
+ 864
],
"id": "6a8a01b8-7c7d-465a-b9d1-31af0741e620",
"name": "Code in JavaScript"
@@ -109,7 +109,6 @@
"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'] }}",
@@ -120,18 +119,20 @@
"¿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'] }}"
+ "Numero de telefono": "={{ $('Webhook1').item.json.body['Número de Telefono'] }}",
+ " Timestamp": "={{ $('Webhook1').item.json.body.timestamp }}"
},
"matchingColumns": [],
"schema": [
{
- "id": "Timestamp",
- "displayName": "Timestamp",
+ "id": " Timestamp",
+ "displayName": " Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
- "canBeUsedToMatch": true
+ "canBeUsedToMatch": true,
+ "removed": false
},
{
"id": "Email Address",
@@ -361,7 +362,7 @@
"typeVersion": 4.7,
"position": [
352,
- 800
+ 864
],
"id": "b306db08-66b4-40d1-ad58-a433973938dc",
"name": "Añadir a Responses",
@@ -380,7 +381,7 @@
"typeVersion": 2,
"position": [
-192,
- 800
+ 864
],
"id": "af8f8247-1479-42ae-a869-2a726f29e7dc",
"name": "Code in JavaScript1"
@@ -403,7 +404,7 @@
"typeVersion": 3.4,
"position": [
-16,
- 800
+ 864
],
"id": "6a6292ef-d64e-46eb-9053-66a1a4ac06a2",
"name": "Edit Fields"
@@ -417,7 +418,7 @@
"typeVersion": 1,
"position": [
-496,
- 1008
+ 1072
],
"id": "f451f7bd-983c-4154-9fd6-41b98297d9aa",
"name": "Google Gemini Chat Model",
@@ -469,8 +470,8 @@
},
"type": "n8n-nodes-base.stickyNote",
"position": [
- -944,
- 688
+ -976,
+ 752
],
"typeVersion": 1,
"id": "59f2ade7-80fa-49b1-a82a-34ff5767b574",
@@ -509,8 +510,8 @@
},
"type": "n8n-nodes-base.stickyNote",
"position": [
- 496,
- 720
+ 1216,
+ 784
],
"typeVersion": 1,
"id": "269efabc-ebc1-4ae6-bf03-f842a43772a1",
@@ -606,7 +607,7 @@
"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}}",
+ "leftValue": "={{\n (() => {\n const allowed = [\"motivos personales\", \"motivo no declarado\"];\n const homol = ($('Añadir a Responses').item.json.Homologacion_IA ?? \"\").toLowerCase().trim();\n const sub = ($('Añadir a Responses').item.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",
@@ -622,21 +623,21 @@
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
- 528,
- 800
+ 1264,
+ 864
],
"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 } }];"
+ "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
+ 912,
+ 864
],
"id": "f03cf81c-1336-46d8-82f5-25cedd8b79e0",
"name": "Paises"
@@ -658,7 +659,7 @@
"typeVersion": 1.4,
"position": [
-944,
- 1184
+ 1264
],
"id": "f70a31a6-8f6c-402e-b3fc-9a9c4020a144",
"name": "Gmail Trigger",
@@ -681,7 +682,7 @@
"typeVersion": 3.1,
"position": [
-560,
- 1184
+ 1264
],
"id": "26b6c331-df9c-4db1-8934-b50d6b821300",
"name": "AI Agent1"
@@ -695,7 +696,7 @@
"typeVersion": 1,
"position": [
-560,
- 1392
+ 1472
],
"id": "05cd6b45-8cc4-4f5a-91bf-6d950a552b10",
"name": "Google Gemini Chat Model1",
@@ -724,11 +725,457 @@
"typeVersion": 3.4,
"position": [
-256,
- 1184
+ 1264
],
"id": "e8a81e0f-deed-4c24-8a33-8c20231c5ba3",
"name": "Edit Fields1"
},
+ {
+ "parameters": {
+ "sendTo": "={{ $('Paises').item.json.hhrr_email }}",
+ "subject": "Seguimiento requerido – Encuesta de Salida",
+ "message": "=\n\n
\n\n\n\n \n \n \n \n \n | \n Recursos Humanos \n Seguimiento Requerido \n | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Estimado equipo de Recursos Humanos, \n El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró \"Motivos Personales\" o el motivo fue no declarado como razón de renuncia voluntaria. \n Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida. \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 👤 \n | \n \n Datos del empleado/a\n | \n \n \n | \n \n \n \n \n \n | Nombre | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n ✅ \n | \n \n Acciones requeridas\n | \n \n \n | \n \n \n \n \n \n | 1. | \n Contactar al/la empleado/a en un plazo no mayor a 3 días hábiles. | \n \n \n | 2. | \n Realizar la conversación de manera empática y confidencial. | \n \n \n | 3. | \n Registrar los hallazgos respondiendo este correo con el formato indicado. | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 📋 \n | \n \n Formato de respuesta\n | \n \n \n | \n \n \n | \n Responda con el asunto exactamente así: \n \n \n | | \n Motivo de Salida Actualizado | \n \n \n Incluya en el cuerpo: \n \n \n | | \n \n Nombre completo: [nombre del empleado] \n Motivo: [motivo real de salida]\n | \n \n \n \n \n | ⚠️ | \n Mantener el formato exacto para el correcto registro en el sistema. | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Agradecemos su gestión oportuna. \n Saludos, \n | \n
\n\n \n \n | \n Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing. \n | \n
\n\n
\n\n\n\n",
+ "options": {
+ "appendAttribution": false
+ }
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.2,
+ "position": [
+ 1504,
+ 864
+ ],
+ "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": [
+ -880,
+ 1968
+ ],
+ "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": [
+ 80,
+ 2080
+ ],
+ "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": [
+ -528,
+ 1968
+ ],
+ "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": [
+ 80,
+ 1872
+ ],
+ "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": [
+ -272,
+ 1872
+ ],
+ "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": [
+ -272,
+ 2080
+ ],
+ "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": [
+ -704,
+ 1968
+ ],
+ "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": [
+ -96,
+ 1872
+ ],
+ "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": [
+ -96,
+ 2080
+ ],
+ "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,
+ 864
+ ],
+ "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,
+ 1264
+ ],
+ "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,
+ 1136
+ ],
+ "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,
+ 1264
+ ],
+ "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,
+ 1136
+ ],
+ "typeVersion": 1,
+ "id": "37987422-8a55-472c-9ab0-13695aac0319",
+ "name": "Sticky Note4"
+ },
+ {
+ "parameters": {
+ "content": "### Elimina espacios vacios en despues del nombre",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ 112,
+ 784
+ ],
+ "typeVersion": 1,
+ "id": "5271ef80-bfb3-4097-a5c0-8a095e2e1b64",
+ "name": "Sticky Note5"
+ },
+ {
+ "parameters": {
+ "content": "### Elimina espacios vacios en despues del nombre",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -128,
+ 1184
+ ],
+ "typeVersion": 1,
+ "id": "d3ac1a35-594d-44ea-a63f-2d0d95ef6e56",
+ "name": "Sticky Note6"
+ },
+ {
+ "parameters": {
+ "content": "### Limpiar respuesta del agente",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -240,
+ 784
+ ],
+ "typeVersion": 1,
+ "id": "190b5477-4d2b-4def-95f6-bf4ff0dd1e7a",
+ "name": "Sticky Note7"
+ },
+ {
+ "parameters": {
+ "sendTo": "={{ $json.hhrr_email }}",
+ "subject": "Nueva Encuesta de Salida Recibida",
+ "message": "=\n\n\n\nNueva Encuesta de Salida\n\n\n \n \n \n \n \n \n \n \n \n \n \n Nueva Encuesta de Salida Recibida\n | \n \n \n | \n \n \n | \n \n\n \n \n \n Datos Personales\n \n \n | Nombre Completo | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | Número de Identidad (Cédula) | \n {{ $('Webhook1').item.json.body['Número de Identidad (Cédula)'] }} | \n \n \n | Número de Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | País | \n {{ $('Webhook1').item.json.body.Pais }} | \n \n \n | Fecha de envío | \n {{ $('Webhook1').item.json.body.timestamp }} | \n \n \n | \n \n\n \n \n \n Datos Laborales\n \n \n | Cuenta o Proyecto | \n {{ $('Webhook1').item.json.body['Cuenta o Proyecto'] }} | \n \n \n | Posición | \n {{ $('Webhook1').item.json.body['Posición'] }} | \n \n \n | \n \n\n \n \n \n Encuesta de Salida\n\n ¿Podría considerar regresar a la organización en el futuro? \n {{ $('Webhook1').item.json.body['Podría considerar regresar a la organización en el futuro.'] }} \n\n ¿Se siente cómodo/a recomendando a otra persona para trabajar en la organización? \n {{ $('Webhook1').item.json.body['Me siento cómodo recomendando a otra persona para trabajar en la organización. '] }} \n\n ¿Por qué eligió dejar la empresa? \n {{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }} \n\n Comentarios o sugerencias \n {{ $('Webhook1').item.json.body['¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?'] }} \n | \n \n\n \n \n | \n Este correo fue generado automáticamente. \n | \n \n\n \n | \n
\n
\n\n",
+ "options": {
+ "appendAttribution": false
+ }
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.2,
+ "position": [
+ 1072,
+ 864
+ ],
+ "id": "24c8ffa4-bfaa-47ab-9e24-635b1d4b6a35",
+ "name": "Enviar respuestas a RRHH",
+ "webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
+ "credentials": {
+ "gmailOAuth2": {
+ "id": "QWNicjw1khRm5BVI",
+ "name": "Eidan - Gmail account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "tableId": "encuesta_terminacion_glm",
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Añadir a Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.supabase",
+ "typeVersion": 1,
+ "position": [
+ 736,
+ 864
+ ],
+ "id": "0a99fbf1-b407-48ca-b994-17d17e2852f2",
+ "name": "Insertar respuesta",
+ "credentials": {
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "jsCode": "function convertirBoolean(valor) {\n const texto = String(valor ?? \"\")\n .trim()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toLowerCase();\n\n if (texto === \"si\") return true;\n if (texto === \"no\") return false;\n return null;\n}\n\nreturn $input.all().map(item => ({\n json: {\n ...item.json, // Mantiene todas las columnas originales\n considera_regresar: convertirBoolean(\n item.json['Podría considerar regresar a la organización en el futuro.']\n ),\n comodo_recomendando: convertirBoolean(\n item.json['Me siento cómodo recomendando a otra persona para trabajar en la organización. ']\n ),\n }\n}));"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 544,
+ 864
+ ],
+ "id": "82e86d61-872a-4d32-bb91-6abfbf68d549",
+ "name": "Convertir a boolean"
+ },
{
"parameters": {
"operation": "update",
@@ -1015,10 +1462,10 @@
"typeVersion": 4.7,
"position": [
112,
- 1184
+ 1264
],
"id": "6c5ac11b-3891-4331-9639-b4ede15f8ba5",
- "name": "Añadir a Responses1",
+ "name": "Actualizar a Responses",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
@@ -1028,340 +1475,285 @@
},
{
"parameters": {
- "sendTo": "={{ $json.hhrr_email }}",
- "subject": "Seguimiento requerido – Encuesta de Salida",
- "message": "=\n\n\n\n\n\n \n \n \n \n \n | \n Recursos Humanos \n Seguimiento Requerido \n | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Estimado equipo de Recursos Humanos, \n El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró \"Motivos Personales\" o el motivo fue no declarado como razón de renuncia voluntaria. \n Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida. \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 👤 \n | \n \n Datos del empleado/a\n | \n \n \n | \n \n \n \n \n \n | Nombre | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n ✅ \n | \n \n Acciones requeridas\n | \n \n \n | \n \n \n \n \n \n | 1. | \n Contactar al/la empleado/a en un plazo no mayor a 3 días hábiles. | \n \n \n | 2. | \n Realizar la conversación de manera empática y confidencial. | \n \n \n | 3. | \n Registrar los hallazgos respondiendo este correo con el formato indicado. | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 📋 \n | \n \n Formato de respuesta\n | \n \n \n | \n \n \n | \n Responda con el asunto exactamente así: \n \n \n | | \n Motivo de Salida Actualizado | \n \n \n Incluya en el cuerpo: \n \n \n | | \n \n Nombre completo: [nombre del empleado] \n Motivo: [motivo real de salida]\n | \n \n \n \n \n | ⚠️ | \n Mantener el formato exacto para el correcto registro en el sistema. | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Agradecemos su gestión oportuna. \n Saludos, \n | \n
\n\n \n \n | \n Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing. \n | \n
\n\n
\n\n\n\n",
- "options": {
- "appendAttribution": false
+ "operation": "update",
+ "tableId": "encuesta_terminacion_glm",
+ "filters": {
+ "conditions": [
+ {
+ "keyName": "nombre",
+ "condition": "eq",
+ "keyValue": "={{ $json.name }}"
+ }
+ ]
+ },
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Añadir a Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ }
+ ]
}
},
- "type": "n8n-nodes-base.gmail",
- "typeVersion": 2.2,
+ "type": "n8n-nodes-base.supabase",
+ "typeVersion": 1,
"position": [
- 928,
- 800
+ 320,
+ 1264
],
- "id": "99ff8288-d1b6-46ac-830b-961e29372428",
- "name": "Enviar revision",
- "webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
+ "id": "c1a0d204-2430-49c4-9dda-87181797bfc1",
+ "name": "Actualizar respuesta",
"credentials": {
- "gmailOAuth2": {
- "id": "QWNicjw1khRm5BVI",
- "name": "Eidan - Gmail account"
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
}
}
},
{
- "parameters": {},
- "type": "n8n-nodes-base.manualTrigger",
+ "parameters": {
+ "jsCode": "function convertirBoolean(valor) {\n const texto = String(valor ?? \"\")\n .trim()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toLowerCase();\n\n if (texto === \"si\") return true;\n if (texto === \"no\") return false;\n return null;\n}\n\nreturn $input.all().map(item => ({\n json: {\n ...item.json, // Mantiene todas las columnas originales\n considera_regresar: convertirBoolean(\n item.json['Podría considerar regresar a la organización en el futuro.']\n ),\n comodo_recomendando: convertirBoolean(\n item.json['Me siento cómodo recomendando a otra persona para trabajar en la organización. ']\n ),\n }\n}));"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ -560,
+ 1696
+ ],
+ "id": "390737f4-cbe3-412e-bae0-14fd69bdfcbd",
+ "name": "Code in JavaScript5"
+ },
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "triggerAtHour": 8
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.3,
+ "position": [
+ -928,
+ 1696
+ ],
+ "id": "898810f2-6309-40fe-92d8-b526fe6cd638",
+ "name": "Schedule Trigger"
+ },
+ {
+ "parameters": {
+ "operation": "update",
+ "tableId": "encuesta_terminacion_glm",
+ "filters": {
+ "conditions": [
+ {
+ "keyName": "nombre",
+ "condition": "eq",
+ "keyValue": "={{ $json['Nombre Completo'] }}"
+ }
+ ]
+ },
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ },
+ {
+ "fieldId": "jefe_directo",
+ "fieldValue": "={{ $json['Jefe Directo'] }}"
+ },
+ {
+ "fieldId": "pdv",
+ "fieldValue": "={{ $json.PDV }}"
+ },
+ {
+ "fieldId": "trade_partner",
+ "fieldValue": "={{ $json['TRADE PARTNER'] }}"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
- -1136,
- 1648
+ -384,
+ 1696
],
- "id": "22aa2d29-e0a3-4a88-a66b-263400b580d8",
- "name": "When clicking ‘Execute workflow’"
+ "id": "f2e728eb-9488-412c-8fbd-18489f58b96a",
+ "name": "Actualizar datos",
+ "credentials": {
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "content": "## Actualizar datos de los empleados (pdv, jefe directo, trade partner)",
+ "height": 192,
+ "width": 736
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -992,
+ 1616
+ ],
+ "typeVersion": 1,
+ "id": "a53b54c1-eb5f-4417-a509-e260abd16e92",
+ "name": "Sticky Note8"
+ },
+ {
+ "parameters": {
+ "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"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.googleSheets",
+ "typeVersion": 4.7,
+ "position": [
+ -736,
+ 1696
+ ],
+ "id": "9fa8fa82-91d3-4391-a361-d13e0b07643e",
+ "name": "Obtener Responses",
+ "credentials": {
+ "googleSheetsOAuth2Api": {
+ "id": "8Pp0ek3NPsEkyXfY",
+ "name": "Eidan - Google Sheets account"
+ }
+ }
},
{
"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",
+ "url": "https://dbit.digitalcompass.agency/rest/v1/rpc/incrementar_encuestas_terminacion_enviadas",
"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": [
+ "parameters": [
{
- "id": "3519ad4c-6d66-4963-ab76-ee5517d88d67",
- "name": "repo_name",
- "value": "encuesta-terminacion-voluntaria",
- "type": "string"
+ "name": "apikey",
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
},
{
- "id": "0df99f1e-1354-43b9-9d20-9f994cc82cf6",
- "name": "file_name",
- "value": "encuesta",
- "type": "string"
+ "name": "Authorization",
+ "value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
}
]
},
"options": {}
},
- "type": "n8n-nodes-base.set",
- "typeVersion": 3.4,
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
"position": [
- -960,
- 1648
+ 288,
+ 496
],
- "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"
- },
- {
- "parameters": {
- "content": "### Elimina espacios vacios en despues del nombre",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- 112,
- 720
- ],
- "typeVersion": 1,
- "id": "5271ef80-bfb3-4097-a5c0-8a095e2e1b64",
- "name": "Sticky Note5"
- },
- {
- "parameters": {
- "content": "### Elimina espacios vacios en despues del nombre",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- -128,
- 1104
- ],
- "typeVersion": 1,
- "id": "d3ac1a35-594d-44ea-a63f-2d0d95ef6e56",
- "name": "Sticky Note6"
- },
- {
- "parameters": {
- "content": "### Limpiar respuesta del agente",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- -240,
- 720
- ],
- "typeVersion": 1,
- "id": "190b5477-4d2b-4def-95f6-bf4ff0dd1e7a",
- "name": "Sticky Note7"
+ "id": "8f061980-d232-4916-9f98-008e5c482228",
+ "name": "Incrementar encuestas enviadas"
}
],
"connections": {
@@ -1413,7 +1805,7 @@
"main": [
[
{
- "node": "Es motivo personal?",
+ "node": "Convertir a boolean",
"type": "main",
"index": 0
}
@@ -1501,7 +1893,7 @@
"main": [
[
{
- "node": "Paises",
+ "node": "Enviar revision",
"type": "main",
"index": 0
}
@@ -1513,7 +1905,7 @@
"main": [
[
{
- "node": "Enviar revision",
+ "node": "Enviar respuestas a RRHH",
"type": "main",
"index": 0
}
@@ -1663,7 +2055,7 @@
"main": [
[
{
- "node": "Añadir a Responses1",
+ "node": "Actualizar a Responses",
"type": "main",
"index": 0
}
@@ -1680,6 +2072,94 @@
}
]
]
+ },
+ "Enviar respuestas a RRHH": {
+ "main": [
+ [
+ {
+ "node": "Es motivo personal?",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Convertir a boolean": {
+ "main": [
+ [
+ {
+ "node": "Insertar respuesta",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Insertar respuesta": {
+ "main": [
+ [
+ {
+ "node": "Paises",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Actualizar a Responses": {
+ "main": [
+ [
+ {
+ "node": "Actualizar respuesta",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Code in JavaScript5": {
+ "main": [
+ [
+ {
+ "node": "Actualizar datos",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Schedule Trigger": {
+ "main": [
+ [
+ {
+ "node": "Obtener Responses",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Obtener Responses": {
+ "main": [
+ [
+ {
+ "node": "Code in JavaScript5",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Send a message": {
+ "main": [
+ [
+ {
+ "node": "Incrementar encuestas enviadas",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
}
},
"settings": {
@@ -1694,25 +2174,79 @@
"staticData": {
"node:Gmail Trigger": {
"Gmail Trigger": {
- "lastTimeChecked": 1780934929,
+ "lastTimeChecked": 1781540851,
"pendingMessageIds": [
- "19ecc1c0c236b0f4"
+ "19f3eb2c3183959a",
+ "19f3e90c4967f6ca",
+ "19ecc536d3896bd8"
],
"possibleDuplicates": [
- "19ea7fe6cbb29000",
- "19ecc536d3896bd8"
+ "19ecc1c0c236b0f4",
+ "19f157339c233f75",
+ "19ef5aa28ea17ee5",
+ "19ef1b0d94ceaee7",
+ "19ee04022e005d3d",
+ "19edd0d4c5123683",
+ "19ecc16dba75868b",
+ "19ecc14b03ec9362",
+ "19ea8063013aaa8b",
+ "19f5cc4931b33765"
]
}
+ },
+ "node:Schedule Trigger": {
+ "recurrenceRules": []
}
},
"meta": {
"templateCredsSetupCompleted": true
},
- "pinData": {},
- "versionId": "be6a3b5f-723e-42bd-a3f6-8d6f742a754c",
- "activeVersionId": "be6a3b5f-723e-42bd-a3f6-8d6f742a754c",
- "versionCounter": 1616,
- "triggerCount": 3,
+ "pinData": {
+ "Webhook1": [
+ {
+ "json": {
+ "headers": {
+ "host": "agenteit.digitalcompass.agency",
+ "user-agent": "Mozilla/5.0 (compatible; Google-Apps-Script; beanserver; +https://script.google.com; id: UAEmdDd80M2Gj3NuVzQPALFEMKt-8dSBNWC4)",
+ "content-length": "656",
+ "accept-encoding": "gzip, deflate, br",
+ "content-type": "application/json",
+ "x-forwarded-for": "34.116.28.103",
+ "x-forwarded-host": "agenteit.digitalcompass.agency",
+ "x-forwarded-port": "443",
+ "x-forwarded-proto": "https",
+ "x-forwarded-server": "07b4f09d2c65",
+ "x-real-ip": "34.116.28.103"
+ },
+ "params": {},
+ "query": {},
+ "body": {
+ "email": "jaquelinehernandezescobar@gmail.com",
+ "timestamp": "07/21/2026 18:04:39",
+ "Nombre Completo": "Jaqueline Maria Hernández Escobar",
+ "Número de Identidad (Cédula)": "001-1223855-5 ",
+ "Número de Telefono": "8497078890",
+ "Pais": "Republica Dominicana",
+ "Cuenta o Proyecto": "Claro",
+ "Posición": "Auxiliar contsbilidad",
+ "Podría considerar regresar a la organización en el futuro.": "Sí",
+ "Me siento cómodo recomendando a otra persona para trabajar en la organización. ": "Si",
+ "¿Por qué elegiste dejar la empresa?": "Una mejor propuesta laboral",
+ "¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?": "Poco personal para el flujo de trabajo"
+ },
+ "webhookUrl": "https://agenteit.digitalcompass.agency/webhook/encuesta",
+ "executionMode": "production"
+ },
+ "pairedItem": {
+ "item": 0
+ }
+ }
+ ]
+ },
+ "versionId": "56413603-ac91-4051-99fe-bbee7c006b04",
+ "activeVersionId": "56413603-ac91-4051-99fe-bbee7c006b04",
+ "versionCounter": 2072,
+ "triggerCount": 4,
"shared": [
{
"updatedAt": "2026-04-28T16:51:28.169Z",
@@ -1734,9 +2268,9 @@
],
"tags": [],
"activeVersion": {
- "updatedAt": "2026-06-18T19:08:41.000Z",
- "createdAt": "2026-06-18T19:08:15.062Z",
- "versionId": "be6a3b5f-723e-42bd-a3f6-8d6f742a754c",
+ "updatedAt": "2026-07-24T15:59:45.000Z",
+ "createdAt": "2026-07-24T15:56:12.334Z",
+ "versionId": "56413603-ac91-4051-99fe-bbee7c006b04",
"workflowId": "5M9rWs6osbDQt4qQ",
"nodes": [
{
@@ -1779,8 +2313,8 @@
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
- -880,
- 800
+ -912,
+ 864
],
"id": "479a1053-7cd1-4eab-8be4-02f256077857",
"name": "Webhook1",
@@ -1798,7 +2332,7 @@
"typeVersion": 3.1,
"position": [
-496,
- 800
+ 864
],
"id": "9644f4c2-2037-4fe1-866c-3485ba95c35f",
"name": "AI Agent"
@@ -1811,7 +2345,7 @@
"typeVersion": 2,
"position": [
-688,
- 800
+ 864
],
"id": "6a8a01b8-7c7d-465a-b9d1-31af0741e620",
"name": "Code in JavaScript"
@@ -1840,7 +2374,6 @@
"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'] }}",
@@ -1851,18 +2384,20 @@
"¿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'] }}"
+ "Numero de telefono": "={{ $('Webhook1').item.json.body['Número de Telefono'] }}",
+ " Timestamp": "={{ $('Webhook1').item.json.body.timestamp }}"
},
"matchingColumns": [],
"schema": [
{
- "id": "Timestamp",
- "displayName": "Timestamp",
+ "id": " Timestamp",
+ "displayName": " Timestamp",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
- "canBeUsedToMatch": true
+ "canBeUsedToMatch": true,
+ "removed": false
},
{
"id": "Email Address",
@@ -2092,7 +2627,7 @@
"typeVersion": 4.7,
"position": [
352,
- 800
+ 864
],
"id": "b306db08-66b4-40d1-ad58-a433973938dc",
"name": "Añadir a Responses",
@@ -2111,7 +2646,7 @@
"typeVersion": 2,
"position": [
-192,
- 800
+ 864
],
"id": "af8f8247-1479-42ae-a869-2a726f29e7dc",
"name": "Code in JavaScript1"
@@ -2134,7 +2669,7 @@
"typeVersion": 3.4,
"position": [
-16,
- 800
+ 864
],
"id": "6a6292ef-d64e-46eb-9053-66a1a4ac06a2",
"name": "Edit Fields"
@@ -2148,7 +2683,7 @@
"typeVersion": 1,
"position": [
-496,
- 1008
+ 1072
],
"id": "f451f7bd-983c-4154-9fd6-41b98297d9aa",
"name": "Google Gemini Chat Model",
@@ -2200,8 +2735,8 @@
},
"type": "n8n-nodes-base.stickyNote",
"position": [
- -944,
- 688
+ -976,
+ 752
],
"typeVersion": 1,
"id": "59f2ade7-80fa-49b1-a82a-34ff5767b574",
@@ -2240,8 +2775,8 @@
},
"type": "n8n-nodes-base.stickyNote",
"position": [
- 496,
- 720
+ 1216,
+ 784
],
"typeVersion": 1,
"id": "269efabc-ebc1-4ae6-bf03-f842a43772a1",
@@ -2337,7 +2872,7 @@
"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}}",
+ "leftValue": "={{\n (() => {\n const allowed = [\"motivos personales\", \"motivo no declarado\"];\n const homol = ($('Añadir a Responses').item.json.Homologacion_IA ?? \"\").toLowerCase().trim();\n const sub = ($('Añadir a Responses').item.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",
@@ -2353,21 +2888,21 @@
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
- 528,
- 800
+ 1264,
+ 864
],
"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 } }];"
+ "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
+ 912,
+ 864
],
"id": "f03cf81c-1336-46d8-82f5-25cedd8b79e0",
"name": "Paises"
@@ -2389,7 +2924,7 @@
"typeVersion": 1.4,
"position": [
-944,
- 1184
+ 1264
],
"id": "f70a31a6-8f6c-402e-b3fc-9a9c4020a144",
"name": "Gmail Trigger",
@@ -2412,7 +2947,7 @@
"typeVersion": 3.1,
"position": [
-560,
- 1184
+ 1264
],
"id": "26b6c331-df9c-4db1-8934-b50d6b821300",
"name": "AI Agent1"
@@ -2426,7 +2961,7 @@
"typeVersion": 1,
"position": [
-560,
- 1392
+ 1472
],
"id": "05cd6b45-8cc4-4f5a-91bf-6d950a552b10",
"name": "Google Gemini Chat Model1",
@@ -2455,11 +2990,457 @@
"typeVersion": 3.4,
"position": [
-256,
- 1184
+ 1264
],
"id": "e8a81e0f-deed-4c24-8a33-8c20231c5ba3",
"name": "Edit Fields1"
},
+ {
+ "parameters": {
+ "sendTo": "={{ $('Paises').item.json.hhrr_email }}",
+ "subject": "Seguimiento requerido – Encuesta de Salida",
+ "message": "=\n\n\n\n\n\n \n \n \n \n \n | \n Recursos Humanos \n Seguimiento Requerido \n | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Estimado equipo de Recursos Humanos, \n El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró \"Motivos Personales\" o el motivo fue no declarado como razón de renuncia voluntaria. \n Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida. \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 👤 \n | \n \n Datos del empleado/a\n | \n \n \n | \n \n \n \n \n \n | Nombre | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n ✅ \n | \n \n Acciones requeridas\n | \n \n \n | \n \n \n \n \n \n | 1. | \n Contactar al/la empleado/a en un plazo no mayor a 3 días hábiles. | \n \n \n | 2. | \n Realizar la conversación de manera empática y confidencial. | \n \n \n | 3. | \n Registrar los hallazgos respondiendo este correo con el formato indicado. | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 📋 \n | \n \n Formato de respuesta\n | \n \n \n | \n \n \n | \n Responda con el asunto exactamente así: \n \n \n | | \n Motivo de Salida Actualizado | \n \n \n Incluya en el cuerpo: \n \n \n | | \n \n Nombre completo: [nombre del empleado] \n Motivo: [motivo real de salida]\n | \n \n \n \n \n | ⚠️ | \n Mantener el formato exacto para el correcto registro en el sistema. | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Agradecemos su gestión oportuna. \n Saludos, \n | \n
\n\n \n \n | \n Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing. \n | \n
\n\n
\n\n\n\n",
+ "options": {
+ "appendAttribution": false
+ }
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.2,
+ "position": [
+ 1504,
+ 864
+ ],
+ "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": [
+ -880,
+ 1968
+ ],
+ "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": [
+ 80,
+ 2080
+ ],
+ "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": [
+ -528,
+ 1968
+ ],
+ "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": [
+ 80,
+ 1872
+ ],
+ "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": [
+ -272,
+ 1872
+ ],
+ "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": [
+ -272,
+ 2080
+ ],
+ "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": [
+ -704,
+ 1968
+ ],
+ "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": [
+ -96,
+ 1872
+ ],
+ "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": [
+ -96,
+ 2080
+ ],
+ "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,
+ 864
+ ],
+ "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,
+ 1264
+ ],
+ "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,
+ 1136
+ ],
+ "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,
+ 1264
+ ],
+ "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,
+ 1136
+ ],
+ "typeVersion": 1,
+ "id": "37987422-8a55-472c-9ab0-13695aac0319",
+ "name": "Sticky Note4"
+ },
+ {
+ "parameters": {
+ "content": "### Elimina espacios vacios en despues del nombre",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ 112,
+ 784
+ ],
+ "typeVersion": 1,
+ "id": "5271ef80-bfb3-4097-a5c0-8a095e2e1b64",
+ "name": "Sticky Note5"
+ },
+ {
+ "parameters": {
+ "content": "### Elimina espacios vacios en despues del nombre",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -128,
+ 1184
+ ],
+ "typeVersion": 1,
+ "id": "d3ac1a35-594d-44ea-a63f-2d0d95ef6e56",
+ "name": "Sticky Note6"
+ },
+ {
+ "parameters": {
+ "content": "### Limpiar respuesta del agente",
+ "height": 192,
+ "width": 192
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -240,
+ 784
+ ],
+ "typeVersion": 1,
+ "id": "190b5477-4d2b-4def-95f6-bf4ff0dd1e7a",
+ "name": "Sticky Note7"
+ },
+ {
+ "parameters": {
+ "sendTo": "={{ $json.hhrr_email }}",
+ "subject": "Nueva Encuesta de Salida Recibida",
+ "message": "=\n\n\n\nNueva Encuesta de Salida\n\n\n \n \n \n \n \n \n \n \n \n \n \n Nueva Encuesta de Salida Recibida\n | \n \n \n | \n \n \n | \n \n\n \n \n \n Datos Personales\n \n \n | Nombre Completo | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | Número de Identidad (Cédula) | \n {{ $('Webhook1').item.json.body['Número de Identidad (Cédula)'] }} | \n \n \n | Número de Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | País | \n {{ $('Webhook1').item.json.body.Pais }} | \n \n \n | Fecha de envío | \n {{ $('Webhook1').item.json.body.timestamp }} | \n \n \n | \n \n\n \n \n \n Datos Laborales\n \n \n | Cuenta o Proyecto | \n {{ $('Webhook1').item.json.body['Cuenta o Proyecto'] }} | \n \n \n | Posición | \n {{ $('Webhook1').item.json.body['Posición'] }} | \n \n \n | \n \n\n \n \n \n Encuesta de Salida\n\n ¿Podría considerar regresar a la organización en el futuro? \n {{ $('Webhook1').item.json.body['Podría considerar regresar a la organización en el futuro.'] }} \n\n ¿Se siente cómodo/a recomendando a otra persona para trabajar en la organización? \n {{ $('Webhook1').item.json.body['Me siento cómodo recomendando a otra persona para trabajar en la organización. '] }} \n\n ¿Por qué eligió dejar la empresa? \n {{ $('Webhook1').item.json.body['¿Por qué elegiste dejar la empresa?'] }} \n\n Comentarios o sugerencias \n {{ $('Webhook1').item.json.body['¿Tienes algún otro comentario o sugerencia que nos ayude a mejorar?'] }} \n | \n \n\n \n \n | \n Este correo fue generado automáticamente. \n | \n \n\n \n | \n
\n
\n\n",
+ "options": {
+ "appendAttribution": false
+ }
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.2,
+ "position": [
+ 1072,
+ 864
+ ],
+ "id": "24c8ffa4-bfaa-47ab-9e24-635b1d4b6a35",
+ "name": "Enviar respuestas a RRHH",
+ "webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
+ "credentials": {
+ "gmailOAuth2": {
+ "id": "QWNicjw1khRm5BVI",
+ "name": "Eidan - Gmail account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "tableId": "encuesta_terminacion_glm",
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Añadir a Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.supabase",
+ "typeVersion": 1,
+ "position": [
+ 736,
+ 864
+ ],
+ "id": "0a99fbf1-b407-48ca-b994-17d17e2852f2",
+ "name": "Insertar respuesta",
+ "credentials": {
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "jsCode": "function convertirBoolean(valor) {\n const texto = String(valor ?? \"\")\n .trim()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toLowerCase();\n\n if (texto === \"si\") return true;\n if (texto === \"no\") return false;\n return null;\n}\n\nreturn $input.all().map(item => ({\n json: {\n ...item.json, // Mantiene todas las columnas originales\n considera_regresar: convertirBoolean(\n item.json['Podría considerar regresar a la organización en el futuro.']\n ),\n comodo_recomendando: convertirBoolean(\n item.json['Me siento cómodo recomendando a otra persona para trabajar en la organización. ']\n ),\n }\n}));"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 544,
+ 864
+ ],
+ "id": "82e86d61-872a-4d32-bb91-6abfbf68d549",
+ "name": "Convertir a boolean"
+ },
{
"parameters": {
"operation": "update",
@@ -2746,10 +3727,10 @@
"typeVersion": 4.7,
"position": [
112,
- 1184
+ 1264
],
"id": "6c5ac11b-3891-4331-9639-b4ede15f8ba5",
- "name": "Añadir a Responses1",
+ "name": "Actualizar a Responses",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8Pp0ek3NPsEkyXfY",
@@ -2759,340 +3740,285 @@
},
{
"parameters": {
- "sendTo": "={{ $json.hhrr_email }}",
- "subject": "Seguimiento requerido – Encuesta de Salida",
- "message": "=\n\n\n\n\n\n \n \n \n \n \n | \n Recursos Humanos \n Seguimiento Requerido \n | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Estimado equipo de Recursos Humanos, \n El sistema de encuestas de salida detectó que el/la empleado/a indicado/a a continuación declaró \"Motivos Personales\" o el motivo fue no declarado como razón de renuncia voluntaria. \n Se solicita realizar un seguimiento confidencial con esta persona para obtener mayor detalle sobre la causa real de la salida. \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 👤 \n | \n \n Datos del empleado/a\n | \n \n \n | \n \n \n \n \n \n | Nombre | \n {{ $('Webhook1').item.json.body['Nombre Completo'] }} | \n \n \n | Teléfono | \n {{ $('Webhook1').item.json.body['Número de Telefono'] }} | \n \n \n | Correo | \n {{ $('Webhook1').item.json.body.email }} | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n ✅ \n | \n \n Acciones requeridas\n | \n \n \n | \n \n \n \n \n \n | 1. | \n Contactar al/la empleado/a en un plazo no mayor a 3 días hábiles. | \n \n \n | 2. | \n Realizar la conversación de manera empática y confidencial. | \n \n \n | 3. | \n Registrar los hallazgos respondiendo este correo con el formato indicado. | \n \n \n | \n \n \n | \n
\n\n \n \n \n \n \n \n \n \n | \n 📋 \n | \n \n Formato de respuesta\n | \n \n \n | \n \n \n | \n Responda con el asunto exactamente así: \n \n \n | | \n Motivo de Salida Actualizado | \n \n \n Incluya en el cuerpo: \n \n \n | | \n \n Nombre completo: [nombre del empleado] \n Motivo: [motivo real de salida]\n | \n \n \n \n \n | ⚠️ | \n Mantener el formato exacto para el correcto registro en el sistema. | \n \n \n | \n \n \n | \n
\n\n \n \n | \n Agradecemos su gestión oportuna. \n Saludos, \n | \n
\n\n \n \n | \n Este mensaje fue generado automáticamente por el Sistema de Encuestas de Salida de GomezLee Marketing. \n | \n
\n\n
\n\n\n\n",
- "options": {
- "appendAttribution": false
+ "operation": "update",
+ "tableId": "encuesta_terminacion_glm",
+ "filters": {
+ "conditions": [
+ {
+ "keyName": "nombre",
+ "condition": "eq",
+ "keyValue": "={{ $json.name }}"
+ }
+ ]
+ },
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Añadir a Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ }
+ ]
}
},
- "type": "n8n-nodes-base.gmail",
- "typeVersion": 2.2,
+ "type": "n8n-nodes-base.supabase",
+ "typeVersion": 1,
"position": [
- 928,
- 800
+ 320,
+ 1264
],
- "id": "99ff8288-d1b6-46ac-830b-961e29372428",
- "name": "Enviar revision",
- "webhookId": "74aec894-1766-4601-9b6d-b850f96b4850",
+ "id": "c1a0d204-2430-49c4-9dda-87181797bfc1",
+ "name": "Actualizar respuesta",
"credentials": {
- "gmailOAuth2": {
- "id": "QWNicjw1khRm5BVI",
- "name": "Eidan - Gmail account"
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
}
}
},
{
- "parameters": {},
- "type": "n8n-nodes-base.manualTrigger",
+ "parameters": {
+ "jsCode": "function convertirBoolean(valor) {\n const texto = String(valor ?? \"\")\n .trim()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toLowerCase();\n\n if (texto === \"si\") return true;\n if (texto === \"no\") return false;\n return null;\n}\n\nreturn $input.all().map(item => ({\n json: {\n ...item.json, // Mantiene todas las columnas originales\n considera_regresar: convertirBoolean(\n item.json['Podría considerar regresar a la organización en el futuro.']\n ),\n comodo_recomendando: convertirBoolean(\n item.json['Me siento cómodo recomendando a otra persona para trabajar en la organización. ']\n ),\n }\n}));"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ -560,
+ 1696
+ ],
+ "id": "390737f4-cbe3-412e-bae0-14fd69bdfcbd",
+ "name": "Code in JavaScript5"
+ },
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "triggerAtHour": 8
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.3,
+ "position": [
+ -928,
+ 1696
+ ],
+ "id": "898810f2-6309-40fe-92d8-b526fe6cd638",
+ "name": "Schedule Trigger"
+ },
+ {
+ "parameters": {
+ "operation": "update",
+ "tableId": "encuesta_terminacion_glm",
+ "filters": {
+ "conditions": [
+ {
+ "keyName": "nombre",
+ "condition": "eq",
+ "keyValue": "={{ $json['Nombre Completo'] }}"
+ }
+ ]
+ },
+ "fieldsUi": {
+ "fieldValues": [
+ {
+ "fieldId": "timestamp",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Timestamp }}"
+ },
+ {
+ "fieldId": "email_address",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Email Address'] }}"
+ },
+ {
+ "fieldId": "nombre",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Nombre Completo'] }}"
+ },
+ {
+ "fieldId": "pais",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Pais }}"
+ },
+ {
+ "fieldId": "cuenta_proyecto",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Cuenta o Proyecto'] }}"
+ },
+ {
+ "fieldId": "posicion",
+ "fieldValue": "={{ $('Obtener Responses').item.json['Posición'] }}"
+ },
+ {
+ "fieldId": "considerar_regresar",
+ "fieldValue": "={{ $json.considera_regresar }}"
+ },
+ {
+ "fieldId": "siento_comodo_recomendando",
+ "fieldValue": "={{ $json.comodo_recomendando }}"
+ },
+ {
+ "fieldId": "homologacion_ia",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Homologacion_IA }}"
+ },
+ {
+ "fieldId": "subcategoria_ia",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Subcategoria_IA }}"
+ },
+ {
+ "fieldId": "insight_rrhh",
+ "fieldValue": "={{ $('Obtener Responses').item.json.Insight_RRHH }}"
+ },
+ {
+ "fieldId": "sentimiento_ia",
+ "fieldValue": "={{ $json.Sentimiento_IA }}"
+ },
+ {
+ "fieldId": "jefe_directo",
+ "fieldValue": "={{ $json['Jefe Directo'] }}"
+ },
+ {
+ "fieldId": "pdv",
+ "fieldValue": "={{ $json.PDV }}"
+ },
+ {
+ "fieldId": "trade_partner",
+ "fieldValue": "={{ $json['TRADE PARTNER'] }}"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.supabase",
"typeVersion": 1,
"position": [
- -1136,
- 1648
+ -384,
+ 1696
],
- "id": "22aa2d29-e0a3-4a88-a66b-263400b580d8",
- "name": "When clicking ‘Execute workflow’"
+ "id": "f2e728eb-9488-412c-8fbd-18489f58b96a",
+ "name": "Actualizar datos",
+ "credentials": {
+ "supabaseApi": {
+ "id": "2PlsR6rpK7rQTIEn",
+ "name": "Sofia test - Supabase account"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "content": "## Actualizar datos de los empleados (pdv, jefe directo, trade partner)",
+ "height": 192,
+ "width": 736
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "position": [
+ -992,
+ 1616
+ ],
+ "typeVersion": 1,
+ "id": "a53b54c1-eb5f-4417-a509-e260abd16e92",
+ "name": "Sticky Note8"
+ },
+ {
+ "parameters": {
+ "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"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.googleSheets",
+ "typeVersion": 4.7,
+ "position": [
+ -736,
+ 1696
+ ],
+ "id": "9fa8fa82-91d3-4391-a361-d13e0b07643e",
+ "name": "Obtener Responses",
+ "credentials": {
+ "googleSheetsOAuth2Api": {
+ "id": "8Pp0ek3NPsEkyXfY",
+ "name": "Eidan - Google Sheets account"
+ }
+ }
},
{
"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",
+ "url": "https://dbit.digitalcompass.agency/rest/v1/rpc/incrementar_encuestas_terminacion_enviadas",
"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": [
+ "parameters": [
{
- "id": "3519ad4c-6d66-4963-ab76-ee5517d88d67",
- "name": "repo_name",
- "value": "encuesta-terminacion-voluntaria",
- "type": "string"
+ "name": "apikey",
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
},
{
- "id": "0df99f1e-1354-43b9-9d20-9f994cc82cf6",
- "name": "file_name",
- "value": "encuesta",
- "type": "string"
+ "name": "Authorization",
+ "value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
}
]
},
"options": {}
},
- "type": "n8n-nodes-base.set",
- "typeVersion": 3.4,
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
"position": [
- -960,
- 1648
+ 288,
+ 496
],
- "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"
- },
- {
- "parameters": {
- "content": "### Elimina espacios vacios en despues del nombre",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- 112,
- 720
- ],
- "typeVersion": 1,
- "id": "5271ef80-bfb3-4097-a5c0-8a095e2e1b64",
- "name": "Sticky Note5"
- },
- {
- "parameters": {
- "content": "### Elimina espacios vacios en despues del nombre",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- -128,
- 1104
- ],
- "typeVersion": 1,
- "id": "d3ac1a35-594d-44ea-a63f-2d0d95ef6e56",
- "name": "Sticky Note6"
- },
- {
- "parameters": {
- "content": "### Limpiar respuesta del agente",
- "height": 192,
- "width": 192
- },
- "type": "n8n-nodes-base.stickyNote",
- "position": [
- -240,
- 720
- ],
- "typeVersion": 1,
- "id": "190b5477-4d2b-4def-95f6-bf4ff0dd1e7a",
- "name": "Sticky Note7"
+ "id": "8f061980-d232-4916-9f98-008e5c482228",
+ "name": "Incrementar encuestas enviadas"
}
],
"connections": {
@@ -3144,7 +4070,7 @@
"main": [
[
{
- "node": "Es motivo personal?",
+ "node": "Convertir a boolean",
"type": "main",
"index": 0
}
@@ -3232,7 +4158,7 @@
"main": [
[
{
- "node": "Paises",
+ "node": "Enviar revision",
"type": "main",
"index": 0
}
@@ -3244,7 +4170,7 @@
"main": [
[
{
- "node": "Enviar revision",
+ "node": "Enviar respuestas a RRHH",
"type": "main",
"index": 0
}
@@ -3394,7 +4320,7 @@
"main": [
[
{
- "node": "Añadir a Responses1",
+ "node": "Actualizar a Responses",
"type": "main",
"index": 0
}
@@ -3411,18 +4337,106 @@
}
]
]
+ },
+ "Enviar respuestas a RRHH": {
+ "main": [
+ [
+ {
+ "node": "Es motivo personal?",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Convertir a boolean": {
+ "main": [
+ [
+ {
+ "node": "Insertar respuesta",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Insertar respuesta": {
+ "main": [
+ [
+ {
+ "node": "Paises",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Actualizar a Responses": {
+ "main": [
+ [
+ {
+ "node": "Actualizar respuesta",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Code in JavaScript5": {
+ "main": [
+ [
+ {
+ "node": "Actualizar datos",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Schedule Trigger": {
+ "main": [
+ [
+ {
+ "node": "Obtener Responses",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Obtener Responses": {
+ "main": [
+ [
+ {
+ "node": "Code in JavaScript5",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Send a message": {
+ "main": [
+ [
+ {
+ "node": "Incrementar encuestas enviadas",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
}
},
"authors": "Eidan Then",
- "name": "Version be6a3b5f",
+ "name": "Version 56413603",
"description": "",
"autosaved": true,
"workflowPublishHistory": [
{
- "createdAt": "2026-06-18T19:08:41.301Z",
- "id": 1592,
+ "createdAt": "2026-07-24T15:59:45.883Z",
+ "id": 3402,
"workflowId": "5M9rWs6osbDQt4qQ",
- "versionId": "be6a3b5f-723e-42bd-a3f6-8d6f742a754c",
+ "versionId": "56413603-ac91-4051-99fe-bbee7c006b04",
"event": "activated",
"userId": "de14e7e5-491b-4983-abb2-f88af42e92fd"
}