diff --git a/seguimiento-de-impuestos-glm-recordatorios.json b/seguimiento-de-impuestos-glm-recordatorios.json
new file mode 100644
index 0000000..ca1c430
--- /dev/null
+++ b/seguimiento-de-impuestos-glm-recordatorios.json
@@ -0,0 +1,912 @@
+{
+ "updatedAt": "2026-07-25T17:31:07.011Z",
+ "createdAt": "2026-07-24T19:13:05.914Z",
+ "id": "cFu3Xx23KQBKfr0M",
+ "name": "Seguimiento de Impuestos GLM - Recordatorios",
+ "description": null,
+ "active": true,
+ "isArchived": false,
+ "nodes": [
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "field": "cronExpression",
+ "expression": "0 8 * * *"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.2,
+ "position": [
+ 1008,
+ 1472
+ ],
+ "id": "28b8d854-b043-4a35-b047-4db8f919fb6f",
+ "name": "Diario 8:00 AM"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.manualTrigger",
+ "typeVersion": 1,
+ "position": [
+ 1008,
+ 1632
+ ],
+ "id": "be168026-4130-4486-8e9a-1766b3e219d4",
+ "name": "Ejecutar manualmente"
+ },
+ {
+ "parameters": {
+ "httpMethod": "POST",
+ "path": "seguimiento-impuestos",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.webhook",
+ "typeVersion": 2.1,
+ "position": [
+ 1008,
+ 1824
+ ],
+ "id": "07d8b63b-e322-492a-8241-ef9ccb273a31",
+ "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": [
+ 1248,
+ 1552
+ ],
+ "id": "43f9136f-ecb0-4145-978a-a212a532f271",
+ "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": [
+ 1248,
+ 1824
+ ],
+ "id": "c640bba7-a14c-4d8f-a204-d73dbb43f77e",
+ "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": [
+ 1504,
+ 1632
+ ],
+ "id": "ff4bb447-340e-405a-8db7-a6ef0e7f8fe3",
+ "name": "Supabase - Recordatorios pendientes"
+ },
+ {
+ "parameters": {
+ "jsCode": "const htmlEscape = (value) => String(value ?? '')\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 = $env.GLM_LOGO_URL || 'https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM.png';\nconst appUrl = $env.GLM_TAX_APP_URL || '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\nconst normalizeWhatsApp = (value) => {\n let raw = String(value ?? '').trim();\n if (!raw) return '';\n raw = raw.replace('@c.us', '@s.whatsapp.net');\n if (raw.includes('@g.us')) return raw;\n if (raw.includes('@s.whatsapp.net')) {\n const number = raw.replace('@s.whatsapp.net', '').replace(/\\D/g, '');\n return number.startsWith('120363') ? `${number}@g.us` : `${number}@s.whatsapp.net`;\n }\n const number = raw.replace(/\\D/g, '');\n return number.startsWith('120363') ? `${number}@g.us` : `${number}@s.whatsapp.net`;\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\n\n
\n \n \n \n \n \n \n \n | \n \n | | \n \n | \n ${htmlEscape(reminderLabel)} \n Seguimiento de Impuestos\n Hola ${htmlEscape(firstName)}, este es el recordatorio correspondiente a la siguiente obligación tributaria: \n\n \n \n | País | \n ${htmlEscape(row.country_name)} | \n \n \n | Categoría | \n ${htmlEscape(categoryLabel)} | \n \n \n | Fecha límite | \n ${htmlEscape(dueDate)} | \n \n \n | Obligación | \n ${htmlEscape(row.description)} | \n \n \n\n Regla de seguimiento: miércoles anterior y fecha límite, incluidos sábados y domingos. \n \n | \n \n \n | \n GOMEZLEE MARKETING | Seguimiento de Impuestos\n | \n \n \n | \n
\n
\n \n`.trim();\n\n const whatsappText = [\n `*${reminderLabel.toUpperCase()} · SEGUIMIENTO DE IMPUESTOS*`,\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 'Regla: miércoles anterior y fecha límite, incluidos sábados y domingos.',\n '',\n `Calendario: ${appUrl}`,\n ].join('\\n');\n\n return {\n json: {\n ...row,\n email_subject: subject,\n email_html: emailHtml,\n whatsapp_to: normalizeWhatsApp(row.contact_whatsapp),\n whatsapp_text: whatsappText,\n },\n };\n});"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 1760,
+ 1632
+ ],
+ "id": "22e34460-2700-4d7d-ba0a-c4d735120f19",
+ "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": [
+ 2032,
+ 1488
+ ],
+ "id": "3841ce9e-3957-43e9-b280-34414e0b9bd9",
+ "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": [
+ 2288,
+ 1488
+ ],
+ "id": "a4e97d3e-7181-48b6-815a-8c2e97bdff85",
+ "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": [
+ 2544,
+ 1488
+ ],
+ "id": "5059ca4d-7766-415f-8f38-ed217ed382e8",
+ "name": "Supabase - Registrar correo"
+ },
+ {
+ "parameters": {
+ "jsCode": "return $input.all().filter((item) => item.json.whatsapp_enabled === true && String(item.json.whatsapp_to ?? '').trim());"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 2032,
+ 1760
+ ],
+ "id": "b08df3fa-812e-4780-a770-ba3d5d0c51f8",
+ "name": "Preparar WhatsApp"
+ },
+ {
+ "parameters": {
+ "method": "POST",
+ "url": "={{'https://wsp.gomezleemarketing.com'}}/message/sendText/{{'botsoporte'}}",
+ "sendHeaders": true,
+ "headerParameters": {
+ "parameters": [
+ {
+ "name": "apikey",
+ "value": "={{'C267126ABB45-4C12-B626-6BAB1833F5D7'}}"
+ }
+ ]
+ },
+ "sendBody": true,
+ "bodyParameters": {
+ "parameters": [
+ {
+ "name": "number",
+ "value": "={{ $json.whatsapp_to }}"
+ },
+ {
+ "name": "delay",
+ "value": "={{ 1000 }}"
+ },
+ {
+ "name": "text",
+ "value": "={{ $json.whatsapp_text }}"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
+ "position": [
+ 2288,
+ 1760
+ ],
+ "id": "303519ed-a2a3-4ec8-9ff4-cc32632ffae0",
+ "name": "WhatsApp - Enviar recordatorio"
+ },
+ {
+ "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 WhatsApp').item.json.obligation_id, p_contact_id: $('Preparar WhatsApp').item.json.contact_id, p_alert_date: $('Preparar WhatsApp').item.json.alert_date, p_channel: 'whatsapp', p_status: 'sent', p_provider_response: $json } }}",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
+ "position": [
+ 2544,
+ 1760
+ ],
+ "id": "c0ef85d5-1dfd-426f-bab5-cf956e22a8d8",
+ "name": "Supabase - Registrar WhatsApp"
+ }
+ ],
+ "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 WhatsApp",
+ "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 WhatsApp": {
+ "main": [
+ [
+ {
+ "node": "WhatsApp - Enviar recordatorio",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "WhatsApp - Enviar recordatorio": {
+ "main": [
+ [
+ {
+ "node": "Supabase - Registrar WhatsApp",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "settings": {
+ "executionOrder": "v1",
+ "binaryMode": "separate",
+ "availableInMCP": true,
+ "timeSavedMode": "fixed",
+ "errorWorkflow": "puF4LUczoSz3hcek",
+ "timezone": "America/Santo_Domingo",
+ "callerPolicy": "workflowsFromSameOwner"
+ },
+ "staticData": {
+ "node:Diario 8:00 AM": {
+ "recurrenceRules": []
+ }
+ },
+ "meta": {
+ "templateCredsSetupCompleted": true
+ },
+ "versionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "activeVersionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "versionCounter": 41,
+ "triggerCount": 2,
+ "shared": [
+ {
+ "updatedAt": "2026-07-24T19:13:05.942Z",
+ "createdAt": "2026-07-24T19:13:05.942Z",
+ "role": "workflow:owner",
+ "workflowId": "cFu3Xx23KQBKfr0M",
+ "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-07-24T20:47:12.000Z",
+ "createdAt": "2026-07-24T20:47:11.297Z",
+ "versionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "workflowId": "cFu3Xx23KQBKfr0M",
+ "nodes": [
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "field": "cronExpression",
+ "expression": "0 8 * * *"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.2,
+ "position": [
+ 1008,
+ 1472
+ ],
+ "id": "28b8d854-b043-4a35-b047-4db8f919fb6f",
+ "name": "Diario 8:00 AM"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.manualTrigger",
+ "typeVersion": 1,
+ "position": [
+ 1008,
+ 1632
+ ],
+ "id": "be168026-4130-4486-8e9a-1766b3e219d4",
+ "name": "Ejecutar manualmente"
+ },
+ {
+ "parameters": {
+ "httpMethod": "POST",
+ "path": "seguimiento-impuestos",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.webhook",
+ "typeVersion": 2.1,
+ "position": [
+ 1008,
+ 1824
+ ],
+ "id": "07d8b63b-e322-492a-8241-ef9ccb273a31",
+ "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": [
+ 1248,
+ 1552
+ ],
+ "id": "43f9136f-ecb0-4145-978a-a212a532f271",
+ "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": [
+ 1248,
+ 1824
+ ],
+ "id": "c640bba7-a14c-4d8f-a204-d73dbb43f77e",
+ "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": [
+ 1504,
+ 1632
+ ],
+ "id": "ff4bb447-340e-405a-8db7-a6ef0e7f8fe3",
+ "name": "Supabase - Recordatorios pendientes"
+ },
+ {
+ "parameters": {
+ "jsCode": "const htmlEscape = (value) => String(value ?? '')\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 = $env.GLM_LOGO_URL || 'https://dbit.digitalcompass.agency/storage/v1/object/public/public-assets/GLM.png';\nconst appUrl = $env.GLM_TAX_APP_URL || '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\nconst normalizeWhatsApp = (value) => {\n let raw = String(value ?? '').trim();\n if (!raw) return '';\n raw = raw.replace('@c.us', '@s.whatsapp.net');\n if (raw.includes('@g.us')) return raw;\n if (raw.includes('@s.whatsapp.net')) {\n const number = raw.replace('@s.whatsapp.net', '').replace(/\\D/g, '');\n return number.startsWith('120363') ? `${number}@g.us` : `${number}@s.whatsapp.net`;\n }\n const number = raw.replace(/\\D/g, '');\n return number.startsWith('120363') ? `${number}@g.us` : `${number}@s.whatsapp.net`;\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\n\n \n \n \n \n \n \n \n \n | \n \n | | \n \n | \n ${htmlEscape(reminderLabel)} \n Seguimiento de Impuestos\n Hola ${htmlEscape(firstName)}, este es el recordatorio correspondiente a la siguiente obligación tributaria: \n\n \n \n | País | \n ${htmlEscape(row.country_name)} | \n \n \n | Categoría | \n ${htmlEscape(categoryLabel)} | \n \n \n | Fecha límite | \n ${htmlEscape(dueDate)} | \n \n \n | Obligación | \n ${htmlEscape(row.description)} | \n \n \n\n Regla de seguimiento: miércoles anterior y fecha límite, incluidos sábados y domingos. \n \n | \n \n \n | \n GOMEZLEE MARKETING | Seguimiento de Impuestos\n | \n \n \n | \n
\n
\n \n`.trim();\n\n const whatsappText = [\n `*${reminderLabel.toUpperCase()} · SEGUIMIENTO DE IMPUESTOS*`,\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 'Regla: miércoles anterior y fecha límite, incluidos sábados y domingos.',\n '',\n `Calendario: ${appUrl}`,\n ].join('\\n');\n\n return {\n json: {\n ...row,\n email_subject: subject,\n email_html: emailHtml,\n whatsapp_to: normalizeWhatsApp(row.contact_whatsapp),\n whatsapp_text: whatsappText,\n },\n };\n});"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 1760,
+ 1632
+ ],
+ "id": "22e34460-2700-4d7d-ba0a-c4d735120f19",
+ "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": [
+ 2032,
+ 1488
+ ],
+ "id": "3841ce9e-3957-43e9-b280-34414e0b9bd9",
+ "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": [
+ 2288,
+ 1488
+ ],
+ "id": "a4e97d3e-7181-48b6-815a-8c2e97bdff85",
+ "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": [
+ 2544,
+ 1488
+ ],
+ "id": "5059ca4d-7766-415f-8f38-ed217ed382e8",
+ "name": "Supabase - Registrar correo"
+ },
+ {
+ "parameters": {
+ "jsCode": "return $input.all().filter((item) => item.json.whatsapp_enabled === true && String(item.json.whatsapp_to ?? '').trim());"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 2032,
+ 1760
+ ],
+ "id": "b08df3fa-812e-4780-a770-ba3d5d0c51f8",
+ "name": "Preparar WhatsApp"
+ },
+ {
+ "parameters": {
+ "method": "POST",
+ "url": "={{'https://wsp.gomezleemarketing.com'}}/message/sendText/{{'botsoporte'}}",
+ "sendHeaders": true,
+ "headerParameters": {
+ "parameters": [
+ {
+ "name": "apikey",
+ "value": "={{'C267126ABB45-4C12-B626-6BAB1833F5D7'}}"
+ }
+ ]
+ },
+ "sendBody": true,
+ "bodyParameters": {
+ "parameters": [
+ {
+ "name": "number",
+ "value": "={{ $json.whatsapp_to }}"
+ },
+ {
+ "name": "delay",
+ "value": "={{ 1000 }}"
+ },
+ {
+ "name": "text",
+ "value": "={{ $json.whatsapp_text }}"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
+ "position": [
+ 2288,
+ 1760
+ ],
+ "id": "303519ed-a2a3-4ec8-9ff4-cc32632ffae0",
+ "name": "WhatsApp - Enviar recordatorio"
+ },
+ {
+ "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 WhatsApp').item.json.obligation_id, p_contact_id: $('Preparar WhatsApp').item.json.contact_id, p_alert_date: $('Preparar WhatsApp').item.json.alert_date, p_channel: 'whatsapp', p_status: 'sent', p_provider_response: $json } }}",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.4,
+ "position": [
+ 2544,
+ 1760
+ ],
+ "id": "c0ef85d5-1dfd-426f-bab5-cf956e22a8d8",
+ "name": "Supabase - Registrar WhatsApp"
+ }
+ ],
+ "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 WhatsApp",
+ "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 WhatsApp": {
+ "main": [
+ [
+ {
+ "node": "WhatsApp - Enviar recordatorio",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "WhatsApp - Enviar recordatorio": {
+ "main": [
+ [
+ {
+ "node": "Supabase - Registrar WhatsApp",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "authors": "Isaac Aracena",
+ "name": "Version b32dcc5a",
+ "description": "",
+ "autosaved": false,
+ "workflowPublishHistory": [
+ {
+ "createdAt": "2026-07-24T20:47:12.297Z",
+ "id": 3413,
+ "workflowId": "cFu3Xx23KQBKfr0M",
+ "versionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "event": "activated",
+ "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
+ },
+ {
+ "createdAt": "2026-07-25T17:31:07.246Z",
+ "id": 3470,
+ "workflowId": "cFu3Xx23KQBKfr0M",
+ "versionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "event": "activated",
+ "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
+ },
+ {
+ "createdAt": "2026-07-25T17:31:07.141Z",
+ "id": 3469,
+ "workflowId": "cFu3Xx23KQBKfr0M",
+ "versionId": "b32dcc5a-4e89-4050-a128-04ead3f4eaff",
+ "event": "deactivated",
+ "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
+ }
+ ]
+ }
+}
\ No newline at end of file