diff --git a/glmway-workflow.json b/glmway-workflow.json index fcc6b8b..d60cb29 100644 --- a/glmway-workflow.json +++ b/glmway-workflow.json @@ -1,6 +1,6 @@ { "$json": { - "updatedAt": "2026-06-25T21:57:43.554Z", + "updatedAt": "2026-06-26T15:27:25.559Z", "createdAt": "2026-06-08T13:50:12.174Z", "id": "F1iPg8hktNAebZua", "name": "GLMWay", @@ -831,19 +831,6 @@ "id": "deb40073-dc0e-41e4-ad7c-6df18de25b4f", "name": "Empleado le falta info?" }, - { - "parameters": { - "jsCode": "const today = new Date();\n\n// Formato YYYY-MM-DD\nconst formattedDate = today.toISOString().split('T')[0];\n\nreturn [\n {\n json: {\n date: formattedDate\n }\n }\n];" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - 2240, - 1312 - ], - "id": "0db9e6a4-2e5e-4513-97fd-71d22aa90822", - "name": "Fecha hoy" - }, { "parameters": { "content": "## Formato fecha\nyyyy-mm-dd\n", @@ -2210,7 +2197,7 @@ }, { "parameters": { - "jsCode": "const hireDate = new Date(\n $('Entra hoy?').first().json.hireDate\n);\n\nconst sessions = $input.all();\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = new Date(item.json.fecha_sesion);\n return sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n new Date(a.json.fecha_sesion) - new Date(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\n\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" + "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\nconst sessions = $input.all();\n\n// Helper para parsear \"14 January\" → Date\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const currentYear = new Date().getFullYear();\n return new Date(`${month} ${day}, ${currentYear}`);\n}\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = parseSessionDate(item.json.fecha_sesion);\n return sessionDate && sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n parseSessionDate(a.json.fecha_sesion) - parseSessionDate(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -2223,7 +2210,7 @@ }, { "parameters": { - "jsCode": "const hireDate = new Date(\n $('Entra hoy?').first().json.hireDate\n);\n\nconst sessions = $input.all();\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = new Date(item.json.fecha_sesion);\n return sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n new Date(a.json.fecha_sesion) - new Date(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\n\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" + "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\nconst sessions = $input.all();\n\n// Helper para parsear \"14 January\" → Date\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const currentYear = new Date().getFullYear();\n return new Date(`${month} ${day}, ${currentYear}`);\n}\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = parseSessionDate(item.json.fecha_sesion);\n return sessionDate && sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n parseSessionDate(a.json.fecha_sesion) - parseSessionDate(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -2282,7 +2269,7 @@ }, { "parameters": { - "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\n\nconst sessions = $input.all();\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = new Date(item.json.fecha_sesion);\n return sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n new Date(a.json.fecha_sesion) - new Date(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\n\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" + "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\nconst sessions = $input.all();\n\n// Helper para parsear \"14 January\" → Date\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const currentYear = new Date().getFullYear();\n return new Date(`${month} ${day}, ${currentYear}`);\n}\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = parseSessionDate(item.json.fecha_sesion);\n return sessionDate && sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n parseSessionDate(a.json.fecha_sesion) - parseSessionDate(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -2295,7 +2282,7 @@ }, { "parameters": { - "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\n\nconst sessions = $input.all();\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = new Date(item.json.fecha_sesion);\n return sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n new Date(a.json.fecha_sesion) - new Date(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\n\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" + "jsCode": "const hireDate = new Date(\n $('Entra hoy?1').first().json.hireDate\n);\nconst sessions = $input.all();\n\n// Helper para parsear \"14 January\" → Date\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const currentYear = new Date().getFullYear();\n return new Date(`${month} ${day}, ${currentYear}`);\n}\n\nconst validSessions = sessions.filter(item => {\n const sessionDate = parseSessionDate(item.json.fecha_sesion);\n return sessionDate && sessionDate >= hireDate;\n});\n\nvalidSessions.sort((a, b) =>\n parseSessionDate(a.json.fecha_sesion) - parseSessionDate(b.json.fecha_sesion)\n);\n\nconst nearestSession = validSessions[0];\nreturn [\n {\n json: {\n hireDate: hireDate.toISOString().split('T')[0],\n foundSession: !!nearestSession,\n session: nearestSession?.json ?? null\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -2721,7 +2708,7 @@ "type": "n8n-nodes-base.gmail", "typeVersion": 2.2, "position": [ - 816, + 1088, 1488 ], "id": "39331d88-6f2b-4df1-ac76-dda9ff47dfec", @@ -2748,7 +2735,7 @@ "type": "n8n-nodes-base.gmail", "typeVersion": 2.2, "position": [ - 816, + 1088, 1312 ], "id": "9d4f57a4-ac2f-49bd-b5fa-50658a8d928e", @@ -2788,7 +2775,7 @@ "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ - 0, + 272, 1488 ], "id": "7545364a-df0a-4420-a1af-5bcd4f8c9602", @@ -2801,7 +2788,7 @@ "type": "n8n-nodes-base.wait", "typeVersion": 1.1, "position": [ - 1200, + 1472, 1616 ], "id": "617ab85d-23a6-4546-9331-eff343d9b1c5", @@ -2898,7 +2885,7 @@ "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ - 624, + 896, 1392 ], "id": "13ee807a-f1cd-48ef-921b-7b5c260ba116", @@ -2920,8 +2907,8 @@ "type": "n8n-nodes-base.supabase", "typeVersion": 1, "position": [ - -176, - 1488 + 144, + 1296 ], "id": "0457dbf8-9c04-4f2d-9928-4f770eb51cc0", "name": "Obtener notificados1", @@ -2957,7 +2944,7 @@ "type": "n8n-nodes-base.supabase", "typeVersion": 1, "position": [ - 1024, + 1296, 1408 ], "id": "0881ba84-bd04-4e91-9c09-0ba18e28ed28", @@ -2997,7 +2984,7 @@ "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ - 432, + 704, 1488 ], "id": "0fea4950-f873-4375-8964-45cfc3fead02", @@ -3005,7 +2992,7 @@ }, { "parameters": { - "jsCode": "const fecha_sesion = $input.first().json.fecha_sesion_inscrito;\n\n// Fecha de hoy\nconst fecha_hoy = new Date().toISOString().split('T')[0];\n\nconst hoy = new Date(fecha_hoy);\nconst sesion = new Date(fecha_sesion);\n\n// Diferencia en días\nconst diferenciaDias = Math.floor(\n (sesion - hoy) / (1000 * 60 * 60 * 24)\n);\n\n// True si es hoy (0 días) o mañana (1 día)\nconst isValid = diferenciaDias >= 0 && diferenciaDias <= 1;\n\nreturn [\n {\n json: {\n fecha_sesion,\n fecha_hoy,\n diferenciaDias,\n isValid\n }\n }\n];" + "jsCode": "// Helper para parsear \"14 December\" → Date (año actual)\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const year = new Date().getFullYear();\n return new Date(`${month} ${day}, ${year}`);\n}\n\n// Formatear fecha como \"26 June\"\nfunction formatDate(date) {\n const day = date.getDate();\n const month = date.toLocaleString('en-US', { month: 'long' });\n return `${day} ${month}`;\n}\n\nconst fecha_sesion = $input.first().json.fecha_sesion_inscrito;\n\n// Fecha de hoy normalizada a medianoche\nconst hoy = new Date();\nhoy.setHours(0, 0, 0, 0);\n\nconst sesion = parseSessionDate(fecha_sesion);\nsesion.setHours(0, 0, 0, 0);\n\n// Diferencia en días\nconst diferenciaDias = Math.floor(\n (sesion - hoy) / (1000 * 60 * 60 * 24)\n);\n\n// True si es hoy (0 días) o mañana (1 día)\nconst isValid = diferenciaDias >= 0 && diferenciaDias <= 1;\n\nreturn [\n {\n json: {\n fecha_sesion,\n fecha_hoy: formatDate(hoy),\n diferenciaDias,\n isValid\n }\n }\n];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -3649,7 +3636,7 @@ "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ - 208, + 480, 1488 ], "id": "3e2b4cde-d7aa-4879-aa55-f1a169c16bd3", @@ -4020,12 +4007,17 @@ }, { "parameters": { - "operation": "getAll" + "operation": "getAll", + "tableId": "sesiones_glmway", + "returnAll": true, + "filters": { + "conditions": [] + } }, "type": "n8n-nodes-base.supabase", "typeVersion": 1, "position": [ - 1632, + 1600, 928 ], "id": "d34e225b-25bb-4a0a-845c-b9e274529000", @@ -4075,6 +4067,205 @@ ], "id": "cded5025-8e1b-4609-b7c6-5acb81244bdf", "name": "Formatear fecha y detectar idioma1" + }, + { + "parameters": { + "jsCode": "const today = new Date();\ntoday.setHours(0, 0, 0, 0);\n\nconst sessions = $input.all();\n\n// Helper para parsear \"14 January\" → Date (año actual)\nfunction parseSessionDate(dateStr) {\n if (!dateStr) return null;\n const [day, month] = dateStr.split(' ');\n const year = new Date().getFullYear();\n return new Date(`${month} ${day}, ${year}`);\n}\n\n// Formatear fecha como \"26 June\"\nfunction formatDate(date) {\n const day = date.getDate();\n const month = date.toLocaleString('en-US', { month: 'long' });\n return `${day} ${month}`;\n}\n\n// Iterar hasta encontrar la sesión que hace match con hoy\nlet matchedSession = null;\n\nfor (const item of sessions) {\n const sessionDate = parseSessionDate(item.json.fecha_sesion);\n if (!sessionDate) continue;\n\n sessionDate.setHours(0, 0, 0, 0);\n\n if (sessionDate.getTime() === today.getTime()) {\n matchedSession = item;\n break;\n }\n}\n\nreturn [\n {\n json: {\n today: formatDate(today),\n foundSession: !!matchedSession,\n session: matchedSession?.json ?? null\n }\n }\n];" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 1776, + 928 + ], + "id": "0db9e6a4-2e5e-4513-97fd-71d22aa90822", + "name": "Calcular sesion mas cercana4" + }, + { + "parameters": { + "sendTo": "eidan.then14@gmail.com", + "subject": "Entrenamiento #TheGLMWay", + "emailType": "text", + "message": "=¡Hola, GLMer!\n\nEste es un recordatorio de tu entrenamiento, donde te transmitiremos nuestra cultura, nuestro ADN y por qué somos diferentes al resto.\n\n¡Te esperamos puntual y con toda la energía para aprender!\n\nÚnete aquí:\n{{ $json.conferenceData.entryPoints[0].uri }}", + "options": { + "appendAttribution": false + } + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 2368, + 1008 + ], + "id": "0cf2219c-db12-4231-bac6-8e5f2816530f", + "name": "Send a message espanol5", + "webhookId": "a6043707-89d1-4c99-8de2-e60d9aaf7ed2", + "credentials": { + "gmailOAuth2": { + "id": "QWNicjw1khRm5BVI", + "name": "Eidan - Gmail account" + } + }, + "disabled": true + }, + { + "parameters": { + "sendTo": "eidan.then14@gmail.com", + "subject": "#TheGLMWay Training", + "emailType": "text", + "message": "=Hello, GLMer!\n\nThis is a reminder about your training session, where we'll share our culture, our DNA, and what makes us different from the rest.\n\nWe're looking forward to seeing you on time and ready to learn!\n\nJoin here:\n{{ $json.conferenceData.entryPoints[0].uri }}", + "options": { + "appendAttribution": false + } + }, + "type": "n8n-nodes-base.gmail", + "typeVersion": 2.2, + "position": [ + 2368, + 832 + ], + "id": "96bac1b9-d921-418d-947d-f07980bb76aa", + "name": "Send a message ingles5", + "webhookId": "a6043707-89d1-4c99-8de2-e60d9aaf7ed2", + "credentials": { + "gmailOAuth2": { + "id": "QWNicjw1khRm5BVI", + "name": "Eidan - Gmail account" + } + }, + "disabled": true + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "strict", + "version": 3 + }, + "conditions": [ + { + "id": "df25aa3e-d48f-4e52-ae1f-47678e954d52", + "leftValue": "={{ $json.session.idioma }}", + "rightValue": "EN", + "operator": { + "type": "string", + "operation": "equals", + "name": "filter.operator.equals" + } + } + ], + "combinator": "and" + }, + "options": {} + }, + "type": "n8n-nodes-base.if", + "typeVersion": 2.3, + "position": [ + 2144, + 928 + ], + "id": "748f3ae7-7e6d-41f5-be1d-861a9566ec00", + "name": "Es espanol o ingles" + }, + { + "parameters": { + "content": "## Falta añadir mensaje de aviso" + }, + "type": "n8n-nodes-base.stickyNote", + "position": [ + 2528, + 896 + ], + "typeVersion": 1, + "id": "2d9a27b5-9ca6-4518-bd06-3a91389c4736", + "name": "Sticky Note9" + }, + { + "parameters": { + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "strict", + "version": 3 + }, + "conditions": [ + { + "id": "df25aa3e-d48f-4e52-ae1f-47678e954d52", + "leftValue": "={{ $json.foundSession }}", + "rightValue": "EN", + "operator": { + "type": "boolean", + "operation": "true", + "singleValue": true + } + } + ], + "combinator": "and" + }, + "options": {} + }, + "type": "n8n-nodes-base.if", + "typeVersion": 2.3, + "position": [ + 1936, + 928 + ], + "id": "03832c44-864b-4277-a9fb-f94d56dc0f1c", + "name": "Hay sesion?" + }, + { + "parameters": { + "content": "## Al final añadir flujo para resetear los estados de los coordinadores e instructores", + "height": 272 + }, + "type": "n8n-nodes-base.stickyNote", + "position": [ + 992, + 2656 + ], + "typeVersion": 1, + "id": "a9266141-49ab-41f7-b8ab-dc45e746ed1c", + "name": "Sticky Note14" + }, + { + "parameters": { + "operation": "getAll", + "tableId": "sesiones_glmway", + "returnAll": true, + "filters": { + "conditions": [] + } + }, + "type": "n8n-nodes-base.supabase", + "typeVersion": 1, + "position": [ + -192, + 1488 + ], + "id": "a4fc1575-5326-467f-8b05-f8c9569cdca1", + "name": "Obtener sesiones", + "credentials": { + "supabaseApi": { + "id": "2PlsR6rpK7rQTIEn", + "name": "Sofia test - Supabase account" + } + } + }, + { + "parameters": { + "jsCode": "const fecha_sesion = $input.first().json.fecha_sesion_inscrito;\n\n// Fecha de hoy\nconst fecha_hoy = new Date().toISOString().split('T')[0];\nconst hoy = new Date(fecha_hoy);\nconst sesion = new Date(fecha_sesion);\n\n// Diferencia en días\nconst diferenciaDias = Math.floor(\n (sesion - hoy) / (1000 * 60 * 60 * 24)\n);\n\n// True si es hoy (0 días), mañana (1 día) o pasado mañana (2 días)\nconst isValid = diferenciaDias >= 0 && diferenciaDias <= 2;\n\nreturn [\n {\n json: {\n fecha_sesion,\n fecha_hoy,\n diferenciaDias,\n isValid\n }\n }\n];" + }, + "type": "n8n-nodes-base.code", + "typeVersion": 2, + "position": [ + 0, + 1488 + ], + "id": "e8d383b8-9081-4829-8516-a03f6f5a1b63", + "name": "Calcular falta 48h o 24h1" } ], "connections": { @@ -4211,11 +4402,6 @@ ] ] }, - "Fecha hoy": { - "main": [ - [] - ] - }, "Entra hoy?": { "main": [ [ @@ -4832,7 +5018,7 @@ "main": [ [ { - "node": "Obtener notificados1", + "node": "Obtener sesiones", "type": "main", "index": 0 } @@ -4882,13 +5068,7 @@ }, "Obtener notificados1": { "main": [ - [ - { - "node": "Loop Over Items2", - "type": "main", - "index": 0 - } - ] + [] ] }, "Actualizar estado a recordado1": { @@ -5194,6 +5374,79 @@ "main": [ [] ] + }, + "Schedule Trigger": { + "main": [ + [ + { + "node": "Get many rows", + "type": "main", + "index": 0 + } + ] + ] + }, + "Calcular sesion mas cercana4": { + "main": [ + [ + { + "node": "Hay sesion?", + "type": "main", + "index": 0 + } + ] + ] + }, + "Get many rows": { + "main": [ + [ + { + "node": "Calcular sesion mas cercana4", + "type": "main", + "index": 0 + } + ] + ] + }, + "Es espanol o ingles": { + "main": [ + [ + { + "node": "Send a message ingles5", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Send a message espanol5", + "type": "main", + "index": 0 + } + ] + ] + }, + "Hay sesion?": { + "main": [ + [ + { + "node": "Es espanol o ingles", + "type": "main", + "index": 0 + } + ] + ] + }, + "Obtener sesiones": { + "main": [ + [ + { + "node": "Calcular falta 48h o 24h1", + "type": "main", + "index": 0 + } + ] + ] } }, "settings": { @@ -5217,19 +5470,19 @@ "recurrenceRules": [] }, "node:Comenzo evento ingles": { - "lastTimeChecked": "2026-06-26T13:00:02Z" + "lastTimeChecked": "2026-06-26T15:00:02Z" }, "node:Comenzo evento español": { - "lastTimeChecked": "2026-06-26T13:00:04Z" + "lastTimeChecked": "2026-06-26T15:00:04Z" }, "node:Termino evento español": { - "lastTimeChecked": "2026-06-26T13:00:40Z" + "lastTimeChecked": "2026-06-26T15:00:40Z" }, "node:Termino evento ingles": { - "lastTimeChecked": "2026-06-26T13:00:50Z" + "lastTimeChecked": "2026-06-26T15:00:50Z" }, "node:Prueba": { - "lastTimeChecked": "2026-06-26T13:00:21Z" + "lastTimeChecked": "2026-06-26T15:00:21Z" }, "node:Schedule Trigger2": { "recurrenceRules": [] @@ -5264,16 +5517,6 @@ } } ], - "Fecha hoy": [ - { - "json": { - "date": "2026-06-16" - }, - "pairedItem": { - "item": 0 - } - } - ], "Termino evento español": [ { "json": { @@ -5518,9 +5761,9 @@ } ] }, - "versionId": "ee6ea14b-3e4e-4e19-90d4-c1b6a96c4dc7", + "versionId": "3ec500c0-d2a7-47a2-a3b8-e2b6ead3acf4", "activeVersionId": "ee6ea14b-3e4e-4e19-90d4-c1b6a96c4dc7", - "versionCounter": 2853, + "versionCounter": 2950, "triggerCount": 13, "shared": [ {