diff --git a/test-telegram-propuestas-ejecutadas.json b/test-telegram-propuestas-ejecutadas.json index 39b3c92..7d9c05f 100644 --- a/test-telegram-propuestas-ejecutadas.json +++ b/test-telegram-propuestas-ejecutadas.json @@ -1,5 +1,5 @@ { - "updatedAt": "2026-06-06T16:00:46.077Z", + "updatedAt": "2026-06-09T03:06:01.252Z", "createdAt": "2026-06-02T14:16:46.194Z", "id": "4eCPQcE3FDIll8bW", "name": "TEST - Telegram - Propuestas Ejecutadas", @@ -7,24 +7,6 @@ "active": true, "isArchived": false, "nodes": [ - { - "parameters": { - "httpMethod": "POST", - "path": "4798df84-d324-4d15-9655-653896c710fc", - "responseMode": "responseNode", - "options": {} - }, - "type": "n8n-nodes-base.webhook", - "typeVersion": 2.1, - "position": [ - -12272, - 6752 - ], - "id": "5191681d-e92c-4cd9-9682-59fb26a9086f", - "name": "Webhook", - "webhookId": "4798df84-d324-4d15-9655-653896c710fc", - "disabled": true - }, { "parameters": { "mode": "runOnceForEachItem", @@ -39,22 +21,6 @@ "id": "f2eb6fde-d967-407b-8eb2-b77390e098b9", "name": "Code - Normalizar evento WhatsApp" }, - { - "parameters": { - "respondWith": "json", - "responseBody": "={{\n {\n ok: true,\n received: true,\n event_id: $json.event_id\n }\n}}", - "options": {} - }, - "type": "n8n-nodes-base.respondToWebhook", - "typeVersion": 1.5, - "position": [ - -11840, - 6752 - ], - "id": "1b6ca190-22ef-45dd-b704-873eab5f196c", - "name": "Respond - OK Evolution", - "disabled": true - }, { "parameters": { "conditions": { @@ -99,1148 +65,6 @@ "id": "66ec0b50-31fa-4da6-aeeb-5757d2863428", "name": "IF - Mensaje entrante válido" }, - { - "parameters": { - "mode": "runOnceForEachItem", - "jsCode": "const managerTelefono = String($json.manager_telefono || '').replace(/\\D/g, '');\n\nconst textoFormato = `Para reportar una propuesta ejecutada, envía la información así:\n\nEJECUTADA\nPropuesta: nombre o enlace de la propuesta\nMarca/Cliente:\nPaís:\nUbicación:\nFecha de ejecución:\nComentario:\n\nLuego envía las fotos de la ejecución.\n\nCuando termines, escribe: LISTO\n\nImportante: envía una propuesta ejecutada a la vez. Cuando termines, escribe LISTO antes de iniciar otro reporte.`;" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2640, - 8240 - ], - "id": "473f688d-d4e3-4a76-bd20-d7c220ae74df", - "name": "Code - Preparar formato WhatsApp" - }, - { - "parameters": { - "operation": "append", - "documentId": { - "__rl": true, - "value": "1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw", - "mode": "list", - "cachedResultName": "Fulgencio - Propuestas Ejecutadas", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit?usp=drivesdk" - }, - "sheetName": { - "__rl": true, - "value": "gid=0", - "mode": "list", - "cachedResultName": "wa_ejecuciones_eventos", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit#gid=0" - }, - "columns": { - "mappingMode": "defineBelow", - "value": { - "event_id": "={{ $json.event_id }}", - "fecha_recepcion": "={{ $json.fecha_recepcion }}", - "manager_telefono": "={{ $json.manager_telefono }}", - "manager_nombre": "={{ $json.manager_nombre }}", - "message_type": "={{ $json.message_type }}", - "texto": "={{ $json.texto }}", - "comando": "={{ $json.comando }}", - "tiene_media": "={{ $json.tiene_media }}", - "media_count": "={{ $json.media_count }}", - "raw_preview": "={{ $json.raw_preview }}", - "estado": "=PENDIENTE" - }, - "matchingColumns": [], - "schema": [ - { - "id": "event_id", - "displayName": "event_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fecha_recepcion", - "displayName": "fecha_recepcion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_telefono", - "displayName": "manager_telefono", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_nombre", - "displayName": "manager_nombre", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "message_type", - "displayName": "message_type", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "texto", - "displayName": "texto", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "comando", - "displayName": "comando", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "tiene_media", - "displayName": "tiene_media", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "media_count", - "displayName": "media_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "raw_preview", - "displayName": "raw_preview", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "estado", - "displayName": "estado", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - } - ], - "attemptToConvertTypes": false, - "convertFieldsToString": false - }, - "options": {} - }, - "type": "n8n-nodes-base.googleSheets", - "typeVersion": 4.7, - "position": [ - -2992, - 10576 - ], - "id": "0ce71ac2-210c-4f00-b04f-ad3ae880b233", - "name": "Sheets - Guardar evento WhatsApp", - "credentials": { - "googleSheetsOAuth2Api": { - "id": "K0hDZh3a85MpOHCs", - "name": "Google Sheets account 2" - } - } - }, - { - "parameters": { - "jsCode": "const managerTelefono = String($json.manager_telefono || '').replace(/\\D/g, '');\n\nconst texto = `Recibido. Puedes enviar más fotos o información de la propuesta ejecutada.\n\nCuando termines, escribe: LISTO`;\n\nreturn {\n json: {\n ...$json,\n whatsapp_to: managerTelefono,\n whatsapp_text: texto,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2784, - 10576 - ], - "id": "65224c67-d6e9-4052-ac3e-82c047f76b91", - "name": "Code - Preparar confirmación recibido" - }, - { - "parameters": { - "jsCode": "const managerTelefono = String($json.manager_telefono || '').replace(/\\D/g, '');\n\nlet texto;\n\nif ($json.estado_revision === 'REQUIERE_REVISION') {\n texto = `Recibí tu solicitud para procesar la propuesta ejecutada, pero hay información que debemos revisar:\n\n${$json.motivo_revision}\n\nPuedes enviar la información faltante y luego escribir LISTO nuevamente.`;\n} else {\n texto = `Perfecto. Recibí la información de la propuesta ejecutada.\n\nEventos recibidos: ${$json.eventos_pendientes_count}\nFotos: ${$json.fotos_count}\nVideos: ${$json.videos_count}\nAudios: ${$json.audios_count}\n\nEn la próxima fase el sistema analizará la información, guardará los archivos y generará el registro correspondiente.`;\n}\n\nreturn {\n json: {\n ...$json,\n whatsapp_to: managerTelefono,\n whatsapp_text: texto,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2544, - 9376 - ], - "id": "fd81ad2c-0d3c-4aeb-bacb-e22f7820e64d", - "name": "Code - Preparar respuesta LISTO" - }, - { - "parameters": { - "documentId": { - "__rl": true, - "value": "1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw", - "mode": "list", - "cachedResultName": "Fulgencio - Propuestas Ejecutadas", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit?usp=drivesdk" - }, - "sheetName": { - "__rl": true, - "value": "gid=0", - "mode": "list", - "cachedResultName": "wa_ejecuciones_eventos", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit#gid=0" - }, - "options": {} - }, - "type": "n8n-nodes-base.googleSheets", - "typeVersion": 4.7, - "position": [ - -4960, - 8944 - ], - "id": "226b4cc3-fe5a-44b6-9af5-d68ecdad3e07", - "name": "Sheets - Leer eventos pendientes", - "credentials": { - "googleSheetsOAuth2Api": { - "id": "K0hDZh3a85MpOHCs", - "name": "Google Sheets account 2" - } - } - }, - { - "parameters": { - "jsCode": "const rows = $input.all();\n\nconst telefonoActual = String(\n $('Code - Normalizar evento WhatsApp').first().json.manager_telefono || ''\n).replace(/\\D/g, '');\n\nconst managerNombreActual =\n $('Code - Normalizar evento WhatsApp').first().json.manager_nombre || '';\n\nfunction clean(value) {\n return String(value ?? '').trim();\n}\n\nfunction norm(value) {\n return clean(value)\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toUpperCase();\n}\n\nfunction extractField(text, label) {\n const regex = new RegExp(`${label}\\\\s*:\\\\s*(.+)`, 'i');\n const match = clean(text).match(regex);\n return match ? clean(match[1]) : '';\n}\n\nconst eventos = rows\n .map(item => item.json || {})\n .filter(row => {\n const tel = String(row.manager_telefono || '').replace(/\\D/g, '');\n const estado = norm(row.estado || 'PENDIENTE');\n return tel === telefonoActual && estado === 'PENDIENTE';\n });\n\nconst textos = eventos\n .map(e => clean(e.texto))\n .filter(Boolean);\n\nconst textoCompleto = textos.join('\\n\\n');\n\nconst fotosCount = eventos.filter(e => norm(e.message_type) === 'IMAGE').length;\nconst videosCount = eventos.filter(e => norm(e.message_type) === 'VIDEO').length;\nconst audiosCount = eventos.filter(e => norm(e.message_type) === 'AUDIO').length;\n\nconst propuestaReferencia =\n extractField(textoCompleto, 'Propuesta') ||\n extractField(textoCompleto, 'Propuesta ejecutada');\n\nconst marcaCliente =\n extractField(textoCompleto, 'Marca/Cliente') ||\n extractField(textoCompleto, 'Marca') ||\n extractField(textoCompleto, 'Cliente');\n\nconst pais = extractField(textoCompleto, 'País') || extractField(textoCompleto, 'Pais');\nconst ubicacion = extractField(textoCompleto, 'Ubicación') || extractField(textoCompleto, 'Ubicacion');\nconst fechaEjecucion =\n extractField(textoCompleto, 'Fecha de ejecución') ||\n extractField(textoCompleto, 'Fecha ejecucion') ||\n extractField(textoCompleto, 'Fecha');\n\nconst comentario = extractField(textoCompleto, 'Comentario') || textoCompleto;\n\nconst now = new Date();\nconst fechaISO = now.toISOString();\n\nconst ejecucionId = `EJEC-${fechaISO.slice(0, 10).replace(/-/g, '')}-${telefonoActual.slice(-4)}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;\n\nconst motivosRevision = [];\n\nif (!eventos.length) motivosRevision.push('No se encontraron eventos pendientes para este número.');\nif (!propuestaReferencia) motivosRevision.push('Falta nombre o enlace de la propuesta.');\nif (!marcaCliente) motivosRevision.push('Falta marca o cliente.');\nif (!pais) motivosRevision.push('Falta país.');\nif (!ubicacion) motivosRevision.push('Falta ubicación.');\nif (fotosCount === 0 && videosCount === 0 && audiosCount === 0) {\n motivosRevision.push('No se detectó media en la sesión pendiente.');\n}\n\nconst estadoRevision = motivosRevision.length ? 'REQUIERE_REVISION' : 'PENDIENTE_PROCESAR';\n\nreturn [\n {\n json: {\n ejecucion_id: ejecucionId,\n fecha_recepcion: fechaISO,\n fecha_ejecucion: fechaEjecucion,\n manager_nombre: managerNombreActual,\n manager_telefono: telefonoActual,\n\n propuesta_referencia: propuestaReferencia,\n marca_cliente: marcaCliente,\n pais,\n ubicacion,\n comentario_original: comentario,\n\n eventos_pendientes_count: eventos.length,\n fotos_count: fotosCount,\n videos_count: videosCount,\n audios_count: audiosCount,\n\n estado_revision: estadoRevision,\n motivo_revision: motivosRevision.join(' | '),\n\n texto_sesion: textoCompleto,\n eventos_sesion: eventos,\n },\n },\n];" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -4720, - 8944 - ], - "id": "ae5d5cd5-21c2-48ce-a146-ddeb0c0fda50", - "name": "Code - Consolidar sesión LISTO" - }, - { - "parameters": { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "4425ec41-389a-45cf-8454-e54ab9168298", - "leftValue": "={{ $json.estado_revision }}", - "rightValue": "PENDIENTE_PROCESAR", - "operator": { - "type": "string", - "operation": "equals", - "name": "filter.operator.equals" - } - } - ], - "combinator": "and" - }, - "options": {} - }, - "type": "n8n-nodes-base.if", - "typeVersion": 2.3, - "position": [ - -4496, - 8944 - ], - "id": "215b217d-6c79-427c-9d26-7d1cd486a20a", - "name": "IF - Sesión lista para procesar" - }, - { - "parameters": { - "mode": "runOnceForEachItem", - "jsCode": "function clean(value) {\n return String(value ?? '').trim();\n}\n\nfunction slug(value, max = 50) {\n return clean(value)\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-zA-Z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .toUpperCase()\n .slice(0, max);\n}\n\nfunction paisCorto(value) {\n const p = slug(value, 40);\n\n const mapa = {\n 'REPUBLICA-DOMINICANA': 'RD',\n 'DOMINICANA': 'RD',\n 'PANAMA': 'PA',\n 'GUATEMALA': 'GT',\n 'COSTA-RICA': 'CR',\n 'EL-SALVADOR': 'SV',\n 'HONDURAS': 'HN',\n 'NICARAGUA': 'NI',\n 'COLOMBIA': 'CO',\n 'MEXICO': 'MX',\n 'PUERTO-RICO': 'PR',\n };\n\n return mapa[p] || p || 'SIN-PAIS';\n}\n\nconst fechaRaw = clean($json.fecha_ejecucion) || new Date().toISOString().slice(0, 10);\nconst fechaCompacta = fechaRaw.replace(/\\D/g, '').slice(0, 8) || new Date().toISOString().slice(0, 10).replace(/-/g, '');\n\nconst pais = paisCorto($json.pais);\n\nconst marcaCliente = slug($json.marca_cliente || $json.marca || $json.cliente || 'SIN-MARCA', 35);\n\nconst proyecto = slug(\n $json.propuesta_referencia ||\n $json.propuesta_nombre_banco ||\n $json.comentario_original ||\n 'SIN-PROYECTO',\n 45\n);\n\nconst telefono4 = clean($json.manager_telefono).replace(/\\D/g, '').slice(-4) || '0000';\n\nconst baseName = `EJEC_${fechaCompacta}_${pais}_${marcaCliente}_${proyecto}_${telefono4}`;\n\nreturn {\n json: {\n ...$json,\n drive_folder_name: baseName,\n presentation_file_name: `${baseName} - Reporte propuesta ejecutada`,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -3888, - 8800 - ], - "id": "1200e236-05e2-4f1e-a7f6-b3193996a12a", - "name": "Code - Preparar carpeta ejecución" - }, - { - "parameters": { - "resource": "folder", - "name": "={{ $json.drive_folder_name }}", - "driveId": { - "__rl": true, - "mode": "list", - "value": "My Drive" - }, - "folderId": { - "__rl": true, - "value": "16b9efHlPm0GjXaY0dYomtTU1GPu23VrU", - "mode": "list", - "cachedResultName": "Presentaciones de propuestas ejecutadas", - "cachedResultUrl": "https://drive.google.com/drive/folders/16b9efHlPm0GjXaY0dYomtTU1GPu23VrU" - }, - "options": {} - }, - "type": "n8n-nodes-base.googleDrive", - "typeVersion": 3, - "position": [ - -3680, - 8800 - ], - "id": "ade0f176-e786-4e68-8d47-59b228b722a9", - "name": "Drive - Crear carpeta ejecución", - "credentials": { - "googleDriveOAuth2Api": { - "id": "g23xdGLZRzBGqKgH", - "name": "Isaac - Google Drive" - } - } - }, - { - "parameters": { - "mode": "runOnceForEachItem", - "jsCode": "const sesion = $('Code - Consolidar sesión LISTO').first().json;\n\nconst prompt = `\nAnaliza esta información de una propuesta ejecutada.\n\nDebes responder únicamente en JSON válido, sin markdown y sin texto adicional.\n\nDatos disponibles:\n- Ejecución ID: ${sesion.ejecucion_id}\n- Manager: ${sesion.manager_nombre}\n- Teléfono: ${sesion.manager_telefono}\n- Propuesta referencia: ${sesion.propuesta_referencia}\n- Marca/Cliente: ${sesion.marca_cliente}\n- País: ${sesion.pais}\n- Ubicación: ${sesion.ubicacion}\n- Fecha ejecución: ${sesion.fecha_ejecucion}\n- Comentario original: ${sesion.comentario_original}\n- Texto completo de sesión:\n${sesion.texto_sesion}\n\nDevuelve este JSON:\n{\n \"resumen_ia\": \"\",\n \"descripcion_ejecucion\": \"\",\n \"elementos_detectados\": \"\",\n \"tags\": \"\",\n \"cliente\": \"\",\n \"marca\": \"\",\n \"estado_revision_sugerido\": \"\",\n \"motivo_revision_sugerido\": \"\"\n}\n\nReglas:\n- No inventes datos que no estén en el texto.\n- Si no puedes separar cliente y marca, coloca el mismo valor inferido en ambos o deja vacío el campo que no sepas.\n- Los tags deben ser palabras o frases cortas separadas por coma.\n- estado_revision_sugerido debe ser \"OK\" si la información parece suficiente o \"REQUIERE_REVISION\" si faltan datos importantes.\n`;\n\nreturn {\n json: {\n ...sesion,\n prompt_analisis_ia: prompt,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -3472, - 8800 - ], - "id": "918c6060-78f4-41a1-9600-5f5d41dfd761", - "name": "Code - Preparar análisis IA ejecución" - }, - { - "parameters": { - "modelId": { - "__rl": true, - "value": "models/gemini-2.5-flash-lite", - "mode": "list", - "cachedResultName": "models/gemini-2.5-flash-lite" - }, - "messages": { - "values": [ - { - "content": "={{ $json.prompt_analisis_ia }}" - } - ] - }, - "builtInTools": {}, - "options": {} - }, - "type": "@n8n/n8n-nodes-langchain.googleGemini", - "typeVersion": 1.1, - "position": [ - -3264, - 8800 - ], - "id": "cc9f9e6b-919b-4711-82c2-235256980561", - "name": "Gemini - Analizar texto ejecución", - "credentials": { - "googlePalmApi": { - "id": "jvsXYwL6IOoY2DBU", - "name": "Isaac - Gemini Api Pago" - } - } - }, - { - "parameters": { - "mode": "runOnceForEachItem", - "jsCode": "const sesion = $('Code - Consolidar sesión LISTO').first().json;\nconst drive = $('Drive - Crear carpeta ejecución').first().json || {};\n\nfunction clean(value) {\n return String(value ?? '').trim();\n}\n\nfunction parseAI(value) {\n const raw = clean(value);\n\n if (!raw) return {};\n\n try {\n return JSON.parse(raw);\n } catch (e) {\n const match = raw.match(/\\{[\\s\\S]*\\}/);\n if (match) {\n try {\n return JSON.parse(match[0]);\n } catch (err) {}\n }\n }\n\n return {\n resumen_ia: raw,\n };\n}\n\nconst rawAI =\n $json.output ||\n $json.text ||\n $json.response ||\n $json.content ||\n $json.message ||\n '';\n\nconst ai = parseAI(rawAI);\n\nconst driveId = clean(drive.id);\nconst mediaFolderUrl =\n clean(drive.webViewLink) ||\n clean(drive.webUrl) ||\n (driveId ? `https://drive.google.com/drive/folders/${driveId}` : 'PENDIENTE');\n\nconst estadoRevisionIA = clean(ai.estado_revision_sugerido);\nconst motivoRevisionIA = clean(ai.motivo_revision_sugerido);\n\nconst estadoRevision =\n estadoRevisionIA ||\n sesion.estado_revision ||\n 'PENDIENTE';\n\nconst motivoRevision =\n motivoRevisionIA ||\n sesion.motivo_revision ||\n '';\n\nreturn {\n json: {\n ejecucion_id: sesion.ejecucion_id,\n fecha_recepcion: sesion.fecha_recepcion,\n fecha_ejecucion: sesion.fecha_ejecucion,\n\n manager_nombre: sesion.manager_nombre,\n manager_telefono: sesion.manager_telefono,\n\n propuesta_referencia: sesion.propuesta_referencia,\n\n propuesta_match_estado: 'PENDIENTE_MATCH',\n propuesta_match_confianza: '',\n propuesta_nombre_banco: '',\n propuesta_link_banco: '',\n\n marca: clean(ai.marca) || sesion.marca_cliente,\n cliente: clean(ai.cliente) || sesion.marca_cliente,\n pais: sesion.pais,\n ubicacion: sesion.ubicacion,\n\n comentario_original: sesion.comentario_original,\n\n resumen_ia: clean(ai.resumen_ia) || 'PENDIENTE',\n descripcion_ejecucion: clean(ai.descripcion_ejecucion) || 'PENDIENTE',\n elementos_detectados: clean(ai.elementos_detectados) || 'PENDIENTE',\n tags: clean(ai.tags) || 'PENDIENTE',\n\n media_folder_url: mediaFolderUrl,\n presentacion_ejecucion_url: 'PENDIENTE',\n\n fotos_count: sesion.fotos_count,\n videos_count: sesion.videos_count,\n audios_count: sesion.audios_count,\n\n estado_revision: estadoRevision,\n motivo_revision: motivoRevision,\n ultima_actualizacion: new Date().toISOString(),\n\n eventos_sesion: sesion.eventos_sesion,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2912, - 8800 - ], - "id": "ae2e9fbf-2bcb-46e4-b9e8-2db121b71f89", - "name": "Code - Preparar fila propuesta ejecutada" - }, - { - "parameters": { - "operation": "append", - "documentId": { - "__rl": true, - "value": "1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw", - "mode": "list", - "cachedResultName": "Fulgencio - Propuestas Ejecutadas", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit?usp=drivesdk" - }, - "sheetName": { - "__rl": true, - "value": 1766200759, - "mode": "list", - "cachedResultName": "propuestas_ejecutadas", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit#gid=1766200759" - }, - "columns": { - "mappingMode": "defineBelow", - "value": { - "ultima_actualizacion": "={{ $json.ultima_actualizacion }}", - "motivo_revision": "={{ $json.motivo_revision }}", - "estado_revision": "={{ $json.estado_revision }}", - "audios_count": "={{ $json.audios_count }}", - "videos_count": "={{ $json.videos_count }}", - "fotos_count": "={{ $json.fotos_count }}", - "presentacion_ejecucion_url": "={{ $json.presentacion_ejecucion_url }}", - "media_folder_url": "={{ $json.media_folder_url }}", - "tags": "={{ $json.tags }}", - "elementos_detectados": "={{ $json.elementos_detectados }}", - "descripcion_ejecucion": "={{ $json.descripcion_ejecucion }}", - "resumen_ia": "={{ $json.resumen_ia }}", - "comentario_original": "={{ $json.comentario_original }}", - "ubicacion": "={{ $json.ubicacion }}", - "pais": "={{ $json.pais }}", - "cliente": "={{ $json.cliente }}", - "marca": "={{ $json.marca }}", - "propuesta_link_banco": "={{ $json.propuesta_link_banco }}", - "propuesta_nombre_banco": "={{ $json.propuesta_nombre_banco }}", - "propuesta_match_confianza": "={{ $json.propuesta_match_confianza }}", - "propuesta_match_estado": "={{ $json.propuesta_match_estado }}", - "propuesta_referencia": "={{ $json.propuesta_referencia }}", - "manager_telefono": "={{ $json.manager_telefono }}", - "manager_nombre": "={{ $json.manager_nombre }}", - "fecha_ejecucion": "={{ $json.fecha_ejecucion }}", - "fecha_recepcion": "={{ $json.fecha_recepcion }}", - "ejecucion_id": "={{ $json.ejecucion_id }}" - }, - "matchingColumns": [], - "schema": [ - { - "id": "ejecucion_id", - "displayName": "ejecucion_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fecha_recepcion", - "displayName": "fecha_recepcion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fecha_ejecucion", - "displayName": "fecha_ejecucion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_nombre", - "displayName": "manager_nombre", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_telefono", - "displayName": "manager_telefono", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "propuesta_referencia", - "displayName": "propuesta_referencia", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "propuesta_match_estado", - "displayName": "propuesta_match_estado", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "propuesta_match_confianza", - "displayName": "propuesta_match_confianza", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "propuesta_nombre_banco", - "displayName": "propuesta_nombre_banco", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "propuesta_link_banco", - "displayName": "propuesta_link_banco", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "marca", - "displayName": "marca", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "cliente", - "displayName": "cliente", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "pais", - "displayName": "pais", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "ubicacion", - "displayName": "ubicacion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "comentario_original", - "displayName": "comentario_original", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "resumen_ia", - "displayName": "resumen_ia", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "descripcion_ejecucion", - "displayName": "descripcion_ejecucion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "elementos_detectados", - "displayName": "elementos_detectados", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "tags", - "displayName": "tags", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "media_folder_url", - "displayName": "media_folder_url", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "presentacion_ejecucion_url", - "displayName": "presentacion_ejecucion_url", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fotos_count", - "displayName": "fotos_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "videos_count", - "displayName": "videos_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audios_count", - "displayName": "audios_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "estado_revision", - "displayName": "estado_revision", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "motivo_revision", - "displayName": "motivo_revision", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "ultima_actualizacion", - "displayName": "ultima_actualizacion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - } - ], - "attemptToConvertTypes": false, - "convertFieldsToString": false - }, - "options": {} - }, - "type": "n8n-nodes-base.googleSheets", - "typeVersion": 4.7, - "position": [ - -1872, - 8800 - ], - "id": "32a654ab-880e-4449-af1f-cae755a76cf1", - "name": "Sheets - Guardar propuesta ejecutada", - "credentials": { - "googleSheetsOAuth2Api": { - "id": "K0hDZh3a85MpOHCs", - "name": "Google Sheets account 2" - } - } - }, - { - "parameters": { - "jsCode": "const filaFinal = $('Code - Preparar fila propuesta ejecutada').first().json;\nconst eventos = filaFinal.eventos_sesion || [];\n\nfunction getRowNumber(row) {\n return (\n row.row_number ||\n row.__row_number ||\n row.__rowNumber ||\n row.rowNumber ||\n row._row_number ||\n ''\n );\n}\n\nreturn eventos\n .map(evento => {\n return {\n json: {\n ...evento,\n row_number: getRowNumber(evento),\n estado: 'PROCESADO',\n ejecucion_id: filaFinal.ejecucion_id,\n fecha_procesado: new Date().toISOString(),\n },\n };\n })\n .filter(item => item.json.row_number);" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -1664, - 8800 - ], - "id": "71217f03-1c8b-43d7-906b-6f0c133eb1f4", - "name": "Code - Preparar eventos para marcar procesados" - }, - { - "parameters": { - "operation": "update", - "documentId": { - "__rl": true, - "value": "1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw", - "mode": "list", - "cachedResultName": "Fulgencio - Propuestas Ejecutadas", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit?usp=drivesdk" - }, - "sheetName": { - "__rl": true, - "value": "gid=0", - "mode": "list", - "cachedResultName": "wa_ejecuciones_eventos", - "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pXW_Vy__UwFgUY6zjjHEHqjz01nr6Q2eXWpM2YPVfYw/edit#gid=0" - }, - "columns": { - "mappingMode": "defineBelow", - "value": { - "event_id": "={{ $json.event_id }}", - "estado": "={{ $json.estado }}", - "ejecucion_id": "={{ $json.ejecucion_id }}", - "fecha_procesado": "={{ $json.fecha_procesado }}" - }, - "matchingColumns": [ - "event_id" - ], - "schema": [ - { - "id": "event_id", - "displayName": "event_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true, - "removed": false - }, - { - "id": "fecha_recepcion", - "displayName": "fecha_recepcion", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_telefono", - "displayName": "manager_telefono", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "manager_nombre", - "displayName": "manager_nombre", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "message_type", - "displayName": "message_type", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "texto", - "displayName": "texto", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "comando", - "displayName": "comando", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "tiene_media", - "displayName": "tiene_media", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "media_count", - "displayName": "media_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "raw_preview", - "displayName": "raw_preview", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "estado", - "displayName": "estado", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "ejecucion_id", - "displayName": "ejecucion_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fecha_procesado", - "displayName": "fecha_procesado", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "row_number", - "displayName": "row_number", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true, - "readOnly": true, - "removed": true - } - ], - "attemptToConvertTypes": false, - "convertFieldsToString": false - }, - "options": {} - }, - "type": "n8n-nodes-base.googleSheets", - "typeVersion": 4.7, - "position": [ - -1456, - 8800 - ], - "id": "0ede07a5-f64d-4edb-9021-76f48e4bd844", - "name": "Sheets - Marcar eventos procesados", - "credentials": { - "googleSheetsOAuth2Api": { - "id": "K0hDZh3a85MpOHCs", - "name": "Google Sheets account 2" - } - } - }, - { - "parameters": { - "mode": "runOnceForEachItem", - "jsCode": "const fila = $('Code - Preparar fila propuesta ejecutada').first().json;\n\nconst texto = `Listo. Registré la propuesta ejecutada.\n\nID: ${fila.ejecucion_id}\nMarca/Cliente: ${fila.marca || fila.cliente || 'No disponible'}\nPaís: ${fila.pais || 'No disponible'}\nUbicación: ${fila.ubicacion || 'No disponible'}\n\nGuardé el registro para revisión y procesamiento final.`;\n\nreturn {\n json: {\n ...fila,\n whatsapp_to: String(fila.manager_telefono || '').replace(/\\D/g, ''),\n whatsapp_text: texto,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -1248, - 8800 - ], - "id": "1b04a14f-ef37-4214-a298-90e30a6e4278", - "name": "Code - Preparar confirmación procesado" - }, - { - "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": "={{ String($json.whatsapp_to || '').includes('@') ? String($json.whatsapp_to) : String($json.whatsapp_to || '').replace(/\\D/g, '') + '@s.whatsapp.net' }}" - }, - { - "name": "text", - "value": "={{ $json.whatsapp_text }}" - }, - { - "name": "delay", - "value": "={{2000}}" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.2, - "position": [ - 8128, - 6880 - ], - "id": "4e2f9d5b-887f-40ed-95f9-a5b6721050d9", - "name": "HTTP Request - Enviar mensaje WhatsApp" - }, - { - "parameters": { - "operation": "copy", - "fileId": { - "__rl": true, - "value": "1oDY713ydM5ef9VkfmLPUB3st7qBYPKLU", - "mode": "list", - "cachedResultName": "TEMPLATE_Propuesta_Ejecutada_Fulgencio.pptx", - "cachedResultUrl": "https://docs.google.com/presentation/d/1oDY713ydM5ef9VkfmLPUB3st7qBYPKLU/edit?usp=drivesdk&ouid=110013484451765346305&rtpof=true&sd=true" - }, - "name": "={{ $('Code - Preparar carpeta ejecución').first().json.presentation_file_name }}", - "sameFolder": false, - "driveId": { - "__rl": true, - "mode": "list", - "value": "My Drive" - }, - "folderId": { - "__rl": true, - "value": "={{ $('Drive - Crear carpeta ejecución').first().json.id }}", - "mode": "id" - }, - "options": {} - }, - "type": "n8n-nodes-base.googleDrive", - "typeVersion": 3, - "position": [ - -2704, - 8800 - ], - "id": "456fb9bd-cb1c-416b-935f-9c9f6a9bc921", - "name": "Drive - Copiar template presentación", - "credentials": { - "googleDriveOAuth2Api": { - "id": "g23xdGLZRzBGqKgH", - "name": "Isaac - Google Drive" - } - } - }, - { - "parameters": { - "jsCode": "const fila = $('Code - Preparar fila propuesta ejecutada').first().json;\nconst slide = $('Drive - Copiar template presentación').first().json || {};\n\nfunction clean(value) {\n return String(value ?? '').trim();\n}\n\nconst presentationId = clean(slide.id);\n\nconst presentationUrl =\n clean(slide.webViewLink) ||\n clean(slide.webUrl) ||\n (presentationId ? `https://docs.google.com/presentation/d/${presentationId}/edit` : 'PENDIENTE');\n\nconst replacements = {\n '{{EJECUCION_ID}}': fila.ejecucion_id,\n '{{FECHA_EJECUCION}}': fila.fecha_ejecucion,\n '{{MARCA}}': fila.marca,\n '{{CLIENTE}}': fila.cliente,\n '{{PAIS}}': fila.pais,\n '{{UBICACION}}': fila.ubicacion,\n '{{PROPUESTA_REFERENCIA}}': fila.propuesta_referencia,\n '{{MANAGER_NOMBRE}}': fila.manager_nombre,\n '{{RESUMEN_IA}}': fila.resumen_ia,\n '{{DESCRIPCION_EJECUCION}}': fila.descripcion_ejecucion,\n '{{ELEMENTOS_DETECTADOS}}': fila.elementos_detectados,\n '{{TAGS}}': fila.tags,\n '{{MEDIA_FOLDER_URL}}': fila.media_folder_url,\n '{{FOTOS_COUNT}}': fila.fotos_count,\n '{{VIDEOS_COUNT}}': fila.videos_count,\n '{{AUDIOS_COUNT}}': fila.audios_count,\n};\n\nconst requests = Object.entries(replacements).map(([placeholder, value]) => ({\n replaceAllText: {\n containsText: {\n text: placeholder,\n matchCase: true,\n },\n replaceText: clean(value) || 'No disponible',\n },\n}));\n\nreturn {\n json: {\n ...fila,\n presentation_id: presentationId,\n presentacion_ejecucion_url: presentationUrl,\n slides_requests: requests,\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2496, - 8800 - ], - "id": "b081a544-b13d-421d-8e52-8206be087dc1", - "name": "Code - Preparar reemplazos Slides" - }, - { - "parameters": { - "method": "POST", - "url": "={{ 'https://slides.googleapis.com/v1/presentations/' + $json.presentation_id + ':batchUpdate' }}", - "authentication": "predefinedCredentialType", - "nodeCredentialType": "googleOAuth2Api", - "sendBody": true, - "specifyBody": "json", - "jsonBody": "={{\n {\n requests: $json.slides_requests\n }\n}}", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "position": [ - -2288, - 8800 - ], - "id": "c66aaace-b635-43cb-9977-669a98d8fcbf", - "name": "HTTP Request - Reemplazar textos Slides", - "credentials": { - "googleOAuth2Api": { - "id": "eHseMeH39kRcXgOF", - "name": "Google account 2" - } - } - }, - { - "parameters": { - "jsCode": "const fila = $('Code - Preparar reemplazos Slides').first().json;\n\nreturn {\n json: {\n ...fila,\n presentacion_ejecucion_url: fila.presentacion_ejecucion_url || 'PENDIENTE',\n },\n};" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - -2080, - 8800 - ], - "id": "48666a6c-dea5-4195-a257-136d4ba70193", - "name": "Code - Actualizar link presentación" - }, - { - "parameters": { - "workflowInputs": { - "values": [ - { - "name": "phone" - } - ] - } - }, - "type": "n8n-nodes-base.executeWorkflowTrigger", - "typeVersion": 1.1, - "position": [ - -9744, - 8112 - ], - "id": "9a0322b0-396a-4cd1-8829-a841fe2aa784", - "name": "When Executed by Another Workflow", - "disabled": true - }, - { - "parameters": { - "rules": { - "values": [ - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "leftValue": "={{ $json.comando }}", - "rightValue": "=FORMATO", - "operator": { - "type": "string", - "operation": "equals" - }, - "id": "c749d60c-b479-42d2-ab4b-32f4ab5ddcb8" - } - ], - "combinator": "and" - }, - "renameOutput": "={{ true }}" - }, - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "c46d57fa-81c0-42e4-a602-6983df1d33b1", - "leftValue": "={{ $json.comando }}", - "rightValue": "=LISTO", - "operator": { - "type": "string", - "operation": "equals", - "name": "filter.operator.equals" - } - } - ], - "combinator": "and" - }, - "renameOutput": "={{ true }}" - }, - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "27e1a704-d8e0-442b-a9ed-28430b91429a", - "leftValue": "={{ $json.comando }}", - "rightValue": "=NORMAL", - "operator": { - "type": "string", - "operation": "equals", - "name": "filter.operator.equals" - } - } - ], - "combinator": "and" - }, - "renameOutput": "={{ true }}" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.switch", - "typeVersion": 3.4, - "position": [ - -8816, - 7232 - ], - "id": "574a721b-22fa-4fb0-b1a4-da15d17958ea", - "name": "ANTERIOR - Switch Comando WhatsApp" - }, { "parameters": { "rules": { @@ -3963,33 +2787,6 @@ "id": "06bad8cf-95ee-473f-b468-ff0a29fb52d6", "name": "Code - Preparar error sesión incompleta" }, - { - "parameters": { - "method": "POST", - "url": "https://wsp.gomezleemarketing.com/chat/getBase64FromMediaMessage/botsoporte", - "sendHeaders": true, - "headerParameters": { - "parameters": [ - { - "name": "apikey", - "value": "={{'C267126ABB45-4C12-B626-6BAB1833F5D7'}}" - } - ] - }, - "sendBody": true, - "specifyBody": "json", - "jsonBody": "={{\n {\n message: {\n key: {\n id: $json.audio_event_id\n }\n },\n convertToMp4: false\n }\n}}", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "position": [ - 1120, - -1168 - ], - "id": "6e76e8d2-4384-4698-ae2f-0ff4e4680d69", - "name": "HTTP Request - Obtener audio Evolution" - }, { "parameters": { "updates": [ @@ -4931,10 +3728,10 @@ "operation": "copy", "fileId": { "__rl": true, - "value": "1XqOWITIuynT6SizMpmywMyYd27zT0mdxZFqphnGxEFk", + "value": "10PZtoMFuiXczGM9Itbcjce4EKBUhiztFbXZiTWX2DKc", "mode": "list", - "cachedResultName": "Propuesta_Ejecutada_Fulgencio_TEMPLATE", - "cachedResultUrl": "https://docs.google.com/presentation/d/1XqOWITIuynT6SizMpmywMyYd27zT0mdxZFqphnGxEFk/edit?usp=drivesdk" + "cachedResultName": "GLM_Propuesta_Ejecutada_Fulgencio_TEMPLATE_V2", + "cachedResultUrl": "https://docs.google.com/presentation/d/10PZtoMFuiXczGM9Itbcjce4EKBUhiztFbXZiTWX2DKc/edit?usp=drivesdk" }, "name": "={{ $json.presentacion_nombre_drive }}", "sameFolder": false, @@ -5681,11 +4478,6 @@ ] ] }, - "Respond - OK Evolution": { - "main": [ - [] - ] - }, "IF - Mensaje entrante válido": { "main": [ [ @@ -5697,268 +4489,6 @@ ] ] }, - "Code - Preparar formato WhatsApp": { - "main": [ - [ - { - "node": "HTTP Request - Enviar mensaje WhatsApp", - "type": "main", - "index": 0 - } - ] - ] - }, - "Sheets - Guardar evento WhatsApp": { - "main": [ - [ - { - "node": "Code - Preparar confirmación recibido", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar confirmación recibido": { - "main": [ - [ - { - "node": "HTTP Request - Enviar mensaje WhatsApp", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar respuesta LISTO": { - "main": [ - [ - { - "node": "HTTP Request - Enviar mensaje WhatsApp", - "type": "main", - "index": 0 - } - ] - ] - }, - "Sheets - Leer eventos pendientes": { - "main": [ - [ - { - "node": "Code - Consolidar sesión LISTO", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Consolidar sesión LISTO": { - "main": [ - [ - { - "node": "IF - Sesión lista para procesar", - "type": "main", - "index": 0 - } - ] - ] - }, - "IF - Sesión lista para procesar": { - "main": [ - [ - { - "node": "Code - Preparar carpeta ejecución", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "Code - Preparar respuesta LISTO", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar carpeta ejecución": { - "main": [ - [ - { - "node": "Drive - Crear carpeta ejecución", - "type": "main", - "index": 0 - } - ] - ] - }, - "Drive - Crear carpeta ejecución": { - "main": [ - [ - { - "node": "Code - Preparar análisis IA ejecución", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar análisis IA ejecución": { - "main": [ - [ - { - "node": "Gemini - Analizar texto ejecución", - "type": "main", - "index": 0 - } - ] - ] - }, - "Gemini - Analizar texto ejecución": { - "main": [ - [ - { - "node": "Code - Preparar fila propuesta ejecutada", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar fila propuesta ejecutada": { - "main": [ - [ - { - "node": "Drive - Copiar template presentación", - "type": "main", - "index": 0 - } - ] - ] - }, - "Sheets - Guardar propuesta ejecutada": { - "main": [ - [ - { - "node": "Code - Preparar eventos para marcar procesados", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar eventos para marcar procesados": { - "main": [ - [ - { - "node": "Sheets - Marcar eventos procesados", - "type": "main", - "index": 0 - } - ] - ] - }, - "Sheets - Marcar eventos procesados": { - "main": [ - [ - { - "node": "Code - Preparar confirmación procesado", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar confirmación procesado": { - "main": [ - [ - { - "node": "HTTP Request - Enviar mensaje WhatsApp", - "type": "main", - "index": 0 - } - ] - ] - }, - "Webhook": { - "main": [ - [] - ] - }, - "Drive - Copiar template presentación": { - "main": [ - [ - { - "node": "Code - Preparar reemplazos Slides", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Preparar reemplazos Slides": { - "main": [ - [ - { - "node": "HTTP Request - Reemplazar textos Slides", - "type": "main", - "index": 0 - } - ] - ] - }, - "HTTP Request - Reemplazar textos Slides": { - "main": [ - [ - { - "node": "Code - Actualizar link presentación", - "type": "main", - "index": 0 - } - ] - ] - }, - "Code - Actualizar link presentación": { - "main": [ - [ - { - "node": "Sheets - Guardar propuesta ejecutada", - "type": "main", - "index": 0 - } - ] - ] - }, - "When Executed by Another Workflow": { - "main": [ - [] - ] - }, - "ANTERIOR - Switch Comando WhatsApp": { - "main": [ - [ - { - "node": "Code - Preparar formato WhatsApp", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "Sheets - Leer eventos pendientes", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "Sheets - Guardar evento WhatsApp", - "type": "main", - "index": 0 - } - ] - ] - }, "Code - Resolver inicio sesión": { "main": [ [ @@ -6521,11 +5051,6 @@ ] ] }, - "HTTP Request - Obtener audio Evolution": { - "main": [ - [] - ] - }, "IF - Cierre válido": { "main": [ [ @@ -7138,9 +5663,9 @@ "meta": { "templateCredsSetupCompleted": true }, - "versionId": "ed1bff53-fc72-4b34-b4c5-4389e961a6a8", - "activeVersionId": "ed1bff53-fc72-4b34-b4c5-4389e961a6a8", - "versionCounter": 624, + "versionId": "8b8087ff-bfbc-455b-9666-731028169ebf", + "activeVersionId": "0447b997-2ad2-444c-a43a-d537e1f2d704", + "versionCounter": 631, "triggerCount": 1, "shared": [ { @@ -7163,9 +5688,9 @@ ], "tags": [], "activeVersion": { - "updatedAt": "2026-06-06T16:02:01.000Z", - "createdAt": "2026-06-06T16:00:46.086Z", - "versionId": "ed1bff53-fc72-4b34-b4c5-4389e961a6a8", + "updatedAt": "2026-06-08T18:29:26.000Z", + "createdAt": "2026-06-08T18:27:10.687Z", + "versionId": "0447b997-2ad2-444c-a43a-d537e1f2d704", "workflowId": "4eCPQcE3FDIll8bW", "nodes": [ { @@ -12092,10 +10617,10 @@ "operation": "copy", "fileId": { "__rl": true, - "value": "1XqOWITIuynT6SizMpmywMyYd27zT0mdxZFqphnGxEFk", + "value": "10PZtoMFuiXczGM9Itbcjce4EKBUhiztFbXZiTWX2DKc", "mode": "list", - "cachedResultName": "Propuesta_Ejecutada_Fulgencio_TEMPLATE", - "cachedResultUrl": "https://docs.google.com/presentation/d/1XqOWITIuynT6SizMpmywMyYd27zT0mdxZFqphnGxEFk/edit?usp=drivesdk" + "cachedResultName": "GLM_Propuesta_Ejecutada_Fulgencio_TEMPLATE_V2", + "cachedResultUrl": "https://docs.google.com/presentation/d/10PZtoMFuiXczGM9Itbcjce4EKBUhiztFbXZiTWX2DKc/edit?usp=drivesdk" }, "name": "={{ $json.presentacion_nombre_drive }}", "sameFolder": false, @@ -14289,15 +12814,15 @@ } }, "authors": "Isaac Aracena", - "name": "Version ed1bff53", + "name": "Version 0447b997", "description": "", "autosaved": true, "workflowPublishHistory": [ { - "createdAt": "2026-06-06T16:02:01.124Z", - "id": 1199, + "createdAt": "2026-06-08T18:29:26.414Z", + "id": 1206, "workflowId": "4eCPQcE3FDIll8bW", - "versionId": "ed1bff53-fc72-4b34-b4c5-4389e961a6a8", + "versionId": "0447b997-2ad2-444c-a43a-d537e1f2d704", "event": "activated", "userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029" }