{
"updatedAt": "2026-08-20T11:59:57.945Z",
"createdAt": "2026-08-20T02:02:12.197Z",
"id": "SpYWL8T5KPiL3yvb",
"name": "Cruces GLM - Reporte de Usuario",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "cruces-glm-reportar",
"responseMode": "responseNode",
"options": {
"allowedOrigins": "*"
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-144,
-64
],
"id": "2761e921-ab46-4d9f-a8f1-4a85952fe216",
"name": "Webhook - Reportar",
"webhookId": "0baf1e89-c6ee-4c05-805f-0a42c5cd6045"
},
{
"parameters": {
"jsCode": "const body = $json.body ?? {};\n\nconst clean = (value, fallback = \"\") => {\n const text = typeof value === \"string\" ? value.trim() : \"\";\n return text || fallback;\n};\n\nconst escapeHtml = (value) =>\n String(value)\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n\nconst userEmail = clean(body.userEmail, \"Usuario no identificado\");\nconst userName = clean(body.userName, userEmail);\nconst rawMessage = clean(body.message);\n\nif (!rawMessage) {\n throw new Error(\"El reporte llegó sin mensaje. No se enviará el correo.\");\n}\n\nconst message = rawMessage.slice(0, 5000);\nconst submittedAt = clean(body.submittedAt, new Date().toISOString());\n\nlet dateLabel = submittedAt;\ntry {\n dateLabel = new Intl.DateTimeFormat(\"es-DO\", {\n dateStyle: \"long\",\n timeStyle: \"short\",\n timeZone: \"America/Santo_Domingo\",\n }).format(new Date(submittedAt));\n} catch {}\n\nconst htmlMessage = escapeHtml(message).replace(/\\n/g, \"
\");\nconst safeName = escapeHtml(userName);\nconst safeEmail = escapeHtml(userEmail);\nconst safeDate = escapeHtml(dateLabel);\n\nconst html = `\n\n
\n \n \n\n\n \n \n \n \n \n | | \n \n \n \n \n | \n \n \n | \n CRUCES GLM · REPORTE DE USUARIO \n Nuevo reporte recibido\n Un usuario envió un reporte desde la aplicación Cruces GLM. \n | \n \n \n \n \n \n | Usuario | \n ${safeName} | \n \n \n | Correo | \n ${safeEmail} | \n \n \n | Fecha | \n ${safeDate} | \n \n \n | \n \n \n | \n MENSAJE DEL USUARIO \n ${htmlMessage} \n | \n \n \n | \n CONFIDENCIAL — Uso interno GomezLee Marketing · Mensaje generado automáticamente desde Cruces GLM. \n | \n \n \n | \n
\n
\n\n`;\n\nreturn [{\n json: {\n to: \"iaracena@gomezleemarketing.com\",\n subject: `[Cruces GLM] Reporte de usuario - ${userName}`,\n html,\n userEmail,\n userName,\n message,\n submittedAt,\n },\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
112,
-64
],
"id": "8e21116c-30ab-44cd-9465-7c1b524d30e3",
"name": "Preparar correo GLM"
},
{
"parameters": {
"sendTo": "={{ $json.to }}",
"subject": "={{ $json.subject }}",
"message": "={{ $json.html }}",
"options": {
"appendAttribution": false,
"senderName": "Cruces GLM"
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
368,
-64
],
"id": "cfb2f106-79c8-4c08-8d63-644c40fee8ea",
"name": "Enviar a Isaac - Seleccionar credencial Gmail",
"webhookId": "faa6af23-dca1-4bac-af3f-d955a5c6bf08",
"credentials": {
"gmailOAuth2": {
"id": "UDcO1FLJqA453V2D",
"name": "Gmail account 3"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { ok: true, message: 'Reporte enviado correctamente.' } }}",
"options": {
"responseCode": 200
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
656,
-64
],
"id": "821e390e-ea6c-4cf7-bb22-b3f7a7f6ba8d",
"name": "Responder OK"
}
],
"connections": {
"Preparar correo GLM": {
"main": [
[
{
"node": "Enviar a Isaac - Seleccionar credencial Gmail",
"type": "main",
"index": 0
}
]
]
},
"Enviar a Isaac - Seleccionar credencial Gmail": {
"main": [
[
{
"node": "Responder OK",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Reportar": {
"main": [
[
{
"node": "Preparar correo GLM",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"binaryMode": "separate"
},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"versionId": "07d10357-550f-42de-a354-6b592fd38563",
"activeVersionId": "07d10357-550f-42de-a354-6b592fd38563",
"versionCounter": 12,
"triggerCount": 1,
"shared": [
{
"updatedAt": "2026-08-20T02:02:12.203Z",
"createdAt": "2026-08-20T02:02:12.203Z",
"role": "workflow:owner",
"workflowId": "SpYWL8T5KPiL3yvb",
"projectId": "PJpTANzTXIFibWsW",
"project": {
"updatedAt": "2026-04-22T14:25:09.686Z",
"createdAt": "2026-04-22T14:22:54.790Z",
"id": "PJpTANzTXIFibWsW",
"name": "Isaac Aracena ",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-08-20T02:40:43.000Z",
"createdAt": "2026-08-20T02:40:34.437Z",
"versionId": "07d10357-550f-42de-a354-6b592fd38563",
"workflowId": "SpYWL8T5KPiL3yvb",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "cruces-glm-reportar",
"responseMode": "responseNode",
"options": {
"allowedOrigins": "*"
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-144,
-64
],
"id": "2761e921-ab46-4d9f-a8f1-4a85952fe216",
"name": "Webhook - Reportar",
"webhookId": "0baf1e89-c6ee-4c05-805f-0a42c5cd6045"
},
{
"parameters": {
"jsCode": "const body = $json.body ?? {};\n\nconst clean = (value, fallback = \"\") => {\n const text = typeof value === \"string\" ? value.trim() : \"\";\n return text || fallback;\n};\n\nconst escapeHtml = (value) =>\n String(value)\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n\nconst userEmail = clean(body.userEmail, \"Usuario no identificado\");\nconst userName = clean(body.userName, userEmail);\nconst rawMessage = clean(body.message);\n\nif (!rawMessage) {\n throw new Error(\"El reporte llegó sin mensaje. No se enviará el correo.\");\n}\n\nconst message = rawMessage.slice(0, 5000);\nconst submittedAt = clean(body.submittedAt, new Date().toISOString());\n\nlet dateLabel = submittedAt;\ntry {\n dateLabel = new Intl.DateTimeFormat(\"es-DO\", {\n dateStyle: \"long\",\n timeStyle: \"short\",\n timeZone: \"America/Santo_Domingo\",\n }).format(new Date(submittedAt));\n} catch {}\n\nconst htmlMessage = escapeHtml(message).replace(/\\n/g, \"
\");\nconst safeName = escapeHtml(userName);\nconst safeEmail = escapeHtml(userEmail);\nconst safeDate = escapeHtml(dateLabel);\n\nconst html = `\n\n\n \n \n\n\n \n \n \n \n \n | | \n \n \n \n \n | \n \n \n | \n CRUCES GLM · REPORTE DE USUARIO \n Nuevo reporte recibido\n Un usuario envió un reporte desde la aplicación Cruces GLM. \n | \n \n \n \n \n \n | Usuario | \n ${safeName} | \n \n \n | Correo | \n ${safeEmail} | \n \n \n | Fecha | \n ${safeDate} | \n \n \n | \n \n \n | \n MENSAJE DEL USUARIO \n ${htmlMessage} \n | \n \n \n | \n CONFIDENCIAL — Uso interno GomezLee Marketing · Mensaje generado automáticamente desde Cruces GLM. \n | \n \n \n | \n
\n
\n\n`;\n\nreturn [{\n json: {\n to: \"iaracena@gomezleemarketing.com\",\n subject: `[Cruces GLM] Reporte de usuario - ${userName}`,\n html,\n userEmail,\n userName,\n message,\n submittedAt,\n },\n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
112,
-64
],
"id": "8e21116c-30ab-44cd-9465-7c1b524d30e3",
"name": "Preparar correo GLM"
},
{
"parameters": {
"sendTo": "={{ $json.to }}",
"subject": "={{ $json.subject }}",
"message": "={{ $json.html }}",
"options": {
"appendAttribution": false,
"senderName": "Cruces GLM"
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
368,
-64
],
"id": "cfb2f106-79c8-4c08-8d63-644c40fee8ea",
"name": "Enviar a Isaac - Seleccionar credencial Gmail",
"webhookId": "faa6af23-dca1-4bac-af3f-d955a5c6bf08",
"credentials": {
"gmailOAuth2": {
"id": "UDcO1FLJqA453V2D",
"name": "Gmail account 3"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { ok: true, message: 'Reporte enviado correctamente.' } }}",
"options": {
"responseCode": 200
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
656,
-64
],
"id": "821e390e-ea6c-4cf7-bb22-b3f7a7f6ba8d",
"name": "Responder OK"
}
],
"connections": {
"Preparar correo GLM": {
"main": [
[
{
"node": "Enviar a Isaac - Seleccionar credencial Gmail",
"type": "main",
"index": 0
}
]
]
},
"Enviar a Isaac - Seleccionar credencial Gmail": {
"main": [
[
{
"node": "Responder OK",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Reportar": {
"main": [
[
{
"node": "Preparar correo GLM",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Isaac Aracena",
"name": "Version 07d10357",
"description": "",
"autosaved": true,
"workflowPublishHistory": [
{
"createdAt": "2026-08-20T02:40:43.318Z",
"id": 5012,
"workflowId": "SpYWL8T5KPiL3yvb",
"versionId": "07d10357-550f-42de-a354-6b592fd38563",
"event": "activated",
"userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
]
}
}