603 lines
23 KiB
JSON
603 lines
23 KiB
JSON
{
|
|
"name": "Seguimiento de Impuestos GLM - Recordatorios Gmail y Google Chat",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "cronExpression",
|
|
"expression": "0 8 * * *"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.2,
|
|
"position": [
|
|
-32,
|
|
1456
|
|
],
|
|
"id": "d9890ecf-a9ba-4604-9a68-03568e80bbe5",
|
|
"name": "Diario 8:00 AM"
|
|
},
|
|
{
|
|
"parameters": {},
|
|
"type": "n8n-nodes-base.manualTrigger",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-32,
|
|
1616
|
|
],
|
|
"id": "58d5e31d-10bb-4dec-af43-d3ea3225a4ad",
|
|
"name": "Ejecutar manualmente"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "seguimiento-impuestos",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
-32,
|
|
1808
|
|
],
|
|
"id": "b1a94a40-005a-419c-9d3d-697b95d16749",
|
|
"name": "Webhook seguimiento-impuestos",
|
|
"webhookId": "seguimiento-impuestos-glm"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "function dateInTimeZone(timeZone) {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).formatToParts(new Date());\n const values = Object.fromEntries(parts.map((part) => [part.type, part.value]));\n return `${values.year}-${values.month}-${values.day}`;\n}\n\nconst input = $json ?? {};\nconst runDate = input.run_date || dateInTimeZone('America/Santo_Domingo');\n\nreturn [{\n json: {\n run_date: runDate,\n source: input.source || 'schedule',\n },\n}];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
224,
|
|
1536
|
|
],
|
|
"id": "da51143c-6cbd-4ea1-a49e-d0c4b097b952",
|
|
"name": "Preparar ejecución"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const body = $json.body ?? $json;\nconst action = String(body.action ?? '').trim().toLowerCase();\n\nif (!['run_now', 'run_reminders', 'ejecutar_recordatorios'].includes(action)) {\n return [];\n}\n\nreturn [{\n json: {\n run_date: body.run_date || body.date || '',\n source: 'webhook',\n },\n}];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
224,
|
|
1808
|
|
],
|
|
"id": "0863e7a7-bc95-42f6-982f-f09f859ec6d6",
|
|
"name": "Validar ejecución por Webhook"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://dbit.digitalcompass.agency/rest/v1/rpc/tax_due_reminders",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "apikey",
|
|
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Authorization",
|
|
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { p_run_date: $json.run_date } }}",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.4,
|
|
"position": [
|
|
480,
|
|
1616
|
|
],
|
|
"id": "00dfa1be-5e07-4860-8322-d9f490ac4e4a",
|
|
"name": "Supabase - Recordatorios pendientes"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const htmlEscape = (value) => String(value ?? '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n\nconst rows = [];\nfor (const item of $input.all()) {\n const value = item.json;\n if (Array.isArray(value)) rows.push(...value);\n else if (Array.isArray(value?.data)) rows.push(...value.data);\n else if (Array.isArray(value?.body)) rows.push(...value.body);\n else if (value?.obligation_id) rows.push(value);\n}\n\nconst logoUrl = 'https://home.digitalcompass.agency/glm-logo-completo.png';\nconst appUrl = 'https://digitalcompass.agency/calendario-impuestos/';\n\nconst formatDate = (iso) => {\n const [year, month, day] = String(iso).split('-').map(Number);\n return new Intl.DateTimeFormat('es-DO', {\n timeZone: 'UTC',\n day: '2-digit',\n month: 'long',\n year: 'numeric',\n }).format(new Date(Date.UTC(year, month - 1, day)));\n};\n\nreturn rows.map((row) => {\n const dueDate = formatDate(row.due_date);\n const isSameDay = row.alert_type === 'same_day';\n const reminderLabel = isSameDay ? 'Vence hoy' : 'Recordatorio previo';\n const categoryLabel = row.category === 'nomina' ? 'Nómina' : 'Administración';\n const firstName = String(row.contact_name ?? '').trim().split(/\\s+/)[0] || 'equipo';\n const subject = `${isSameDay ? 'Vence hoy' : 'Recordatorio'} · ${row.country_name} · ${row.description}`;\n\n const emailHtml = `\n<!doctype html>\n<html lang=\"es\">\n <body style=\"margin:0;padding:0;background:#F5F5F5;font-family:Arial,sans-serif;color:#4A4A4A;\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"background:#F5F5F5;padding:28px 12px;\">\n <tr><td align=\"center\">\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"max-width:640px;background:#FFFFFF;border:1px solid #D0D0D0;border-radius:14px;overflow:hidden;\">\n <tr><td style=\"padding:26px 30px 18px;\"><img src=\"${htmlEscape(logoUrl)}\" alt=\"GomezLee Marketing\" width=\"190\" style=\"display:block;width:190px;max-width:100%;height:auto;border:0;\"></td></tr>\n <tr><td style=\"height:5px;background:#6CC24A;font-size:0;line-height:0;\"> </td></tr>\n <tr><td style=\"padding:30px;\">\n <div style=\"font-size:12px;font-weight:700;letter-spacing:1.4px;text-transform:uppercase;color:#6CC24A;\">${htmlEscape(reminderLabel)}</div>\n <h1 style=\"margin:8px 0 10px;font-size:27px;line-height:1.18;color:#4F758B;\">Seguimiento de Impuestos GLM</h1>\n <p style=\"margin:0 0 24px;font-size:15px;line-height:1.6;\">Hola ${htmlEscape(firstName)}, este es el recordatorio correspondiente a la siguiente obligación tributaria:</p>\n <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-collapse:collapse;border:1px solid #D0D0D0;\">\n <tr><td style=\"width:34%;padding:12px 14px;background:#EEF6E8;border-bottom:1px solid #D0D0D0;font-size:13px;font-weight:700;color:#4F758B;\">País</td><td style=\"padding:12px 14px;border-bottom:1px solid #D0D0D0;font-size:13px;\">${htmlEscape(row.country_name)}</td></tr>\n <tr><td style=\"padding:12px 14px;background:#EEF6E8;border-bottom:1px solid #D0D0D0;font-size:13px;font-weight:700;color:#4F758B;\">Categoría</td><td style=\"padding:12px 14px;border-bottom:1px solid #D0D0D0;font-size:13px;\">${htmlEscape(categoryLabel)}</td></tr>\n <tr><td style=\"padding:12px 14px;background:#EEF6E8;border-bottom:1px solid #D0D0D0;font-size:13px;font-weight:700;color:#4F758B;\">Fecha límite</td><td style=\"padding:12px 14px;border-bottom:1px solid #D0D0D0;font-size:13px;font-weight:700;color:#FF6A13;\">${htmlEscape(dueDate)}</td></tr>\n <tr><td style=\"padding:12px 14px;background:#EEF6E8;font-size:13px;font-weight:700;color:#4F758B;\">Obligación</td><td style=\"padding:12px 14px;font-size:13px;line-height:1.5;\">${htmlEscape(row.description)}</td></tr>\n </table>\n <p style=\"margin:22px 0 0;font-size:12px;line-height:1.55;color:#6B8FA3;\">Este aviso forma parte del seguimiento automático: miércoles anterior y fecha límite, incluidos sábados y domingos.</p>\n <div style=\"margin-top:24px;\"><a href=\"${htmlEscape(appUrl)}\" style=\"display:inline-block;background:#6CC24A;color:#FFFFFF;text-decoration:none;font-size:13px;font-weight:700;padding:11px 17px;border-radius:8px;\">Abrir calendario</a></div>\n </td></tr>\n <tr><td style=\"padding:16px 30px;border-top:1px solid #D0D0D0;font-size:11px;color:#6B8FA3;\">GOMEZLEE MARKETING | Seguimiento de Impuestos GLM | Uso interno</td></tr>\n </table>\n </td></tr>\n </table>\n </body>\n</html>`.trim();\n\n const googleChatText = [\n `*${reminderLabel.toUpperCase()} · SEGUIMIENTO DE IMPUESTOS GLM*`,\n '',\n `Hola ${firstName},`,\n '',\n `*País:* ${row.country_name}`,\n `*Categoría:* ${categoryLabel}`,\n `*Fecha límite:* ${dueDate}`,\n `*Obligación:* ${row.description}`,\n '',\n 'Seguimiento automático: miércoles anterior y fecha límite, incluidos sábados y domingos.',\n '',\n `Abrir calendario: ${appUrl}`,\n ].join('\\n');\n\n return {\n json: {\n ...row,\n email_subject: subject,\n email_html: emailHtml,\n google_chat_text: googleChatText,\n },\n };\n});"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
736,
|
|
1616
|
|
],
|
|
"id": "780bc937-c373-43cc-9343-e3c73d076934",
|
|
"name": "Construir mensajes GLM"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "return $input.all().filter((item) => item.json.email_enabled === true && String(item.json.contact_email ?? '').trim());"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1008,
|
|
1472
|
|
],
|
|
"id": "343dc1d3-cb5b-452c-b5d4-f69583b15280",
|
|
"name": "Preparar correos"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"sendTo": "={{ $json.contact_email }}",
|
|
"subject": "={{ $json.email_subject }}",
|
|
"message": "={{ $json.email_html }}",
|
|
"options": {
|
|
"appendAttribution": false
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.gmail",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
1264,
|
|
1472
|
|
],
|
|
"id": "7f16857a-3674-4255-9674-cc040682f518",
|
|
"name": "Gmail - Enviar recordatorio",
|
|
"webhookId": "16bfebbd-f4e3-4b1e-aba2-028fecf98da1",
|
|
"credentials": {
|
|
"gmailOAuth2": {
|
|
"id": "UDcO1FLJqA453V2D",
|
|
"name": "Gmail account 3"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://dbit.digitalcompass.agency/rest/v1/rpc/tax_record_notification",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "apikey",
|
|
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Authorization",
|
|
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { p_obligation_id: $('Preparar correos').item.json.obligation_id, p_contact_id: $('Preparar correos').item.json.contact_id, p_alert_date: $('Preparar correos').item.json.alert_date, p_channel: 'email', p_status: 'sent', p_provider_response: $json } }}",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.4,
|
|
"position": [
|
|
1520,
|
|
1472
|
|
],
|
|
"id": "bea9fc06-b8de-4091-bde0-d7be8c18e4cd",
|
|
"name": "Supabase - Registrar correo"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "return $input.all().filter((item) => item.json.google_chat_enabled === true && String(item.json.contact_email ?? '').trim());"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1008,
|
|
1744
|
|
],
|
|
"id": "3addf2bd-60c2-493c-8919-56b603aad7e8",
|
|
"name": "Preparar Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://chat.googleapis.com/v1/spaces:setup",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "googleChatOAuth2Api",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { space: { spaceType: 'DIRECT_MESSAGE', singleUserBotDm: false }, memberships: [ { member: { name: 'users/' + $json.contact_email, type: 'HUMAN' } } ] } }}",
|
|
"options": {
|
|
"timeout": 30000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.4,
|
|
"position": [
|
|
1264,
|
|
1744
|
|
],
|
|
"id": "630cdc84-f7aa-4db8-8356-942056f3ac22",
|
|
"name": "Google Chat - Abrir DM",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 1500,
|
|
"credentials": {
|
|
"googleChatOAuth2Api": {
|
|
"id": "V4eVQvEoy5QcBvUu",
|
|
"name": "Chat account"
|
|
}
|
|
},
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const source = $('Preparar Google Chat').item.json;\nconst spaceName = String($json.name ?? '').trim();\nreturn [{ json: { ...source, chat_space_name: spaceName, chat_setup_ok: Boolean(spaceName), google_chat_status: spaceName ? 'pending' : 'failed', google_chat_provider_response: $json } }];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1520,
|
|
1744
|
|
],
|
|
"id": "1002151d-cb96-46c1-9868-3e9aca7846c0",
|
|
"name": "Evaluar DM Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "return $input.all().filter((item) => item.json.chat_setup_ok === true);"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1776,
|
|
1632
|
|
],
|
|
"id": "5978dd34-7cb2-46be-9536-65c22b7f06a4",
|
|
"name": "Preparar envío Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "return $input.all().filter((item) => item.json.chat_setup_ok !== true);"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1776,
|
|
1888
|
|
],
|
|
"id": "cbc9f8d3-35f8-48a2-9251-c85c96d15be0",
|
|
"name": "Preparar fallo DM Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "={{ 'https://chat.googleapis.com/v1/' + $json.chat_space_name + '/messages' }}",
|
|
"authentication": "predefinedCredentialType",
|
|
"nodeCredentialType": "googleChatOAuth2Api",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { text: $json.google_chat_text, createMessageNotificationOptions: { notificationType: 'NOTIFICATION_TYPE_FORCE_NOTIFY' } } }}",
|
|
"options": {
|
|
"timeout": 30000
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.4,
|
|
"position": [
|
|
2032,
|
|
1632
|
|
],
|
|
"id": "d4d67181-4079-4a46-9fd7-a10afe57db71",
|
|
"name": "Google Chat - Enviar recordatorio",
|
|
"retryOnFail": true,
|
|
"maxTries": 3,
|
|
"waitBetweenTries": 1500,
|
|
"credentials": {
|
|
"googleChatOAuth2Api": {
|
|
"id": "V4eVQvEoy5QcBvUu",
|
|
"name": "Chat account"
|
|
}
|
|
},
|
|
"onError": "continueRegularOutput"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const source = $('Preparar envío Google Chat').item.json;\nconst sent = Boolean($json.name) && !$json.error;\nreturn [{ json: { ...source, google_chat_status: sent ? 'sent' : 'failed', google_chat_provider_response: $json } }];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2288,
|
|
1632
|
|
],
|
|
"id": "6398165b-9e0a-483f-9db6-71f0d85a69d0",
|
|
"name": "Evaluar envío Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "https://dbit.digitalcompass.agency/rest/v1/rpc/tax_record_notification",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "apikey",
|
|
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Authorization",
|
|
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
|
},
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ { p_obligation_id: $json.obligation_id, p_contact_id: $json.contact_id, p_alert_date: $json.alert_date, p_channel: 'google_chat', p_status: $json.google_chat_status, p_provider_response: $json.google_chat_provider_response } }}",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.4,
|
|
"position": [
|
|
2544,
|
|
1744
|
|
],
|
|
"id": "29a93cc5-c157-4199-81c1-1fed7664edc6",
|
|
"name": "Supabase - Registrar Google Chat"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"content": "## RECORDATORIOS DE IMPUESTOS POR GMAIL Y GOOGLE CHAT\n\nEjecuta diariamente el proceso de recordatorios fiscales y notifica a los contactos correspondientes por correo electrónico y mensaje directo de Google Chat.\n\n- Puede iniciarse automáticamente a las 8:00 a. m., manualmente o desde el webhook de la aplicación.\n- Valida y normaliza el origen de la ejecución antes de continuar.\n- Consulta en Supabase las obligaciones que requieren recordatorio y sus destinatarios.\n- Construye mensajes personalizados con el formato corporativo de GLM.\n- Envía los recordatorios por Gmail y registra en Supabase el resultado de cada correo.\n- Abre o identifica la conversación directa del destinatario en Google Chat.\n- Envía el recordatorio por Google Chat cuando el DM está disponible.\n- Evalúa cada intento y registra tanto los envíos exitosos como los errores para mantener trazabilidad.",
|
|
"height": 1184,
|
|
"width": 2880,
|
|
"color": "#204750"
|
|
},
|
|
"type": "n8n-nodes-base.stickyNote",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
-144,
|
|
896
|
|
],
|
|
"id": "8c9fe360-936b-4e86-bd17-5a396dd09419",
|
|
"name": "Sticky Note"
|
|
}
|
|
],
|
|
"pinData": {},
|
|
"connections": {
|
|
"Diario 8:00 AM": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Preparar ejecución",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Ejecutar manualmente": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Preparar ejecución",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Webhook seguimiento-impuestos": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Validar ejecución por Webhook",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Preparar ejecución": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Supabase - Recordatorios pendientes",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Validar ejecución por Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Preparar ejecución",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Supabase - Recordatorios pendientes": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Construir mensajes GLM",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Construir mensajes GLM": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Preparar correos",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "Preparar Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Preparar correos": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Gmail - Enviar recordatorio",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Gmail - Enviar recordatorio": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Supabase - Registrar correo",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Preparar Google Chat": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Google Chat - Abrir DM",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Google Chat - Abrir DM": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Evaluar DM Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Evaluar DM Google Chat": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Preparar envío Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "Preparar fallo DM Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Preparar envío Google Chat": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Google Chat - Enviar recordatorio",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Google Chat - Enviar recordatorio": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Evaluar envío Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Evaluar envío Google Chat": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Supabase - Registrar Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Preparar fallo DM Google Chat": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Supabase - Registrar Google Chat",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"binaryMode": "separate",
|
|
"availableInMCP": true,
|
|
"timeSavedMode": "fixed",
|
|
"errorWorkflow": "puF4LUczoSz3hcek",
|
|
"timezone": "America/Santo_Domingo",
|
|
"callerPolicy": "workflowsFromSameOwner"
|
|
},
|
|
"versionId": "ab159702-cf57-4e47-8de5-95da61a56b9b",
|
|
"meta": {
|
|
"templateCredsSetupCompleted": true,
|
|
"instanceId": "b4b77b17af092830e794eef639ce2f6d7daccf7eddc075060b03b3b6545aac70"
|
|
},
|
|
"id": "cFu3Xx23KQBKfr0M",
|
|
"tags": []
|
|
} |