285 lines
17 KiB
JSON
285 lines
17 KiB
JSON
{
|
|
"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 .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, \"<br>\");\nconst safeName = escapeHtml(userName);\nconst safeEmail = escapeHtml(userEmail);\nconst safeDate = escapeHtml(dateLabel);\n\nconst html = `<!doctype html>\n<html lang=\"es\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n</head>\n<body style=\"margin:0;padding:0;background:#F5F5F5;font-family:Arial,Helvetica,sans-serif;color:#4A4A4A;\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"background:#F5F5F5;padding:28px 12px;\">\n <tr>\n <td align=\"center\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"max-width:660px;background:#FFFFFF;border:1px solid #D0D0D0;\">\n <tr>\n <td style=\"height:4px;background:#6CC24A;font-size:0;line-height:0;\"> </td>\n </tr>\n <tr>\n <td style=\"padding:30px 34px 10px 34px;\">\n <img src=\"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png\" alt=\"GomezLee Marketing\" width=\"190\" style=\"display:block;width:190px;max-width:100%;height:auto;border:0;\">\n </td>\n </tr>\n <tr>\n <td style=\"padding:18px 34px 0 34px;\">\n <div style=\"font-size:11px;line-height:16px;font-weight:700;letter-spacing:1.5px;color:#6CC24A;text-transform:uppercase;\">CRUCES GLM · REPORTE DE USUARIO</div>\n <h1 style=\"margin:8px 0 0 0;font-size:24px;line-height:30px;color:#4F758B;font-weight:700;\">Nuevo reporte recibido</h1>\n <p style=\"margin:10px 0 0 0;font-size:14px;line-height:22px;color:#4A4A4A;\">Un usuario envió un reporte desde la aplicación Cruces GLM.</p>\n </td>\n </tr>\n <tr>\n <td style=\"padding:24px 34px 0 34px;\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"border-collapse:collapse;font-size:13px;line-height:20px;\">\n <tr>\n <td style=\"width:125px;padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Usuario</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeName}</td>\n </tr>\n <tr>\n <td style=\"padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Correo</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeEmail}</td>\n </tr>\n <tr>\n <td style=\"padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Fecha</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeDate}</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:24px 34px 0 34px;\">\n <div style=\"font-size:11px;line-height:16px;font-weight:700;letter-spacing:1px;color:#4F758B;text-transform:uppercase;border-bottom:2px solid #6CC24A;padding-bottom:7px;\">MENSAJE DEL USUARIO</div>\n <div style=\"margin-top:14px;padding:16px 18px;background:#F5F5F5;border:1px solid #D0D0D0;font-size:14px;line-height:22px;color:#4A4A4A;\">${htmlMessage}</div>\n </td>\n </tr>\n <tr>\n <td style=\"padding:28px 34px 30px 34px;\">\n <div style=\"border-top:1px solid #D0D0D0;padding-top:12px;font-size:11px;line-height:17px;font-style:italic;color:#6B8FA3;\">CONFIDENCIAL — Uso interno GomezLee Marketing · Mensaje generado automáticamente desde Cruces GLM.</div>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n</body>\n</html>`;\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 <iaracena@gomezleemarketing.com>",
|
|
"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 .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, \"<br>\");\nconst safeName = escapeHtml(userName);\nconst safeEmail = escapeHtml(userEmail);\nconst safeDate = escapeHtml(dateLabel);\n\nconst html = `<!doctype html>\n<html lang=\"es\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n</head>\n<body style=\"margin:0;padding:0;background:#F5F5F5;font-family:Arial,Helvetica,sans-serif;color:#4A4A4A;\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"background:#F5F5F5;padding:28px 12px;\">\n <tr>\n <td align=\"center\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"max-width:660px;background:#FFFFFF;border:1px solid #D0D0D0;\">\n <tr>\n <td style=\"height:4px;background:#6CC24A;font-size:0;line-height:0;\"> </td>\n </tr>\n <tr>\n <td style=\"padding:30px 34px 10px 34px;\">\n <img src=\"https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM_completo.png\" alt=\"GomezLee Marketing\" width=\"190\" style=\"display:block;width:190px;max-width:100%;height:auto;border:0;\">\n </td>\n </tr>\n <tr>\n <td style=\"padding:18px 34px 0 34px;\">\n <div style=\"font-size:11px;line-height:16px;font-weight:700;letter-spacing:1.5px;color:#6CC24A;text-transform:uppercase;\">CRUCES GLM · REPORTE DE USUARIO</div>\n <h1 style=\"margin:8px 0 0 0;font-size:24px;line-height:30px;color:#4F758B;font-weight:700;\">Nuevo reporte recibido</h1>\n <p style=\"margin:10px 0 0 0;font-size:14px;line-height:22px;color:#4A4A4A;\">Un usuario envió un reporte desde la aplicación Cruces GLM.</p>\n </td>\n </tr>\n <tr>\n <td style=\"padding:24px 34px 0 34px;\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"border-collapse:collapse;font-size:13px;line-height:20px;\">\n <tr>\n <td style=\"width:125px;padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Usuario</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeName}</td>\n </tr>\n <tr>\n <td style=\"padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Correo</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeEmail}</td>\n </tr>\n <tr>\n <td style=\"padding:9px 12px;background:#EEF6E8;border:1px solid #D0D0D0;font-weight:700;color:#4F758B;\">Fecha</td>\n <td style=\"padding:9px 12px;border:1px solid #D0D0D0;color:#4A4A4A;\">${safeDate}</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:24px 34px 0 34px;\">\n <div style=\"font-size:11px;line-height:16px;font-weight:700;letter-spacing:1px;color:#4F758B;text-transform:uppercase;border-bottom:2px solid #6CC24A;padding-bottom:7px;\">MENSAJE DEL USUARIO</div>\n <div style=\"margin-top:14px;padding:16px 18px;background:#F5F5F5;border:1px solid #D0D0D0;font-size:14px;line-height:22px;color:#4A4A4A;\">${htmlMessage}</div>\n </td>\n </tr>\n <tr>\n <td style=\"padding:28px 34px 30px 34px;\">\n <div style=\"border-top:1px solid #D0D0D0;padding-top:12px;font-size:11px;line-height:17px;font-style:italic;color:#6B8FA3;\">CONFIDENCIAL — Uso interno GomezLee Marketing · Mensaje generado automáticamente desde Cruces GLM.</div>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n</body>\n</html>`;\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"
|
|
}
|
|
]
|
|
}
|
|
} |