{
"updatedAt": "2026-08-22T15:29:56.159Z",
"createdAt": "2026-05-25T16:49:10.427Z",
"id": "Z8W67i7RfrhXRDFQ",
"name": "CDC Brief - GLM V2",
"description": "Recibe y procesa solicitudes de brief creativo, organiza la información suministrada y la prepara para su registro, seguimiento y ejecución por parte del equipo de CDC.",
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "cdc-brief-test-metadata",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-368,
1968
],
"id": "994ac5cd-c6b0-4d9d-ae66-7b0a00eb925e",
"name": "Webhook",
"webhookId": "0459b7fe-a6fc-47cb-bcf1-afadb9587124"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"leftValue": "={{$json.type}} ",
"rightValue": "pdf_document",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "19494f94-55a5-4849-bdc0-e056140e371d"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "PDF"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "9c4aa96c-5b3c-46bb-a2f7-a10da4c807be",
"leftValue": "={{$json.type}}",
"rightValue": "image",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Imagen"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "3d1a3c24-4fe2-4239-9b64-2a33c3043fb0",
"leftValue": "={{$('Code in JavaScript').item.json.type}}",
"rightValue": "video",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Video"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "29941bad-2e02-4c26-bccb-115fbb2c4b57",
"leftValue": "={{$json.type}}",
"rightValue": "audio",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Audio"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "8ff5d5cf-26e7-4516-a154-0d7fa8855012",
"leftValue": "={{$json.type}}",
"rightValue": "text",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Texto"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "437f4ff8-8556-4f8f-b935-a55eda65afde",
"leftValue": "={{$json.type}}",
"rightValue": "other",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "other"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
496,
1856
],
"id": "3b794f04-2e45-4b84-8efc-e958fa4f69f6",
"name": "Switch"
},
{
"parameters": {
"resource": "audio",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1936,
1968
],
"id": "cd64ea3f-59a2-4003-9f25-ce2978099e81",
"name": "Analyze audio",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"numberInputs": 3
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
4192,
2016
],
"id": "9a3e4c8a-1bd4-463a-848b-3123c262dc56",
"name": "Merge"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"messages": {
"values": [
{
"content": "=Actúa como un asistente de inteligencia artificial especializado en interpretación y estructuración de briefs creativos, estratégicos y comerciales.\n\nTu tarea es analizar todo el contenido recibido y transformarlo en un brief profesional, claro, accionable y listo para revisión interna, edición en Google Docs y representación visual en HTML.\n\nInstrucciones de trabajo:\n\n1. Captura e interpretación\n- Lee y consolida toda la información disponible.\n- Si existe texto derivado del audio, úsalo como contexto principal.\n- Si hay documentos, imágenes o referencias visuales, intégralos como soporte complementario.\n- Extrae entidades clave, objetivos, requerimientos, restricciones, entregables, fechas, audiencias, marcas, productos y cualquier dato relevante.\n- Distingue claramente entre:\n - Tipo de requerimiento = categoría general de la solicitud.\n - Tipo de entregable = pedido específico o salida concreta esperada.\n\n2. Detección de vacíos\n- Detecta campos obligatorios ausentes.\n- Identifica detalles técnicos faltantes.\n- Señala contradicciones o inconsistencias.\n- Marca información ambigua o poco clara.\n- Advierte posibles riesgos para el desarrollo creativo, estratégico o de producción.\n\n3. Enriquecimiento y estructuración\n- Reorganiza la información y conviértela en un brief profesional con redacción clara, precisa y ejecutiva.\n- Mejora la redacción sin inventar datos no proporcionados.\n- Cuando algo no esté disponible, indícalo como “No especificado” o “Pendiente de definir”.\n- Si no existe un nombre explícito para el proyecto, genera un nombre breve y profesional usando únicamente los datos reales disponibles, sin inventar información nueva.\n\n4. Reglas importantes de salida\n- No repitas información redundante.\n- No inventes datos.\n- Prioriza claridad, orden y utilidad práctica.\n- Redacta con tono profesional y ejecutivo.\n- La salida debe sentirse como un brief listo para revisión interna.\n- Debes incluir explícitamente los campos “Nombre del proyecto”, “Cliente”, “Marca”, “País”, “Tipo de requerimiento” y “Tipo de entregable”.\n- No mezcles “Tipo de requerimiento” con “Tipo de entregable”.\n- Si cliente y marca son la misma cosa, puedes repetir el valor en ambos campos.\n- Si no puedes identificar uno de los dos, usa “No especificado”.\n\n5. Genera la salida exactamente en este formato:\n\n1. Resumen ejecutivo\n- Explica de forma breve y profesional de qué trata la solicitud, cuál es el objetivo y qué se espera desarrollar.\n\n2. Información clave del brief\n- Nombre del proyecto\n- Cliente\n- Marca\n- País\n- Producto / servicio\n- Tipo de requerimiento\n- Tipo de entregable\n- Objetivo principal\n- Contexto / antecedente\n- Audiencia objetivo\n- Mensaje clave\n- Entregables solicitados\n- Canales / formatos\n- Requerimientos técnicos\n- Referencias creativas o visuales\n- Fechas o tiempos relevantes\n- Presupuesto\n- Restricciones o consideraciones especiales\n\n3. Vacíos detectados\n- Lista clara de campos faltantes, ambiguos o contradictorios.\n\n4. Riesgos o alertas\n- Señala riesgos que puedan afectar la ejecución, creatividad, tiempos, costos o claridad del proyecto.\n\n5. Recomendaciones rápidas\n- Sugiere qué información adicional conviene completar o reforzar antes de aprobar el brief final.\n\n6. Nivel de completitud\n- Indica un porcentaje estimado de completitud del brief según la información recibida.\n\nContenido recibido:\n{{$json.combined_content}}"
}
]
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
4576,
2032
],
"id": "98e329ae-a5b6-4fd4-8635-0495610505a5",
"name": "Message a model",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "ddc91110-0c3b-4ee7-a973-322a3d1c7c1e",
"name": "type",
"value": "audio",
"type": "string"
},
{
"id": "b667804d-e4b9-4225-9a6e-01d54067f0cf",
"name": "fileName",
"value": "={{$json.fileName || ''}}",
"type": "string"
},
{
"id": "4023fd4f-95ce-4571-845b-c7555c4efc88",
"name": "content_summary",
"value": "={{ $json.content.parts[0].text || '' }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3024,
1952
],
"id": "38dfbff8-21c0-4a70-ac44-956f159d9da2",
"name": "Edit Fields1"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "=Este es el enlace al folder con el contenido del brief:\n\nhttps://drive.google.com/drive/u/0/folders/{{ $('Create folder').first().json.id }}\n\nEn caso de algún vacío detectado, favor de ingresar al link y modificar el archivo.\n\nVacíos detectados:\n\n{{ $('Build Docs Requests').first().json.fields.VACIOS_DETECTADOS || \"Ninguno\" }}",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
8656,
1968
],
"id": "d18bbc77-a828-45be-a6fc-42467125d998",
"name": "Respond to Webhook"
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1952,
2208
],
"id": "8f9a565d-f651-4a91-8ed3-f95fe169e938",
"name": "Analyze an image",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"resource": "folder",
"name": "=Brief {{$now}}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-208,
1968
],
"id": "b33ae2d5-2c77-4aa4-92dc-e995bedd8f14",
"name": "Create folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "738bec56-f577-41da-a35f-dc8346893e10",
"name": "fileName",
"value": "={{ $('Switch').item.json.fileName || '' }}",
"type": "string"
},
{
"id": "6df83b75-7e13-48db-a557-7ee85c52a2b2",
"name": "content_summary",
"value": "={{ $json.content?.parts?.[0]?.text || 'Imagen adjunta por el usuario. No se pudo generar una descripción automática en este intento.' }}",
"type": "string"
},
{
"id": "1a1db20c-3dd7-4776-9d97-46bd31213a87",
"name": "type",
"value": "image",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3216,
2240
],
"id": "a278966c-83be-4307-a174-8b00f03f615a",
"name": "Edit Fields2"
},
{
"parameters": {
"resource": "folder",
"operation": "share",
"folderNoRootId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"permissionsUi": {
"permissionsValues": {
"role": "writer",
"type": "domain",
"domain": "gomezleemarketing.com"
}
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
8240,
1968
],
"id": "5273482f-4212-4ec6-8205-f8eda6293307",
"name": "Share folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"name": "={{ $json.fileName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "={{ $json.folderId }}",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
2336,
2672
],
"id": "21ea562d-9720-4e54-9465-2cc899e169e8",
"name": "Upload file",
"executeOnce": false,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"sendTo": "areyes@gomezleemarketing.com, boliva@gomezleemarketing.com",
"subject": "✏️ Nuevo Brief",
"message": "=\n\n
\n \n \n Nuevo brief · GomezLee Marketing\n\n\n\n\n Nuevo brief creado por {{ $('Webhook').first().json.body.submittedByName || 'No especificado' }} ·\n {{ $('Build Docs Requests').first().json.fields.NOMBRE_PROYECTO || 'CDC Brief' }}\n\n \n \n \n
\n\n\n \n \n\n \n\n \n | \n \n | \n \n\n \n \n \n | \n \n\n \n | \n \n \n \n | \n \n\n \n | \n \n Nuevo brief\n \n\n \n Se ha creado un nuevo brief.\n \n | \n \n\n \n | \n \n Hola Thaía,\n \n\n \n Se ha generado un nuevo brief en\n CDC Brief\n y ya está disponible para revisión.\n \n | \n \n\n \n \n \n \n | \n \n Proyecto\n \n\n \n {{ $('Build Docs Requests').first().json.fields.NOMBRE_PROYECTO || 'Brief sin nombre especificado' }}\n \n | \n \n \n | \n \n\n \n \n | \n\n \n\n \n La carpeta contiene el documento generado y los archivos asociados al envío.\n \n\n | \n \n\n \n | \n \n Datos del envío\n \n | \n \n\n \n \n \n \n | \n Enviado por\n | \n \n {{ $('Webhook').first().json.body.submittedByName || 'No especificado' }}\n | \n \n\n \n | \n Correo\n | \n \n \n {{ $('Webhook').first().json.body.submittedByEmail || 'No especificado' }}\n \n | \n \n\n \n | \n Fecha límite\n | \n \n {{\n $('Preparar fecha de entrega').first().json.deliveryDateLabel\n || $('Preparar fecha de entrega').first().json.fechaEntregaTexto\n || $('Webhook').first().json.body.deliveryDateLabel\n || $('Webhook').first().json.body.fechaEntregaTexto\n || 'Por confirmar'\n }}\n | \n \n\n \n | \n Cliente / marca\n | \n \n {{ $('Build Docs Requests').first().json.fields.MARCA_CLIENTE || 'No especificado' }}\n | \n \n \n | \n \n\n \n \n \n \n | \n \n Brief listo para revisión\n \n\n \n Si necesitas completar o corregir información, puedes hacerlo directamente desde el documento ubicado en la carpeta.\n \n | \n \n \n | \n \n\n \n | \n \n Gracias,\n \n\n \n CDC Brief · GomezLee Marketing\n \n | \n \n\n \n | \n
\n
\n\n\n",
"options": {
"appendAttribution": false,
"senderName": "📢 HEY"
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
9008,
1968
],
"id": "2064ba9f-08ae-4dab-9596-4a449f044e10",
"name": "Send a message",
"webhookId": "2a920b9f-c697-4a4e-9c69-0bf0749c2661",
"credentials": {
"gmailOAuth2": {
"id": "cehQBe6X1BQLmcD9",
"name": "Gmail account - Isaac"
}
}
},
{
"parameters": {
"operation": "copy",
"fileId": {
"__rl": true,
"value": "1UuCLClREoC_9OvT407B36nHJ1x4l418Q0dEwgGccws4",
"mode": "list",
"cachedResultName": "CDC_Brief_GLM_V2",
"cachedResultUrl": "https://docs.google.com/document/d/1UuCLClREoC_9OvT407B36nHJ1x4l418Q0dEwgGccws4/edit?usp=drivesdk"
},
"name": "={{ $('Build Names').first().json.docName }}",
"sameFolder": false,
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
7568,
1968
],
"id": "99a29233-ca5d-45a8-80ff-4471497402d3",
"name": "Copy template",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"jsCode": "const text = String($json.googleDocsText || '').replace(/\\r\\n/g, '\\n').trim();\nconst ANO = String(new Date().getFullYear());\n\nconst baseItems = $('Code in JavaScript').all();\n\nconst urlRegex = /https?:\\/\\/[^\\s<>\"')]+/gi;\nconst linksSet = new Set();\nconst attachmentsSet = new Set();\n\nfor (const item of baseItems) {\n const json = item.json || {};\n\n const textValue = String(json.text || '').trim();\n const matches = textValue.match(urlRegex) || [];\n for (const url of matches) {\n linksSet.add(url);\n }\n\n const fileName = String(json.fileName || '').trim();\n if (fileName) {\n attachmentsSet.add(fileName);\n }\n}\n\nconst support = {\n enlacesReferenciaText: linksSet.size\n ? Array.from(linksSet).map(url => `• ${url}`).join('\\n')\n : 'No se compartieron enlaces de referencia online.',\n\n adjuntosRecibidosText: attachmentsSet.size\n ? Array.from(attachmentsSet).map(name => `• ${name}`).join('\\n')\n : 'No se recibieron adjuntos adicionales.'\n};\n\nfunction getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction sectionBetween(startRe, endRe) {\n const lines = text.split('\\n');\n let start = -1;\n let end = lines.length;\n\n for (let i = 0; i < lines.length; i++) {\n if (startRe.test(lines[i].trim())) {\n start = i + 1;\n break;\n }\n }\n\n if (start === -1) return '';\n\n if (endRe) {\n for (let i = start; i < lines.length; i++) {\n if (endRe.test(lines[i].trim())) {\n end = i;\n break;\n }\n }\n }\n\n return lines.slice(start, end).join('\\n').trim();\n}\n\nfunction normalizeLabel(str) {\n return String(str || '')\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nfunction cleanValue(value, fallback = 'No especificado') {\n const lines = String(value || '')\n .split('\\n')\n .map(line => line.trim())\n .filter(Boolean);\n\n return lines.length ? lines.join('\\n') : fallback;\n}\n\nfunction formatMultiline(value, fallback = 'No especificado') {\n const lines = String(value || '')\n .split('\\n')\n .map(line => line.trim())\n .filter(Boolean);\n\n if (!lines.length) return fallback;\n\n return lines\n .map(line => {\n if (/^[•*\\-–]\\s*/.test(line)) {\n return `• ${line.replace(/^[•*\\-–]\\s*/, '').trim()}`;\n }\n return line;\n })\n .join('\\n');\n}\n\nfunction bullets(sectionText, fallback = 'No especificado') {\n const items = String(sectionText || '')\n .split('\\n')\n .map(line => line.replace(/^\\s*[•*\\-–]\\s*/, '').trim())\n .filter(Boolean);\n\n if (!items.length) return fallback;\n\n return items.map(item => `• ${item}`).join('\\n');\n}\n\nfunction completion(sectionText) {\n const match = String(sectionText || '').match(/(\\d{1,3}\\s*%)/);\n if (match) return match[1].replace(/\\s+/g, '');\n\n const cleaned = String(sectionText || '').trim();\n return cleaned || 'No especificado';\n}\n\nfunction buildFechasTiemposRelevantes(fechaEntrega, fechasDetectadas) {\n const fecha = String(fechaEntrega || '').trim() || 'Por confirmar';\n const fechas = String(fechasDetectadas || '').trim();\n\n const entregaLine = `• Fecha límite de entrega: ${fecha}.`;\n\n const fechasNormalizadas = normalizeLabel(fechas)\n .replace(/[.:;]+$/g, '')\n .trim();\n\n const noHayFechasDetectadas =\n !fechas ||\n fechasNormalizadas === 'no especificado' ||\n fechasNormalizadas === 'no especificada' ||\n fechasNormalizadas === 'no se especifico' ||\n fechasNormalizadas === 'no se especifica' ||\n fechasNormalizadas === 'no indicado' ||\n fechasNormalizadas === 'no indicada';\n\n if (noHayFechasDetectadas) {\n return entregaLine;\n }\n\n return `${entregaLine}\\n${fechas}`;\n}\n\nconst fechaEntregaNode = getNodeJson('Preparar fecha de entrega');\n\nconst fechaEntrega =\n fechaEntregaNode.deliveryDateLabel ||\n fechaEntregaNode.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst infoSection = sectionBetween(\n /^2\\.\\s*Informaci[oó]n clave del brief$/i,\n /^3\\.\\s*Vac[ií]os\\s+detectados$/i\n);\n\nconst labelMap = {\n 'Nombre del proyecto': 'NOMBRE_PROYECTO',\n 'Cliente': 'CLIENTE',\n 'Marca': 'MARCA',\n 'País': 'PAIS',\n 'Pais': 'PAIS',\n 'Producto / servicio': 'PRODUCTO_SERVICIO',\n 'Tipo de requerimiento': 'TIPO_REQUERIMIENTO',\n 'Tipo de entregable': 'TIPO_ENTREGABLE',\n 'Objetivo principal': 'OBJETIVO_PRINCIPAL',\n 'Contexto / antecedente': 'CONTEXTO_ANTECEDENTE',\n 'Audiencia objetivo': 'AUDIENCIA_OBJETIVO',\n 'Mensaje clave': 'MENSAJE_CLAVE',\n 'Entregables solicitados': 'ENTREGABLES',\n 'Canales / formatos': 'CANALES_FORMATOS',\n 'Requerimientos técnicos': 'REQUERIMIENTOS_TECNICOS',\n 'Referencias creativas o visuales': 'REFERENCIAS_VISUALES',\n 'Fechas o tiempos relevantes': 'FECHAS_TIEMPOS_RELEVANTES',\n 'Fechas / tiempos relevantes': 'FECHAS_TIEMPOS_RELEVANTES',\n 'Presupuesto': 'PRESUPUESTO',\n 'Restricciones o consideraciones especiales': 'RESTRICCIONES'\n};\n\nconst normalizedLabelMap = Object.fromEntries(\n Object.entries(labelMap).map(([label, key]) => [normalizeLabel(label), key])\n);\n\nconst info = {};\nlet currentKey = null;\n\nfor (const rawLine of infoSection.split('\\n')) {\n const line = rawLine.trim();\n if (!line) continue;\n\n const match = line.match(/^(?:[•*\\-–]\\s*)?(.+?):\\s*(.*)$/);\n\n if (match) {\n const labelCandidate = normalizeLabel(match[1]);\n const mappedKey = normalizedLabelMap[labelCandidate];\n\n if (mappedKey) {\n currentKey = mappedKey;\n info[currentKey] = match[2].trim();\n continue;\n }\n }\n\n if (currentKey) {\n info[currentKey] = [info[currentKey], line].filter(Boolean).join('\\n');\n }\n}\n\nconst CLIENTE = cleanValue(info.CLIENTE);\nconst MARCA = cleanValue(info.MARCA);\n\nfunction buildMarcaCliente(cliente, marca) {\n const c = cleanValue(cliente);\n const m = cleanValue(marca);\n\n if (c === 'No especificado' && m === 'No especificado') return 'No especificado';\n if (c === 'No especificado') return m;\n if (m === 'No especificado') return c;\n\n const nc = normalizeLabel(c);\n const nm = normalizeLabel(m);\n\n if (nc === nm) return c.length >= m.length ? c : m;\n\n if (nc.includes(nm) || nm.includes(nc)) {\n return c.length >= m.length ? c : m;\n }\n\n return `${m} / ${c}`;\n}\n\nconst MARCA_CLIENTE = buildMarcaCliente(CLIENTE, MARCA);\n\nconst fechasDetectadas = formatMultiline(info.FECHAS_TIEMPOS_RELEVANTES);\n\nconst fields = {\n ANO,\n NOMBRE_PROYECTO: cleanValue(info.NOMBRE_PROYECTO),\n CLIENTE,\n MARCA,\n MARCA_CLIENTE,\n\n PAIS: cleanValue(info.PAIS),\n RESUMEN_EJECUTIVO: sectionBetween(\n /^1\\.\\s*Resumen ejecutivo$/i,\n /^2\\.\\s*Informaci[oó]n clave del brief$/i\n ) || 'No especificado',\n\n PRODUCTO_SERVICIO: cleanValue(info.PRODUCTO_SERVICIO),\n TIPO_REQUERIMIENTO: cleanValue(info.TIPO_REQUERIMIENTO),\n TIPO_ENTREGABLE: cleanValue(info.TIPO_ENTREGABLE),\n OBJETIVO_PRINCIPAL: cleanValue(info.OBJETIVO_PRINCIPAL),\n CONTEXTO_ANTECEDENTE: cleanValue(info.CONTEXTO_ANTECEDENTE),\n AUDIENCIA_OBJETIVO: cleanValue(info.AUDIENCIA_OBJETIVO),\n MENSAJE_CLAVE: cleanValue(info.MENSAJE_CLAVE),\n\n ENTREGABLES: formatMultiline(info.ENTREGABLES),\n CANALES_FORMATOS: formatMultiline(info.CANALES_FORMATOS),\n REQUERIMIENTOS_TECNICOS: formatMultiline(info.REQUERIMIENTOS_TECNICOS),\n REFERENCIAS_VISUALES: formatMultiline(info.REFERENCIAS_VISUALES),\n\n FECHAS_TIEMPOS_RELEVANTES: buildFechasTiemposRelevantes(\n fechaEntrega,\n fechasDetectadas\n ),\n\n PRESUPUESTO: cleanValue(info.PRESUPUESTO),\n RESTRICCIONES: formatMultiline(info.RESTRICCIONES),\n\n VACIOS_DETECTADOS: bullets(\n sectionBetween(\n /^3\\.\\s*Vac[ií]os\\s+detectados$/i,\n /^4\\.\\s*Riesgos o alertas$/i\n )\n ),\n\n RIESGOS_ALERTAS: bullets(\n sectionBetween(\n /^4\\.\\s*Riesgos o alertas$/i,\n /^5\\.\\s*Recomendaciones rápidas$/i\n )\n ),\n\n RECOMENDACIONES_RAPIDAS: bullets(\n sectionBetween(\n /^5\\.\\s*Recomendaciones rápidas$/i,\n /^6\\.\\s*Nivel de completitud$/i\n )\n ),\n\n NIVEL_COMPLETITUD: completion(\n sectionBetween(\n /^6\\.\\s*Nivel de completitud$/i,\n null\n )\n ),\n\n ENLACES_REFERENCIA: support.enlacesReferenciaText || 'No se compartieron enlaces de referencia online.',\n ADJUNTOS_RECIBIDOS: support.adjuntosRecibidosText || 'No se recibieron adjuntos adicionales.'\n};\n\nconst requests = Object.entries(fields).map(([key, value]) => ({\n replaceAllText: {\n containsText: {\n text: `{{${key}}}`,\n matchCase: true,\n },\n replaceText: value,\n },\n}));\n\nreturn [\n {\n json: {\n fields,\n requests,\n },\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6464,
1968
],
"id": "828a6381-c7fc-42ae-9dc5-19f4eaa4997a",
"name": "Build Docs Requests"
},
{
"parameters": {
"method": "POST",
"url": "=https://docs.googleapis.com/v1/documents/{{ $('Copy template').first().json.id }}:batchUpdate",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDocsOAuth2Api",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"requests\": $('Build Docs Requests').first().json.requests } }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
7920,
1968
],
"id": "3509a479-303a-4c17-85f6-55e013c16c03",
"name": "HTTP Request",
"credentials": {
"googleDocsOAuth2Api": {
"id": "2bGzUIxSb9LeUeNO",
"name": "Isaac - Google Docs"
}
}
},
{
"parameters": {
"jsCode": "const f = $json.fields || {};\n\nfunction cleanPart(value, fallback = 'No especificado') {\n const text = String(value || '').trim();\n return text || fallback;\n}\n\nfunction safePart(value, fallback = 'No especificado') {\n return cleanPart(value, fallback)\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[\\\\/:*?\"<>|]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/\\s/g, '-');\n}\n\nconst ano = safePart(f.ANO);\nconst cliente = safePart(f.CLIENTE);\nconst marca = safePart(f.MARCA);\nconst pais = safePart(f.PAIS);\nconst tipoRequerimiento = safePart(f.TIPO_REQUERIMIENTO);\n\nconst baseName = [\n ano,\n cliente,\n marca,\n pais,\n tipoRequerimiento\n].join('_');\n\nreturn [\n {\n json: {\n folderName: baseName,\n docName: baseName,\n htmlName: `${baseName}.html`,\n pdfName: `${baseName}.pdf`,\n projectName: cleanPart(f.NOMBRE_PROYECTO),\n fields: f\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6736,
1968
],
"id": "76558442-4980-45e3-b10b-ff54e460a367",
"name": "Build Names"
},
{
"parameters": {
"operation": "update",
"fileId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"newUpdatedFileName": "={{ $('Build Names').first().json.folderName }}",
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
7008,
1968
],
"id": "817faaf8-cd7e-402d-8f49-3ac08ae5d5ca",
"name": "Rename folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"content": "## ENTRADA DEL FLUJO\n\n• Recibe la solicitud del frontend\n• Crea carpeta base en Google Drive\n• Esa carpeta guardará brief y adjuntos\n\nEntradas:\nvoz, imágenes, PDFs y otros archivos",
"height": 400,
"width": 304,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-384,
1760
],
"id": "6a8dbfd2-c085-462b-b74a-acf4ae3a137f",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## CLASIFICACIÓN Y ENRUTAMIENTO\n\n• Identifica tipo de entrada\n• Separa: PDF, imagen, audio, texto y otros\n• Prepara cada rama para su procesamiento\n• También detecta enlaces en texto",
"height": 512,
"width": 692,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
32,
1680
],
"id": "2d18ee42-8d9f-4852-8197-1817484cd493",
"name": "Sticky Note1"
},
{
"parameters": {
"content": "## GUARDADO DE ADJUNTOS\n\n• Guarda los archivos originales del usuario\n• Incluye PDFs, imágenes y otros soportes\n• No todos se analizan\n• Sí quedan preservados en la carpeta final",
"height": 320,
"width": 672,
"color": "#433D3D"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1856,
2512
],
"id": "4da513f7-3c45-4868-ab6f-936b24705c03",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## ANÁLISIS DE INSUMOS\n\n• PDF: se analiza con Gemini\n• Audio: se transcribe / resume\n• Imagen: se interpreta\n• Si no hay PDF, el flujo continúa\n• Cada salida se normaliza en Edit Fields",
"height": 1248,
"width": 2752,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
800,
1216
],
"id": "2c3abb00-e18c-4ee8-8acc-9fedc1945580",
"name": "Sticky Note3"
},
{
"parameters": {
"content": "## CONSOLIDACIÓN DEL CONTEXTO\n\n• Une documento, audio e imagen\n• Construye un contexto único\n• Envía todo al modelo\n• El modelo genera el brief estructurado",
"height": 576,
"width": 2000,
"color": "#9E2929"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
3840,
1760
],
"id": "d4453b92-81a3-4d13-9f1f-4e21701bcad5",
"name": "Sticky Note4"
},
{
"parameters": {
"content": "## POSTPROCESO DEL BRIEF\n\n• Limpia la salida del modelo\n• Extrae campos del brief\n• Construye placeholders\n• Genera nombres finales\n• Renombra la carpeta creada al inicio",
"height": 352,
"width": 1252
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
5952,
1776
],
"id": "a7b5c1c8-586f-4b11-8b68-b85666c39226",
"name": "Sticky Note5"
},
{
"parameters": {
"content": "## SALIDA FINAL\n\n• Copia la plantilla oficial\n• Inserta la información del brief\n• Comparte la carpeta\n• Devuelve el enlace por webhook\n• Envía el correo\n• Guarda datos relevantes\n• Crea registro en la bandeja **Nuevos** de Tablero CDC para revisión\n",
"height": 384,
"width": 3092,
"color": "#3F360C"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
7328,
1776
],
"id": "dd5f7e46-1a6b-48bd-9c0d-f82d6520208a",
"name": "Sticky Note6"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "f34e6067-5572-44ef-bac9-738212957d5c",
"leftValue": "={{ $json.pdfMissing || false }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
1168,
1488
],
"id": "85439295-64fb-427b-81d8-0637904fc43c",
"name": "If PDF missing"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "be678498-4e99-45bf-acb7-b7ade22fabb5",
"name": "fileName",
"value": "''",
"type": "string"
},
{
"id": "e9a77032-adbd-462c-bb2e-20f267496a8e",
"name": "content_summary",
"value": "No se adjuntó PDF. Continúa el flujo con audio e imagen.",
"type": "string"
},
{
"id": "bf85223a-197a-4a28-b3bf-064dc0fe8300",
"name": "type",
"value": "document",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2048,
1264
],
"id": "4977058b-764b-44eb-8886-bf115ec3697e",
"name": "PDF opcional omitido"
},
{
"parameters": {
"resource": "document",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1584,
1632
],
"id": "b4515d56-49d3-48d0-8f26-e6417440a8b5",
"name": "Analyze document",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "0b8567da-0fd5-45c3-9f4e-071036d665bb",
"name": "fileName",
"value": "={{ $json.fileName || $('Switch').item.json.fileName || '' }}",
"type": "string"
},
{
"id": "7af7edfc-6c2a-4183-ac0f-f5e16e925fff",
"name": "content_summary",
"value": "={{ $json.content?.parts?.[0]?.text || $json.content_summary || '' }}",
"type": "string"
},
{
"id": "6447843f-472f-4249-ac49-bf63ed6cb04c",
"name": "type",
"value": "document",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3088,
1456
],
"id": "4f42dd8e-c7a6-40bb-8605-0f392e4730a9",
"name": "Edit Fields documento"
},
{
"parameters": {
"jsCode": "const items = $input.all();\nreturn items;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1024,
1488
],
"id": "b320e1c6-888b-45d6-8bee-3b22e58ff6f0",
"name": "Procesar documentos"
},
{
"parameters": {
"jsCode": "const webhookItems = $('Webhook').all();\nconst out = [];\n\nlet hasPdfDocument = false;\n\nfor (const webhookItem of webhookItems) {\n const json = webhookItem.json || {};\n const body = json.body || {};\n const binary = webhookItem.binary || {};\n\n const text =\n body.text ||\n body.message ||\n body.caption ||\n body.prompt ||\n json.text ||\n json.message ||\n '';\n\n if (typeof text === 'string' && text.trim() !== '') {\n out.push({\n json: {\n type: 'text',\n text: text.trim(),\n }\n });\n }\n\n for (const key of Object.keys(binary)) {\n const file = binary[key];\n const mime = String(file.mimeType || '').toLowerCase();\n const ext = String(file.fileExtension || '').toLowerCase();\n const fileName = String(file.fileName || '').toLowerCase();\n\n let type = 'attachment_only';\n\n const isImage = mime.startsWith('image/');\n const isAudio = mime.startsWith('audio/');\n const isPdf =\n mime.includes('pdf') ||\n ext === 'pdf' ||\n fileName.endsWith('.pdf');\n\n if (isImage) {\n type = 'image';\n } else if (isAudio) {\n type = 'audio';\n } else if (isPdf) {\n type = 'pdf_document';\n hasPdfDocument = true;\n } else {\n type = 'attachment_only';\n }\n\n out.push({\n json: {\n type,\n binaryKey: key,\n mimeType: file.mimeType || '',\n fileName: file.fileName || '',\n fileExtension: file.fileExtension || '',\n fileSize: file.fileSize || '',\n },\n binary: {\n data: file\n }\n });\n }\n}\n\nif (!hasPdfDocument) {\n out.push({\n json: {\n type: 'pdf_document',\n pdfMissing: true,\n fileName: '',\n content_summary: 'No se adjuntó PDF. Continúa el flujo con audio e imagen.'\n }\n });\n}\n\nreturn out;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
320,
1968
],
"id": "50d51d78-ee89-41ee-bf75-0f3241a783ee",
"name": "Code in JavaScript"
},
{
"parameters": {
"jsCode": "const folderId = $('Create folder').first().json.id;\nconst items = $input.all();\n\nconst output = [];\n\nfor (const item of items) {\n const binaries = item.binary || {};\n\n for (const key of Object.keys(binaries)) {\n const file = binaries[key];\n\n output.push({\n json: {\n folderId,\n fileName: file.fileName || key,\n mimeType: file.mimeType || '',\n },\n binary: {\n data: file\n }\n });\n }\n}\n\nreturn output;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1920,
2672
],
"id": "0dc410a0-7e8c-4458-94df-89ee77876b6a",
"name": "Code in JavaScript3"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nif (!items.length) {\n return [{\n json: {\n combined_content: 'No se recibió contenido para resumir.'\n }\n }];\n}\n\nconst combined = items.map((item, i) => {\n const type = item.json.type || 'other';\n const fileName = item.json.fileName || '';\n const summary = item.json.content_summary || '';\n\n return [\n `Entrada ${i + 1}`,\n `Tipo: ${type}`,\n fileName ? `Archivo: ${fileName}` : null,\n `Contenido:`,\n summary\n ].filter(Boolean).join('\\n');\n}).join('\\n\\n====================\\n\\n');\n\nreturn [\n {\n json: {\n combined_content: combined\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
4352,
2032
],
"id": "a76aab4f-e205-46ff-a205-4338bc62d99f",
"name": "Code in JavaScript1"
},
{
"parameters": {
"jsCode": "const raw = $('Message a model').item.json.content.parts[0].text || '';\n\nlet formatted = raw\n .replace(/\\r\\n/g, '\\n')\n .replace(/^---$/gm, '')\n .replace(/^# (.*)$/gm, '\\n$1\\n')\n .replace(/^## (.*)$/gm, '\\n$1\\n')\n .replace(/^### (.*)$/gm, '\\n$1\\n')\n .replace(/\\*\\*(.*?)\\*\\*/g, '$1')\n .replace(/^\\*\\s+/gm, '• ')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n\nformatted = `BRIEF PROFESIONAL\\n\\n${formatted}`;\n\nreturn [\n {\n json: {\n googleDocsText: formatted\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6032,
1968
],
"id": "eabec16e-cb73-4d34-951d-85e1165c536d",
"name": "Code in JavaScript4"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1376,
1568
],
"id": "f785fec1-42f0-4493-95a3-e683b4f5fdbb",
"name": "Backup document input"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1712,
1920
],
"id": "ee47538b-26d5-48cf-8677-4c83bc97254f",
"name": "Backup audio input"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1760,
2208
],
"id": "40e893b3-01c2-462b-9490-76c06a7de717",
"name": "Backup image input"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "52ff398d-d5fa-4329-8755-03578f1f3965",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
2176,
2224
],
"id": "cfcdbe16-5fa4-428d-b0a3-6e9d9edce41f",
"name": "IF imagen gratis falló"
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2720,
2048
],
"id": "3c234eaf-a1b0-4b0a-a383-b550de21cffe",
"name": "Analyze an image - Pago",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup image input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar la imagen en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2416,
2048
],
"id": "dc2c44c3-ab42-4d25-959d-7ea30a26c4c9",
"name": "Recuperar binario imagen"
},
{
"parameters": {
"resource": "audio",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2656,
1744
],
"id": "8155eef1-4f26-4fe7-bcba-65db97a237e8",
"name": "Analyze audio - Pago",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "a0d47fed-e52c-4882-bd89-c7833b214111",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
2112,
1936
],
"id": "8cd45e47-ce95-4e59-b760-e7fa12645c06",
"name": "If audio gratis falló"
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup audio input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar el audio en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2448,
1744
],
"id": "2cb45af8-ddb0-4c66-a6cf-3f7c30914061",
"name": "Recuperar binario audio"
},
{
"parameters": {
"resource": "document",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2240,
1440
],
"id": "2575fc6e-17fc-458d-ade4-0143e1fe830b",
"name": "Analyze document - Pago",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "033b7aa0-7c40-4f6a-9056-83094b6451f0",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
1776,
1632
],
"id": "0d91d026-401c-4d56-8d77-da38b4f01b16",
"name": "IF documento gratis falló"
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup document input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar el documento en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2016,
1456
],
"id": "d2c720a2-fbe7-4948-b077-eaad28729238",
"name": "Recuperar binario documento"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"messages": {
"values": [
{
"content": "=Actúa como un asistente de inteligencia artificial especializado en interpretación y estructuración de briefs creativos, estratégicos y comerciales.\n\nTu tarea es analizar todo el contenido recibido y transformarlo en un brief profesional, claro, accionable y listo para revisión interna, edición en Google Docs y representación visual en HTML.\n\nInstrucciones de trabajo:\n\n1. Captura e interpretación\n- Lee y consolida toda la información disponible.\n- Si existe texto derivado del audio, úsalo como contexto principal.\n- Si hay documentos, imágenes o referencias visuales, intégralos como soporte complementario.\n- Extrae entidades clave, objetivos, requerimientos, restricciones, entregables, fechas, audiencias, marcas, productos y cualquier dato relevante.\n- Distingue claramente entre:\n - Tipo de requerimiento = categoría general de la solicitud.\n - Tipo de entregable = pedido específico o salida concreta esperada.\n\n2. Detección de vacíos\n- Detecta campos obligatorios ausentes.\n- Identifica detalles técnicos faltantes.\n- Señala contradicciones o inconsistencias.\n- Marca información ambigua o poco clara.\n- Advierte posibles riesgos para el desarrollo creativo, estratégico o de producción.\n\n3. Enriquecimiento y estructuración\n- Reorganiza la información y conviértela en un brief profesional con redacción clara, precisa y ejecutiva.\n- Mejora la redacción sin inventar datos no proporcionados.\n- Cuando algo no esté disponible, indícalo como “No especificado” o “Pendiente de definir”.\n- Si no existe un nombre explícito para el proyecto, genera un nombre breve y profesional usando únicamente los datos reales disponibles, sin inventar información nueva.\n\n4. Reglas importantes de salida\n- No repitas información redundante.\n- No inventes datos.\n- Prioriza claridad, orden y utilidad práctica.\n- Redacta con tono profesional y ejecutivo.\n- La salida debe sentirse como un brief listo para revisión interna.\n- Debes incluir explícitamente los campos “Nombre del proyecto”, “Cliente”, “Marca”, “País”, “Tipo de requerimiento” y “Tipo de entregable”.\n- No mezcles “Tipo de requerimiento” con “Tipo de entregable”.\n- Si cliente y marca son la misma cosa, puedes repetir el valor en ambos campos.\n- Si no puedes identificar uno de los dos, usa “No especificado”.\n\n5. Genera la salida exactamente en este formato:\n\n1. Resumen ejecutivo\n- Explica de forma breve y profesional de qué trata la solicitud, cuál es el objetivo y qué se espera desarrollar.\n\n2. Información clave del brief\n- Nombre del proyecto\n- Cliente\n- Marca\n- País\n- Producto / servicio\n- Tipo de requerimiento\n- Tipo de entregable\n- Objetivo principal\n- Contexto / antecedente\n- Audiencia objetivo\n- Mensaje clave\n- Entregables solicitados\n- Canales / formatos\n- Requerimientos técnicos\n- Referencias creativas o visuales\n- Fechas o tiempos relevantes\n- Presupuesto\n- Restricciones o consideraciones especiales\n\n3. Vacíos detectados\n- Lista clara de campos faltantes, ambiguos o contradictorios.\n\n4. Riesgos o alertas\n- Señala riesgos que puedan afectar la ejecución, creatividad, tiempos, costos o claridad del proyecto.\n\n5. Recomendaciones rápidas\n- Sugiere qué información adicional conviene completar o reforzar antes de aprobar el brief final.\n\n6. Nivel de completitud\n- Indica un porcentaje estimado de completitud del brief según la información recibida.\n\nContenido recibido:\n{{$json.combined_content}}"
}
]
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
5264,
1872
],
"id": "1eae7747-2e14-4e56-b5e8-8e33607df1b5",
"name": "Message a model - Pago",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "0ccf935c-14e8-4e1b-b7db-cb994c970733",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
5008,
2016
],
"id": "ed065304-2526-4d89-b10f-2b2c1cd7bb58",
"name": "If"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU",
"mode": "list",
"cachedResultName": "CDC Brief - Base para Fulgencio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Briefs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"fecha_creacion": "={{ $json.fecha_creacion }}",
"brief_id": "={{ $json.brief_id }}",
"nombre_carpeta": "={{ $json.nombre_carpeta }}",
"enviado_por": "={{ $json.enviado_por }}",
"correo": "={{ $json.correo }}",
"link_carpeta_drive": "={{ $json.link_carpeta_drive }}",
"link_documento_brief": "={{ $json.link_documento_brief }}",
"estado": "={{ $json.estado }}",
"cantidad_audios": "={{ $json.cantidad_audios }}",
"cantidad_imagenes": "={{ $json.cantidad_imagenes }}",
"cantidad_documentos": "={{ $json.cantidad_documentos }}",
"cantidad_links": "={{ $json.cantidad_links }}",
"resumen_chatbot": "={{ $json.resumen_chatbot }}",
"texto_brief": "={{ $json.texto_brief }}",
"texto_busqueda": "={{ $json.texto_busqueda }}",
"fecha_entrega": "={{ $('Preparar fecha de entrega').first().json.deliveryDateLabel }}"
},
"matchingColumns": [],
"schema": [
{
"id": "fecha_creacion",
"displayName": "fecha_creacion",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "brief_id",
"displayName": "brief_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "nombre_carpeta",
"displayName": "nombre_carpeta",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "enviado_por",
"displayName": "enviado_por",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "correo",
"displayName": "correo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "link_carpeta_drive",
"displayName": "link_carpeta_drive",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "link_documento_brief",
"displayName": "link_documento_brief",
"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": "cantidad_audios",
"displayName": "cantidad_audios",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_imagenes",
"displayName": "cantidad_imagenes",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_documentos",
"displayName": "cantidad_documentos",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_links",
"displayName": "cantidad_links",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "resumen_chatbot",
"displayName": "resumen_chatbot",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "texto_brief",
"displayName": "texto_brief",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "texto_busqueda",
"displayName": "texto_busqueda",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "fecha_entrega",
"displayName": "fecha_entrega",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
9456,
1968
],
"id": "154cd73e-41e1-463a-9c19-d1a44f63e7f0",
"name": "Agregar fila a Sheet Fulgencio",
"retryOnFail": false,
"alwaysOutputData": true,
"credentials": {
"googleSheetsOAuth2Api": {
"id": "K0hDZh3a85MpOHCs",
"name": "Google Sheets account 2"
}
},
"onError": "continueRegularOutput"
},
{
"parameters": {
"jsCode": "function getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction getNodeBinary(nodeName) {\n try {\n return $(nodeName).first().binary || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction cleanText(value) {\n return String(value || '')\n .replace(/\\r\\n/g, '\\n')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nfunction limitText(value, maxLength = 45000) {\n const text = String(value || '');\n return text.length > maxLength ? text.slice(0, maxLength) : text;\n}\n\nfunction parseLinks(value) {\n if (!value) return [];\n\n if (Array.isArray(value)) {\n return value.filter(Boolean).map(String);\n }\n\n return String(value)\n .split(/\\n|,|\\s+/)\n .map(link => link.trim())\n .filter(link => /^https?:\\/\\//i.test(link));\n}\n\nconst webhookItem = getNodeJson('Webhook');\nconst webhookBinary = getNodeBinary('Webhook');\n\nconst body =\n webhookItem.body && Object.keys(webhookItem.body).length\n ? webhookItem.body\n : webhookItem;\n\nconst folderNode = getNodeJson('Create folder');\nconst docNode = getNodeJson('Copy template');\nconst finalTextNode = getNodeJson('Code in JavaScript4');\nconst fechaEntregaNode = getNodeJson('Preparar fecha de entrega');\n\nconst folderId = folderNode.id || '';\nconst folderName = folderNode.name || '';\nconst docId = docNode.id || '';\n\nconst folderUrl = folderId\n ? `https://drive.google.com/drive/u/0/folders/${folderId}`\n : '';\n\nconst docUrl = docId\n ? `https://docs.google.com/document/d/${docId}/edit`\n : '';\n\nconst submittedByName =\n body.submittedByName ||\n body.displayName ||\n body.name ||\n body.email ||\n 'No especificado';\n\nconst submittedByEmail =\n body.submittedByEmail ||\n body.email ||\n 'No especificado';\n\nconst fechaEntrega =\n fechaEntregaNode.deliveryDateLabel ||\n fechaEntregaNode.fechaEntregaTexto ||\n body.deliveryDateLabel ||\n body.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst finalBriefText =\n finalTextNode.googleDocsText ||\n finalTextNode.text ||\n finalTextNode.content ||\n '';\n\nconst files = Object.values(webhookBinary || {});\n\nconst audioCount = files.filter(file =>\n String(file.mimeType || '').startsWith('audio/')\n).length;\n\nconst imageCount = files.filter(file =>\n String(file.mimeType || '').startsWith('image/')\n).length;\n\nconst documentCount = files.filter(file => {\n const mime = String(file.mimeType || '');\n return (\n mime.includes('pdf') ||\n mime.includes('word') ||\n mime.includes('excel') ||\n mime.includes('spreadsheet') ||\n mime.includes('presentation') ||\n mime.includes('powerpoint') ||\n mime.includes('officedocument')\n );\n}).length;\n\nconst links = [\n ...parseLinks(body.links),\n ...parseLinks(body.enlaces),\n ...parseLinks(body.referenceLinks),\n ...parseLinks(body.referencias),\n ...parseLinks(body.urls),\n];\n\nconst fechaCreacion = new Date().toISOString();\n\nconst resumenChatbot = cleanText(finalBriefText).slice(0, 1200);\n\nconst textoBusqueda = [\n `Brief CDC`,\n `Fecha: ${fechaCreacion}`,\n `Fecha límite de entrega: ${fechaEntrega}`,\n `Enviado por: ${submittedByName}`,\n `Correo: ${submittedByEmail}`,\n `Carpeta: ${folderUrl}`,\n `Documento: ${docUrl}`,\n `Nombre carpeta: ${folderName}`,\n '',\n finalBriefText,\n].join('\\n');\n\nreturn [\n {\n json: {\n fecha_creacion: fechaCreacion,\n brief_id: folderId || `${Date.now()}`,\n nombre_carpeta: folderName,\n enviado_por: submittedByName,\n correo: submittedByEmail,\n fecha_entrega: fechaEntrega,\n link_carpeta_drive: folderUrl,\n link_documento_brief: docUrl,\n estado: 'Nuevo',\n cantidad_audios: audioCount,\n cantidad_imagenes: imageCount,\n cantidad_documentos: documentCount,\n cantidad_links: links.length,\n resumen_chatbot: resumenChatbot,\n texto_brief: limitText(finalBriefText),\n texto_busqueda: limitText(textoBusqueda),\n },\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
9248,
1968
],
"id": "e20f24b6-dc1b-4058-8c14-c92009068e3c",
"name": "Preparar fila para Sheet Fulgencio"
},
{
"parameters": {
"jsCode": "const inputItem = $input.first();\nconst inputJson = inputItem.json || {};\n\nconst webhookJson = $('Webhook').first().json || {};\nconst body = webhookJson.body || {};\n\nfunction formatDateEs(dateString) {\n if (!dateString) return '';\n\n const value = String(dateString).trim();\n\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return value;\n }\n\n const [year, month, day] = value.split('-');\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n\n if (Number.isNaN(date.getTime())) {\n return value;\n }\n\n return date.toLocaleDateString('es-DO', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n}\n\nconst deliveryDateRaw =\n body.deliveryDate ||\n body.fechaEntrega ||\n '';\n\nconst deliveryDateStatusRaw =\n body.deliveryDateStatus ||\n body.fechaEntregaEstado ||\n '';\n\nconst deliveryDateLabelFromFrontend =\n body.deliveryDateLabel ||\n body.fechaEntregaTexto ||\n '';\n\nconst hasDate =\n deliveryDateRaw !== undefined &&\n deliveryDateRaw !== null &&\n String(deliveryDateRaw).trim() !== '';\n\nconst normalizedStatus = String(deliveryDateStatusRaw || '').toLowerCase();\nconst normalizedLabel = String(deliveryDateLabelFromFrontend || '').toLowerCase();\n\nconst isPending =\n !hasDate &&\n (\n normalizedStatus === 'pending' ||\n normalizedStatus === 'por_confirmar' ||\n normalizedStatus === 'por confirmar' ||\n normalizedLabel === 'por confirmar'\n );\n\nconst deliveryDateLabel = isPending\n ? 'Por confirmar'\n : hasDate\n ? formatDateEs(deliveryDateRaw)\n : deliveryDateLabelFromFrontend || 'Por confirmar';\n\nreturn [\n {\n json: {\n ...inputJson,\n deliveryDateRaw,\n deliveryDateStatus: isPending ? 'pending' : 'defined',\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n fechaEntregaEstado: isPending ? 'por_confirmar' : 'definida',\n },\n binary: inputItem.binary,\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
112,
1968
],
"id": "2d61e16e-61bd-494e-a73e-d24605112564",
"name": "Preparar fecha de entrega"
},
{
"parameters": {
"jsCode": "const item = $input.first();\nconst json = item.json || {};\n\nconst fechaNode = $('Preparar fecha de entrega').first().json || {};\n\nconst deliveryDateLabel =\n fechaNode.deliveryDateLabel ||\n fechaNode.fechaEntregaTexto ||\n json.deliveryDateLabel ||\n json.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst deliveryLine = `• Fecha límite de entrega: ${deliveryDateLabel}.`;\n\nlet googleDocsText = json.googleDocsText || '';\n\nif (!googleDocsText) {\n return [\n {\n json: {\n ...json,\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n },\n binary: item.binary,\n },\n ];\n}\n\n// Evita duplicar la fecha si el nodo se ejecuta más de una vez\ngoogleDocsText = googleDocsText.replace(\n /^\\s*[•-]?\\s*Fecha límite de entrega:.*$/gim,\n ''\n);\n\n// Inserta la fecha justo debajo de \"Fechas / tiempos relevantes\"\nconst fechasHeadingRegex = /(Fechas\\s*\\/\\s*tiempos\\s+relevantes\\s*:?\\s*)/i;\n\nif (fechasHeadingRegex.test(googleDocsText)) {\n googleDocsText = googleDocsText.replace(\n fechasHeadingRegex,\n `$1\\n${deliveryLine}\\n`\n );\n} else {\n // Si por alguna razón la sección no aparece, la agrega al final\n googleDocsText += `\\n\\nFechas / tiempos relevantes\\n${deliveryLine}`;\n}\n\n// Limpieza básica de saltos de línea excesivos\ngoogleDocsText = googleDocsText\n .replace(/\\n{4,}/g, '\\n\\n\\n')\n .trim();\n\nreturn [\n {\n json: {\n ...json,\n googleDocsText,\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n },\n binary: item.binary,\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6240,
1968
],
"id": "685fbfcf-3f6d-4cda-85bd-9343bdb0420e",
"name": "Agregar fecha al Google Doc"
},
{
"parameters": {
"method": "POST",
"url": "https://dbit.digitalcompass.agency/rest/v1/cdc_briefs_fulgencio?on_conflict=brief_id",
"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"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates,return=representation"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\n brief_id: $json.brief_id,\n fecha_creacion: $json.fecha_creacion,\n nombre_carpeta: $json.nombre_carpeta,\n enviado_por: $json.enviado_por,\n correo: $json.correo,\n link_carpeta_drive: $json.link_carpeta_drive,\n link_documento_brief: $json.link_documento_brief,\n estado: $json.estado,\n cantidad_audios: Number($json.cantidad_audios || 0),\n cantidad_imagenes: Number($json.cantidad_imagenes || 0),\n cantidad_documentos: Number($json.cantidad_documentos || 0),\n cantidad_links: Number($json.cantidad_links || 0),\n resumen_chatbot: $json.resumen_chatbot,\n texto_brief: $json.texto_brief,\n texto_busqueda: $json.texto_busqueda,\n fecha_entrega: $json.fecha_entrega\n} }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
9696,
1968
],
"id": "125ba086-7f5f-4913-b3b8-0f8884061c64",
"name": "Guardar brief en Supabase",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 2000
},
{
"parameters": {
"jsCode": "function getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction clean(value, fallback = '') {\n const text = String(value ?? '').trim();\n return text || fallback;\n}\n\nconst brief = getNodeJson('Preparar fila para Sheet Fulgencio');\nconst docs = getNodeJson('Build Docs Requests');\nconst fields = docs.fields || {};\n\nconst title = clean(fields.NOMBRE_PROYECTO, clean(brief.nombre_carpeta, `Brief CDC ${brief.brief_id || ''}`));\n\nreturn [\n {\n json: {\n brief_id: clean(brief.brief_id),\n source_created_at: brief.fecha_creacion || new Date().toISOString(),\n title,\n client: clean(fields.CLIENTE),\n brand: clean(fields.MARCA),\n country: clean(fields.PAIS),\n requested_by: clean(brief.enviado_por),\n requested_by_email: clean(brief.correo),\n delivery_date: clean(brief.fecha_entrega),\n brief_link: clean(brief.link_carpeta_drive),\n document_link: clean(brief.link_documento_brief),\n summary: clean(fields.RESUMEN_EJECUTIVO, clean(brief.resumen_chatbot)),\n request_type: clean(fields.TIPO_REQUERIMIENTO),\n deliverable_type: clean(fields.TIPO_ENTREGABLE),\n raw_fields: fields,\n review_status: 'new'\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
9936,
1968
],
"id": "30c70065-27cd-489f-b1de-3980cdbba939",
"name": "Preparar bandeja Nuevos Tablero CDC"
},
{
"parameters": {
"method": "POST",
"url": "https://dbit.digitalcompass.agency/rest/v1/tablero_cdc_brief_inbox?on_conflict=brief_id",
"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"
},
{
"name": "Prefer",
"value": "resolution=ignore-duplicates,return=representation"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\n brief_id: $json.brief_id,\n source_created_at: $json.source_created_at,\n title: $json.title,\n client: $json.client,\n brand: $json.brand,\n country: $json.country,\n requested_by: $json.requested_by,\n requested_by_email: $json.requested_by_email,\n delivery_date: $json.delivery_date,\n brief_link: $json.brief_link,\n document_link: $json.document_link,\n summary: $json.summary,\n request_type: $json.request_type,\n deliverable_type: $json.deliverable_type,\n raw_fields: $json.raw_fields,\n review_status: 'new'\n} }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
10192,
1968
],
"id": "5706f51f-ef4b-45da-a088-aefe5cefd26f",
"name": "Guardar en Nuevos Tablero CDC",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 2000,
"onError": "continueRegularOutput"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Create folder",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Procesar documentos",
"type": "main",
"index": 0
}
],
[
{
"node": "Backup image input",
"type": "main",
"index": 0
}
],
[],
[
{
"node": "Backup audio input",
"type": "main",
"index": 0
}
]
]
},
"Analyze audio": {
"main": [
[
{
"node": "If audio gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Analyze an image": {
"main": [
[
{
"node": "IF imagen gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Create folder": {
"main": [
[
{
"node": "Preparar fecha de entrega",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Share folder": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Respond to Webhook": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Copy template": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Build Docs Requests": {
"main": [
[
{
"node": "Build Names",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Share folder",
"type": "main",
"index": 0
}
]
]
},
"Build Names": {
"main": [
[
{
"node": "Rename folder",
"type": "main",
"index": 0
}
]
]
},
"Rename folder": {
"main": [
[
{
"node": "Copy template",
"type": "main",
"index": 0
}
]
]
},
"If PDF missing": {
"main": [
[
{
"node": "PDF opcional omitido",
"type": "main",
"index": 0
}
],
[
{
"node": "Backup document input",
"type": "main",
"index": 0
}
]
]
},
"Analyze document": {
"main": [
[
{
"node": "IF documento gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields documento": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"PDF opcional omitido": {
"main": [
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"Procesar documentos": {
"main": [
[
{
"node": "If PDF missing",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Code in JavaScript3",
"type": "main",
"index": 0
},
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript3": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript4": {
"main": [
[
{
"node": "Agregar fecha al Google Doc",
"type": "main",
"index": 0
}
]
]
},
"Backup document input": {
"main": [
[
{
"node": "Analyze document",
"type": "main",
"index": 0
}
]
]
},
"Backup audio input": {
"main": [
[
{
"node": "Analyze audio",
"type": "main",
"index": 0
}
]
]
},
"Backup image input": {
"main": [
[
{
"node": "Analyze an image",
"type": "main",
"index": 0
}
]
]
},
"IF imagen gratis falló": {
"main": [
[
{
"node": "Recuperar binario imagen",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario imagen": {
"main": [
[
{
"node": "Analyze an image - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze an image - Pago": {
"main": [
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"If audio gratis falló": {
"main": [
[
{
"node": "Recuperar binario audio",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario audio": {
"main": [
[
{
"node": "Analyze audio - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze audio - Pago": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"IF documento gratis falló": {
"main": [
[
{
"node": "Recuperar binario documento",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario documento": {
"main": [
[
{
"node": "Analyze document - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze document - Pago": {
"main": [
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Message a model - Pago",
"type": "main",
"index": 0
}
],
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Message a model - Pago": {
"main": [
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "Preparar fila para Sheet Fulgencio",
"type": "main",
"index": 0
}
]
]
},
"Preparar fila para Sheet Fulgencio": {
"main": [
[
{
"node": "Agregar fila a Sheet Fulgencio",
"type": "main",
"index": 0
}
]
]
},
"Preparar fecha de entrega": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Agregar fecha al Google Doc": {
"main": [
[
{
"node": "Build Docs Requests",
"type": "main",
"index": 0
}
]
]
},
"Agregar fila a Sheet Fulgencio": {
"main": [
[
{
"node": "Guardar brief en Supabase",
"type": "main",
"index": 0
}
]
]
},
"Guardar brief en Supabase": {
"main": [
[
{
"node": "Preparar bandeja Nuevos Tablero CDC",
"type": "main",
"index": 0
}
]
]
},
"Preparar bandeja Nuevos Tablero CDC": {
"main": [
[
{
"node": "Guardar en Nuevos Tablero CDC",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"timeSavedMode": "fixed",
"errorWorkflow": "puF4LUczoSz3hcek",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": true,
"timezone": "America/Santo_Domingo"
},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"versionId": "9dbf4877-d8d8-420d-9bb0-b147b948d992",
"activeVersionId": "9dbf4877-d8d8-420d-9bb0-b147b948d992",
"versionCounter": 336,
"triggerCount": 1,
"shared": [
{
"updatedAt": "2026-05-25T16:49:10.432Z",
"createdAt": "2026-05-25T16:49:10.432Z",
"role": "workflow:owner",
"workflowId": "Z8W67i7RfrhXRDFQ",
"projectId": "PJpTANzTXIFibWsW",
"project": {
"updatedAt": "2026-04-22T14:25:09.686Z",
"createdAt": "2026-04-22T14:22:54.790Z",
"id": "PJpTANzTXIFibWsW",
"name": "Isaac Aracena ",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-08-22T15:30:00.000Z",
"createdAt": "2026-08-22T15:29:56.163Z",
"versionId": "9dbf4877-d8d8-420d-9bb0-b147b948d992",
"workflowId": "Z8W67i7RfrhXRDFQ",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "cdc-brief-test-metadata",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-368,
1968
],
"id": "994ac5cd-c6b0-4d9d-ae66-7b0a00eb925e",
"name": "Webhook",
"webhookId": "0459b7fe-a6fc-47cb-bcf1-afadb9587124"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"leftValue": "={{$json.type}} ",
"rightValue": "pdf_document",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "19494f94-55a5-4849-bdc0-e056140e371d"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "PDF"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "9c4aa96c-5b3c-46bb-a2f7-a10da4c807be",
"leftValue": "={{$json.type}}",
"rightValue": "image",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Imagen"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "3d1a3c24-4fe2-4239-9b64-2a33c3043fb0",
"leftValue": "={{$('Code in JavaScript').item.json.type}}",
"rightValue": "video",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Video"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "29941bad-2e02-4c26-bccb-115fbb2c4b57",
"leftValue": "={{$json.type}}",
"rightValue": "audio",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Audio"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "8ff5d5cf-26e7-4516-a154-0d7fa8855012",
"leftValue": "={{$json.type}}",
"rightValue": "text",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Texto"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "437f4ff8-8556-4f8f-b935-a55eda65afde",
"leftValue": "={{$json.type}}",
"rightValue": "other",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "other"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
496,
1856
],
"id": "3b794f04-2e45-4b84-8efc-e958fa4f69f6",
"name": "Switch"
},
{
"parameters": {
"resource": "audio",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1936,
1968
],
"id": "cd64ea3f-59a2-4003-9f25-ce2978099e81",
"name": "Analyze audio",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"numberInputs": 3
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
4192,
2016
],
"id": "9a3e4c8a-1bd4-463a-848b-3123c262dc56",
"name": "Merge"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"messages": {
"values": [
{
"content": "=Actúa como un asistente de inteligencia artificial especializado en interpretación y estructuración de briefs creativos, estratégicos y comerciales.\n\nTu tarea es analizar todo el contenido recibido y transformarlo en un brief profesional, claro, accionable y listo para revisión interna, edición en Google Docs y representación visual en HTML.\n\nInstrucciones de trabajo:\n\n1. Captura e interpretación\n- Lee y consolida toda la información disponible.\n- Si existe texto derivado del audio, úsalo como contexto principal.\n- Si hay documentos, imágenes o referencias visuales, intégralos como soporte complementario.\n- Extrae entidades clave, objetivos, requerimientos, restricciones, entregables, fechas, audiencias, marcas, productos y cualquier dato relevante.\n- Distingue claramente entre:\n - Tipo de requerimiento = categoría general de la solicitud.\n - Tipo de entregable = pedido específico o salida concreta esperada.\n\n2. Detección de vacíos\n- Detecta campos obligatorios ausentes.\n- Identifica detalles técnicos faltantes.\n- Señala contradicciones o inconsistencias.\n- Marca información ambigua o poco clara.\n- Advierte posibles riesgos para el desarrollo creativo, estratégico o de producción.\n\n3. Enriquecimiento y estructuración\n- Reorganiza la información y conviértela en un brief profesional con redacción clara, precisa y ejecutiva.\n- Mejora la redacción sin inventar datos no proporcionados.\n- Cuando algo no esté disponible, indícalo como “No especificado” o “Pendiente de definir”.\n- Si no existe un nombre explícito para el proyecto, genera un nombre breve y profesional usando únicamente los datos reales disponibles, sin inventar información nueva.\n\n4. Reglas importantes de salida\n- No repitas información redundante.\n- No inventes datos.\n- Prioriza claridad, orden y utilidad práctica.\n- Redacta con tono profesional y ejecutivo.\n- La salida debe sentirse como un brief listo para revisión interna.\n- Debes incluir explícitamente los campos “Nombre del proyecto”, “Cliente”, “Marca”, “País”, “Tipo de requerimiento” y “Tipo de entregable”.\n- No mezcles “Tipo de requerimiento” con “Tipo de entregable”.\n- Si cliente y marca son la misma cosa, puedes repetir el valor en ambos campos.\n- Si no puedes identificar uno de los dos, usa “No especificado”.\n\n5. Genera la salida exactamente en este formato:\n\n1. Resumen ejecutivo\n- Explica de forma breve y profesional de qué trata la solicitud, cuál es el objetivo y qué se espera desarrollar.\n\n2. Información clave del brief\n- Nombre del proyecto\n- Cliente\n- Marca\n- País\n- Producto / servicio\n- Tipo de requerimiento\n- Tipo de entregable\n- Objetivo principal\n- Contexto / antecedente\n- Audiencia objetivo\n- Mensaje clave\n- Entregables solicitados\n- Canales / formatos\n- Requerimientos técnicos\n- Referencias creativas o visuales\n- Fechas o tiempos relevantes\n- Presupuesto\n- Restricciones o consideraciones especiales\n\n3. Vacíos detectados\n- Lista clara de campos faltantes, ambiguos o contradictorios.\n\n4. Riesgos o alertas\n- Señala riesgos que puedan afectar la ejecución, creatividad, tiempos, costos o claridad del proyecto.\n\n5. Recomendaciones rápidas\n- Sugiere qué información adicional conviene completar o reforzar antes de aprobar el brief final.\n\n6. Nivel de completitud\n- Indica un porcentaje estimado de completitud del brief según la información recibida.\n\nContenido recibido:\n{{$json.combined_content}}"
}
]
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
4576,
2032
],
"id": "98e329ae-a5b6-4fd4-8635-0495610505a5",
"name": "Message a model",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "ddc91110-0c3b-4ee7-a973-322a3d1c7c1e",
"name": "type",
"value": "audio",
"type": "string"
},
{
"id": "b667804d-e4b9-4225-9a6e-01d54067f0cf",
"name": "fileName",
"value": "={{$json.fileName || ''}}",
"type": "string"
},
{
"id": "4023fd4f-95ce-4571-845b-c7555c4efc88",
"name": "content_summary",
"value": "={{ $json.content.parts[0].text || '' }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3024,
1952
],
"id": "38dfbff8-21c0-4a70-ac44-956f159d9da2",
"name": "Edit Fields1"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "=Este es el enlace al folder con el contenido del brief:\n\nhttps://drive.google.com/drive/u/0/folders/{{ $('Create folder').first().json.id }}\n\nEn caso de algún vacío detectado, favor de ingresar al link y modificar el archivo.\n\nVacíos detectados:\n\n{{ $('Build Docs Requests').first().json.fields.VACIOS_DETECTADOS || \"Ninguno\" }}",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
8656,
1968
],
"id": "d18bbc77-a828-45be-a6fc-42467125d998",
"name": "Respond to Webhook"
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1952,
2208
],
"id": "8f9a565d-f651-4a91-8ed3-f95fe169e938",
"name": "Analyze an image",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"resource": "folder",
"name": "=Brief {{$now}}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-208,
1968
],
"id": "b33ae2d5-2c77-4aa4-92dc-e995bedd8f14",
"name": "Create folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "738bec56-f577-41da-a35f-dc8346893e10",
"name": "fileName",
"value": "={{ $('Switch').item.json.fileName || '' }}",
"type": "string"
},
{
"id": "6df83b75-7e13-48db-a557-7ee85c52a2b2",
"name": "content_summary",
"value": "={{ $json.content?.parts?.[0]?.text || 'Imagen adjunta por el usuario. No se pudo generar una descripción automática en este intento.' }}",
"type": "string"
},
{
"id": "1a1db20c-3dd7-4776-9d97-46bd31213a87",
"name": "type",
"value": "image",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3216,
2240
],
"id": "a278966c-83be-4307-a174-8b00f03f615a",
"name": "Edit Fields2"
},
{
"parameters": {
"resource": "folder",
"operation": "share",
"folderNoRootId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"permissionsUi": {
"permissionsValues": {
"role": "writer",
"type": "domain",
"domain": "gomezleemarketing.com"
}
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
8240,
1968
],
"id": "5273482f-4212-4ec6-8205-f8eda6293307",
"name": "Share folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"name": "={{ $json.fileName }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "={{ $json.folderId }}",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
2336,
2672
],
"id": "21ea562d-9720-4e54-9465-2cc899e169e8",
"name": "Upload file",
"executeOnce": false,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"sendTo": "areyes@gomezleemarketing.com, boliva@gomezleemarketing.com",
"subject": "✏️ Nuevo Brief",
"message": "=\n\n\n \n \n Nuevo brief · GomezLee Marketing\n\n\n\n\n Nuevo brief creado por {{ $('Webhook').first().json.body.submittedByName || 'No especificado' }} ·\n {{ $('Build Docs Requests').first().json.fields.NOMBRE_PROYECTO || 'CDC Brief' }}\n\n \n \n \n
\n\n\n \n \n\n \n\n \n | \n \n | \n \n\n \n \n \n | \n \n\n \n | \n \n \n \n | \n \n\n \n | \n \n Nuevo brief\n \n\n \n Se ha creado un nuevo brief.\n \n | \n \n\n \n | \n \n Hola Thaía,\n \n\n \n Se ha generado un nuevo brief en\n CDC Brief\n y ya está disponible para revisión.\n \n | \n \n\n \n \n \n \n | \n \n Proyecto\n \n\n \n {{ $('Build Docs Requests').first().json.fields.NOMBRE_PROYECTO || 'Brief sin nombre especificado' }}\n \n | \n \n \n | \n \n\n \n \n | \n\n \n\n \n La carpeta contiene el documento generado y los archivos asociados al envío.\n \n\n | \n \n\n \n | \n \n Datos del envío\n \n | \n \n\n \n \n \n \n | \n Enviado por\n | \n \n {{ $('Webhook').first().json.body.submittedByName || 'No especificado' }}\n | \n \n\n \n | \n Correo\n | \n \n \n {{ $('Webhook').first().json.body.submittedByEmail || 'No especificado' }}\n \n | \n \n\n \n | \n Fecha límite\n | \n \n {{\n $('Preparar fecha de entrega').first().json.deliveryDateLabel\n || $('Preparar fecha de entrega').first().json.fechaEntregaTexto\n || $('Webhook').first().json.body.deliveryDateLabel\n || $('Webhook').first().json.body.fechaEntregaTexto\n || 'Por confirmar'\n }}\n | \n \n\n \n | \n Cliente / marca\n | \n \n {{ $('Build Docs Requests').first().json.fields.MARCA_CLIENTE || 'No especificado' }}\n | \n \n \n | \n \n\n \n \n \n \n | \n \n Brief listo para revisión\n \n\n \n Si necesitas completar o corregir información, puedes hacerlo directamente desde el documento ubicado en la carpeta.\n \n | \n \n \n | \n \n\n \n | \n \n Gracias,\n \n\n \n CDC Brief · GomezLee Marketing\n \n | \n \n\n \n | \n
\n
\n\n\n",
"options": {
"appendAttribution": false,
"senderName": "📢 HEY"
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
9008,
1968
],
"id": "2064ba9f-08ae-4dab-9596-4a449f044e10",
"name": "Send a message",
"webhookId": "2a920b9f-c697-4a4e-9c69-0bf0749c2661",
"credentials": {
"gmailOAuth2": {
"id": "cehQBe6X1BQLmcD9",
"name": "Gmail account - Isaac"
}
}
},
{
"parameters": {
"operation": "copy",
"fileId": {
"__rl": true,
"value": "1UuCLClREoC_9OvT407B36nHJ1x4l418Q0dEwgGccws4",
"mode": "list",
"cachedResultName": "CDC_Brief_GLM_V2",
"cachedResultUrl": "https://docs.google.com/document/d/1UuCLClREoC_9OvT407B36nHJ1x4l418Q0dEwgGccws4/edit?usp=drivesdk"
},
"name": "={{ $('Build Names').first().json.docName }}",
"sameFolder": false,
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
7568,
1968
],
"id": "99a29233-ca5d-45a8-80ff-4471497402d3",
"name": "Copy template",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"jsCode": "const text = String($json.googleDocsText || '').replace(/\\r\\n/g, '\\n').trim();\nconst ANO = String(new Date().getFullYear());\n\nconst baseItems = $('Code in JavaScript').all();\n\nconst urlRegex = /https?:\\/\\/[^\\s<>\"')]+/gi;\nconst linksSet = new Set();\nconst attachmentsSet = new Set();\n\nfor (const item of baseItems) {\n const json = item.json || {};\n\n const textValue = String(json.text || '').trim();\n const matches = textValue.match(urlRegex) || [];\n for (const url of matches) {\n linksSet.add(url);\n }\n\n const fileName = String(json.fileName || '').trim();\n if (fileName) {\n attachmentsSet.add(fileName);\n }\n}\n\nconst support = {\n enlacesReferenciaText: linksSet.size\n ? Array.from(linksSet).map(url => `• ${url}`).join('\\n')\n : 'No se compartieron enlaces de referencia online.',\n\n adjuntosRecibidosText: attachmentsSet.size\n ? Array.from(attachmentsSet).map(name => `• ${name}`).join('\\n')\n : 'No se recibieron adjuntos adicionales.'\n};\n\nfunction getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction sectionBetween(startRe, endRe) {\n const lines = text.split('\\n');\n let start = -1;\n let end = lines.length;\n\n for (let i = 0; i < lines.length; i++) {\n if (startRe.test(lines[i].trim())) {\n start = i + 1;\n break;\n }\n }\n\n if (start === -1) return '';\n\n if (endRe) {\n for (let i = start; i < lines.length; i++) {\n if (endRe.test(lines[i].trim())) {\n end = i;\n break;\n }\n }\n }\n\n return lines.slice(start, end).join('\\n').trim();\n}\n\nfunction normalizeLabel(str) {\n return String(str || '')\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nfunction cleanValue(value, fallback = 'No especificado') {\n const lines = String(value || '')\n .split('\\n')\n .map(line => line.trim())\n .filter(Boolean);\n\n return lines.length ? lines.join('\\n') : fallback;\n}\n\nfunction formatMultiline(value, fallback = 'No especificado') {\n const lines = String(value || '')\n .split('\\n')\n .map(line => line.trim())\n .filter(Boolean);\n\n if (!lines.length) return fallback;\n\n return lines\n .map(line => {\n if (/^[•*\\-–]\\s*/.test(line)) {\n return `• ${line.replace(/^[•*\\-–]\\s*/, '').trim()}`;\n }\n return line;\n })\n .join('\\n');\n}\n\nfunction bullets(sectionText, fallback = 'No especificado') {\n const items = String(sectionText || '')\n .split('\\n')\n .map(line => line.replace(/^\\s*[•*\\-–]\\s*/, '').trim())\n .filter(Boolean);\n\n if (!items.length) return fallback;\n\n return items.map(item => `• ${item}`).join('\\n');\n}\n\nfunction completion(sectionText) {\n const match = String(sectionText || '').match(/(\\d{1,3}\\s*%)/);\n if (match) return match[1].replace(/\\s+/g, '');\n\n const cleaned = String(sectionText || '').trim();\n return cleaned || 'No especificado';\n}\n\nfunction buildFechasTiemposRelevantes(fechaEntrega, fechasDetectadas) {\n const fecha = String(fechaEntrega || '').trim() || 'Por confirmar';\n const fechas = String(fechasDetectadas || '').trim();\n\n const entregaLine = `• Fecha límite de entrega: ${fecha}.`;\n\n const fechasNormalizadas = normalizeLabel(fechas)\n .replace(/[.:;]+$/g, '')\n .trim();\n\n const noHayFechasDetectadas =\n !fechas ||\n fechasNormalizadas === 'no especificado' ||\n fechasNormalizadas === 'no especificada' ||\n fechasNormalizadas === 'no se especifico' ||\n fechasNormalizadas === 'no se especifica' ||\n fechasNormalizadas === 'no indicado' ||\n fechasNormalizadas === 'no indicada';\n\n if (noHayFechasDetectadas) {\n return entregaLine;\n }\n\n return `${entregaLine}\\n${fechas}`;\n}\n\nconst fechaEntregaNode = getNodeJson('Preparar fecha de entrega');\n\nconst fechaEntrega =\n fechaEntregaNode.deliveryDateLabel ||\n fechaEntregaNode.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst infoSection = sectionBetween(\n /^2\\.\\s*Informaci[oó]n clave del brief$/i,\n /^3\\.\\s*Vac[ií]os\\s+detectados$/i\n);\n\nconst labelMap = {\n 'Nombre del proyecto': 'NOMBRE_PROYECTO',\n 'Cliente': 'CLIENTE',\n 'Marca': 'MARCA',\n 'País': 'PAIS',\n 'Pais': 'PAIS',\n 'Producto / servicio': 'PRODUCTO_SERVICIO',\n 'Tipo de requerimiento': 'TIPO_REQUERIMIENTO',\n 'Tipo de entregable': 'TIPO_ENTREGABLE',\n 'Objetivo principal': 'OBJETIVO_PRINCIPAL',\n 'Contexto / antecedente': 'CONTEXTO_ANTECEDENTE',\n 'Audiencia objetivo': 'AUDIENCIA_OBJETIVO',\n 'Mensaje clave': 'MENSAJE_CLAVE',\n 'Entregables solicitados': 'ENTREGABLES',\n 'Canales / formatos': 'CANALES_FORMATOS',\n 'Requerimientos técnicos': 'REQUERIMIENTOS_TECNICOS',\n 'Referencias creativas o visuales': 'REFERENCIAS_VISUALES',\n 'Fechas o tiempos relevantes': 'FECHAS_TIEMPOS_RELEVANTES',\n 'Fechas / tiempos relevantes': 'FECHAS_TIEMPOS_RELEVANTES',\n 'Presupuesto': 'PRESUPUESTO',\n 'Restricciones o consideraciones especiales': 'RESTRICCIONES'\n};\n\nconst normalizedLabelMap = Object.fromEntries(\n Object.entries(labelMap).map(([label, key]) => [normalizeLabel(label), key])\n);\n\nconst info = {};\nlet currentKey = null;\n\nfor (const rawLine of infoSection.split('\\n')) {\n const line = rawLine.trim();\n if (!line) continue;\n\n const match = line.match(/^(?:[•*\\-–]\\s*)?(.+?):\\s*(.*)$/);\n\n if (match) {\n const labelCandidate = normalizeLabel(match[1]);\n const mappedKey = normalizedLabelMap[labelCandidate];\n\n if (mappedKey) {\n currentKey = mappedKey;\n info[currentKey] = match[2].trim();\n continue;\n }\n }\n\n if (currentKey) {\n info[currentKey] = [info[currentKey], line].filter(Boolean).join('\\n');\n }\n}\n\nconst CLIENTE = cleanValue(info.CLIENTE);\nconst MARCA = cleanValue(info.MARCA);\n\nfunction buildMarcaCliente(cliente, marca) {\n const c = cleanValue(cliente);\n const m = cleanValue(marca);\n\n if (c === 'No especificado' && m === 'No especificado') return 'No especificado';\n if (c === 'No especificado') return m;\n if (m === 'No especificado') return c;\n\n const nc = normalizeLabel(c);\n const nm = normalizeLabel(m);\n\n if (nc === nm) return c.length >= m.length ? c : m;\n\n if (nc.includes(nm) || nm.includes(nc)) {\n return c.length >= m.length ? c : m;\n }\n\n return `${m} / ${c}`;\n}\n\nconst MARCA_CLIENTE = buildMarcaCliente(CLIENTE, MARCA);\n\nconst fechasDetectadas = formatMultiline(info.FECHAS_TIEMPOS_RELEVANTES);\n\nconst fields = {\n ANO,\n NOMBRE_PROYECTO: cleanValue(info.NOMBRE_PROYECTO),\n CLIENTE,\n MARCA,\n MARCA_CLIENTE,\n\n PAIS: cleanValue(info.PAIS),\n RESUMEN_EJECUTIVO: sectionBetween(\n /^1\\.\\s*Resumen ejecutivo$/i,\n /^2\\.\\s*Informaci[oó]n clave del brief$/i\n ) || 'No especificado',\n\n PRODUCTO_SERVICIO: cleanValue(info.PRODUCTO_SERVICIO),\n TIPO_REQUERIMIENTO: cleanValue(info.TIPO_REQUERIMIENTO),\n TIPO_ENTREGABLE: cleanValue(info.TIPO_ENTREGABLE),\n OBJETIVO_PRINCIPAL: cleanValue(info.OBJETIVO_PRINCIPAL),\n CONTEXTO_ANTECEDENTE: cleanValue(info.CONTEXTO_ANTECEDENTE),\n AUDIENCIA_OBJETIVO: cleanValue(info.AUDIENCIA_OBJETIVO),\n MENSAJE_CLAVE: cleanValue(info.MENSAJE_CLAVE),\n\n ENTREGABLES: formatMultiline(info.ENTREGABLES),\n CANALES_FORMATOS: formatMultiline(info.CANALES_FORMATOS),\n REQUERIMIENTOS_TECNICOS: formatMultiline(info.REQUERIMIENTOS_TECNICOS),\n REFERENCIAS_VISUALES: formatMultiline(info.REFERENCIAS_VISUALES),\n\n FECHAS_TIEMPOS_RELEVANTES: buildFechasTiemposRelevantes(\n fechaEntrega,\n fechasDetectadas\n ),\n\n PRESUPUESTO: cleanValue(info.PRESUPUESTO),\n RESTRICCIONES: formatMultiline(info.RESTRICCIONES),\n\n VACIOS_DETECTADOS: bullets(\n sectionBetween(\n /^3\\.\\s*Vac[ií]os\\s+detectados$/i,\n /^4\\.\\s*Riesgos o alertas$/i\n )\n ),\n\n RIESGOS_ALERTAS: bullets(\n sectionBetween(\n /^4\\.\\s*Riesgos o alertas$/i,\n /^5\\.\\s*Recomendaciones rápidas$/i\n )\n ),\n\n RECOMENDACIONES_RAPIDAS: bullets(\n sectionBetween(\n /^5\\.\\s*Recomendaciones rápidas$/i,\n /^6\\.\\s*Nivel de completitud$/i\n )\n ),\n\n NIVEL_COMPLETITUD: completion(\n sectionBetween(\n /^6\\.\\s*Nivel de completitud$/i,\n null\n )\n ),\n\n ENLACES_REFERENCIA: support.enlacesReferenciaText || 'No se compartieron enlaces de referencia online.',\n ADJUNTOS_RECIBIDOS: support.adjuntosRecibidosText || 'No se recibieron adjuntos adicionales.'\n};\n\nconst requests = Object.entries(fields).map(([key, value]) => ({\n replaceAllText: {\n containsText: {\n text: `{{${key}}}`,\n matchCase: true,\n },\n replaceText: value,\n },\n}));\n\nreturn [\n {\n json: {\n fields,\n requests,\n },\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6464,
1968
],
"id": "828a6381-c7fc-42ae-9dc5-19f4eaa4997a",
"name": "Build Docs Requests"
},
{
"parameters": {
"method": "POST",
"url": "=https://docs.googleapis.com/v1/documents/{{ $('Copy template').first().json.id }}:batchUpdate",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDocsOAuth2Api",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"requests\": $('Build Docs Requests').first().json.requests } }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
7920,
1968
],
"id": "3509a479-303a-4c17-85f6-55e013c16c03",
"name": "HTTP Request",
"credentials": {
"googleDocsOAuth2Api": {
"id": "2bGzUIxSb9LeUeNO",
"name": "Isaac - Google Docs"
}
}
},
{
"parameters": {
"jsCode": "const f = $json.fields || {};\n\nfunction cleanPart(value, fallback = 'No especificado') {\n const text = String(value || '').trim();\n return text || fallback;\n}\n\nfunction safePart(value, fallback = 'No especificado') {\n return cleanPart(value, fallback)\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[\\\\/:*?\"<>|]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/\\s/g, '-');\n}\n\nconst ano = safePart(f.ANO);\nconst cliente = safePart(f.CLIENTE);\nconst marca = safePart(f.MARCA);\nconst pais = safePart(f.PAIS);\nconst tipoRequerimiento = safePart(f.TIPO_REQUERIMIENTO);\n\nconst baseName = [\n ano,\n cliente,\n marca,\n pais,\n tipoRequerimiento\n].join('_');\n\nreturn [\n {\n json: {\n folderName: baseName,\n docName: baseName,\n htmlName: `${baseName}.html`,\n pdfName: `${baseName}.pdf`,\n projectName: cleanPart(f.NOMBRE_PROYECTO),\n fields: f\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6736,
1968
],
"id": "76558442-4980-45e3-b10b-ff54e460a367",
"name": "Build Names"
},
{
"parameters": {
"operation": "update",
"fileId": {
"__rl": true,
"value": "={{ $('Create folder').first().json.id }}",
"mode": "id"
},
"newUpdatedFileName": "={{ $('Build Names').first().json.folderName }}",
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
7008,
1968
],
"id": "817faaf8-cd7e-402d-8f49-3ac08ae5d5ca",
"name": "Rename folder",
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
}
},
{
"parameters": {
"content": "## ENTRADA DEL FLUJO\n\n• Recibe la solicitud del frontend\n• Crea carpeta base en Google Drive\n• Esa carpeta guardará brief y adjuntos\n\nEntradas:\nvoz, imágenes, PDFs y otros archivos",
"height": 400,
"width": 304,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-384,
1760
],
"id": "6a8dbfd2-c085-462b-b74a-acf4ae3a137f",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## CLASIFICACIÓN Y ENRUTAMIENTO\n\n• Identifica tipo de entrada\n• Separa: PDF, imagen, audio, texto y otros\n• Prepara cada rama para su procesamiento\n• También detecta enlaces en texto",
"height": 512,
"width": 692,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
32,
1680
],
"id": "2d18ee42-8d9f-4852-8197-1817484cd493",
"name": "Sticky Note1"
},
{
"parameters": {
"content": "## GUARDADO DE ADJUNTOS\n\n• Guarda los archivos originales del usuario\n• Incluye PDFs, imágenes y otros soportes\n• No todos se analizan\n• Sí quedan preservados en la carpeta final",
"height": 320,
"width": 672,
"color": "#433D3D"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1856,
2512
],
"id": "4da513f7-3c45-4868-ab6f-936b24705c03",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## ANÁLISIS DE INSUMOS\n\n• PDF: se analiza con Gemini\n• Audio: se transcribe / resume\n• Imagen: se interpreta\n• Si no hay PDF, el flujo continúa\n• Cada salida se normaliza en Edit Fields",
"height": 1248,
"width": 2752,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
800,
1216
],
"id": "2c3abb00-e18c-4ee8-8acc-9fedc1945580",
"name": "Sticky Note3"
},
{
"parameters": {
"content": "## CONSOLIDACIÓN DEL CONTEXTO\n\n• Une documento, audio e imagen\n• Construye un contexto único\n• Envía todo al modelo\n• El modelo genera el brief estructurado",
"height": 576,
"width": 2000,
"color": "#9E2929"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
3840,
1760
],
"id": "d4453b92-81a3-4d13-9f1f-4e21701bcad5",
"name": "Sticky Note4"
},
{
"parameters": {
"content": "## POSTPROCESO DEL BRIEF\n\n• Limpia la salida del modelo\n• Extrae campos del brief\n• Construye placeholders\n• Genera nombres finales\n• Renombra la carpeta creada al inicio",
"height": 352,
"width": 1252
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
5952,
1776
],
"id": "a7b5c1c8-586f-4b11-8b68-b85666c39226",
"name": "Sticky Note5"
},
{
"parameters": {
"content": "## SALIDA FINAL\n\n• Copia la plantilla oficial\n• Inserta la información del brief\n• Comparte la carpeta\n• Devuelve el enlace por webhook\n• Envía el correo\n• Guarda datos relevantes\n• Crea registro en la bandeja **Nuevos** de Tablero CDC para revisión\n",
"height": 384,
"width": 3092,
"color": "#3F360C"
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
7328,
1776
],
"id": "dd5f7e46-1a6b-48bd-9c0d-f82d6520208a",
"name": "Sticky Note6"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "f34e6067-5572-44ef-bac9-738212957d5c",
"leftValue": "={{ $json.pdfMissing || false }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
1168,
1488
],
"id": "85439295-64fb-427b-81d8-0637904fc43c",
"name": "If PDF missing"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "be678498-4e99-45bf-acb7-b7ade22fabb5",
"name": "fileName",
"value": "''",
"type": "string"
},
{
"id": "e9a77032-adbd-462c-bb2e-20f267496a8e",
"name": "content_summary",
"value": "No se adjuntó PDF. Continúa el flujo con audio e imagen.",
"type": "string"
},
{
"id": "bf85223a-197a-4a28-b3bf-064dc0fe8300",
"name": "type",
"value": "document",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2048,
1264
],
"id": "4977058b-764b-44eb-8886-bf115ec3697e",
"name": "PDF opcional omitido"
},
{
"parameters": {
"resource": "document",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
1584,
1632
],
"id": "b4515d56-49d3-48d0-8f26-e6417440a8b5",
"name": "Analyze document",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "0b8567da-0fd5-45c3-9f4e-071036d665bb",
"name": "fileName",
"value": "={{ $json.fileName || $('Switch').item.json.fileName || '' }}",
"type": "string"
},
{
"id": "7af7edfc-6c2a-4183-ac0f-f5e16e925fff",
"name": "content_summary",
"value": "={{ $json.content?.parts?.[0]?.text || $json.content_summary || '' }}",
"type": "string"
},
{
"id": "6447843f-472f-4249-ac49-bf63ed6cb04c",
"name": "type",
"value": "document",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3088,
1456
],
"id": "4f42dd8e-c7a6-40bb-8605-0f392e4730a9",
"name": "Edit Fields documento"
},
{
"parameters": {
"jsCode": "const items = $input.all();\nreturn items;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1024,
1488
],
"id": "b320e1c6-888b-45d6-8bee-3b22e58ff6f0",
"name": "Procesar documentos"
},
{
"parameters": {
"jsCode": "const webhookItems = $('Webhook').all();\nconst out = [];\n\nlet hasPdfDocument = false;\n\nfor (const webhookItem of webhookItems) {\n const json = webhookItem.json || {};\n const body = json.body || {};\n const binary = webhookItem.binary || {};\n\n const text =\n body.text ||\n body.message ||\n body.caption ||\n body.prompt ||\n json.text ||\n json.message ||\n '';\n\n if (typeof text === 'string' && text.trim() !== '') {\n out.push({\n json: {\n type: 'text',\n text: text.trim(),\n }\n });\n }\n\n for (const key of Object.keys(binary)) {\n const file = binary[key];\n const mime = String(file.mimeType || '').toLowerCase();\n const ext = String(file.fileExtension || '').toLowerCase();\n const fileName = String(file.fileName || '').toLowerCase();\n\n let type = 'attachment_only';\n\n const isImage = mime.startsWith('image/');\n const isAudio = mime.startsWith('audio/');\n const isPdf =\n mime.includes('pdf') ||\n ext === 'pdf' ||\n fileName.endsWith('.pdf');\n\n if (isImage) {\n type = 'image';\n } else if (isAudio) {\n type = 'audio';\n } else if (isPdf) {\n type = 'pdf_document';\n hasPdfDocument = true;\n } else {\n type = 'attachment_only';\n }\n\n out.push({\n json: {\n type,\n binaryKey: key,\n mimeType: file.mimeType || '',\n fileName: file.fileName || '',\n fileExtension: file.fileExtension || '',\n fileSize: file.fileSize || '',\n },\n binary: {\n data: file\n }\n });\n }\n}\n\nif (!hasPdfDocument) {\n out.push({\n json: {\n type: 'pdf_document',\n pdfMissing: true,\n fileName: '',\n content_summary: 'No se adjuntó PDF. Continúa el flujo con audio e imagen.'\n }\n });\n}\n\nreturn out;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
320,
1968
],
"id": "50d51d78-ee89-41ee-bf75-0f3241a783ee",
"name": "Code in JavaScript"
},
{
"parameters": {
"jsCode": "const folderId = $('Create folder').first().json.id;\nconst items = $input.all();\n\nconst output = [];\n\nfor (const item of items) {\n const binaries = item.binary || {};\n\n for (const key of Object.keys(binaries)) {\n const file = binaries[key];\n\n output.push({\n json: {\n folderId,\n fileName: file.fileName || key,\n mimeType: file.mimeType || '',\n },\n binary: {\n data: file\n }\n });\n }\n}\n\nreturn output;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1920,
2672
],
"id": "0dc410a0-7e8c-4458-94df-89ee77876b6a",
"name": "Code in JavaScript3"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nif (!items.length) {\n return [{\n json: {\n combined_content: 'No se recibió contenido para resumir.'\n }\n }];\n}\n\nconst combined = items.map((item, i) => {\n const type = item.json.type || 'other';\n const fileName = item.json.fileName || '';\n const summary = item.json.content_summary || '';\n\n return [\n `Entrada ${i + 1}`,\n `Tipo: ${type}`,\n fileName ? `Archivo: ${fileName}` : null,\n `Contenido:`,\n summary\n ].filter(Boolean).join('\\n');\n}).join('\\n\\n====================\\n\\n');\n\nreturn [\n {\n json: {\n combined_content: combined\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
4352,
2032
],
"id": "a76aab4f-e205-46ff-a205-4338bc62d99f",
"name": "Code in JavaScript1"
},
{
"parameters": {
"jsCode": "const raw = $('Message a model').item.json.content.parts[0].text || '';\n\nlet formatted = raw\n .replace(/\\r\\n/g, '\\n')\n .replace(/^---$/gm, '')\n .replace(/^# (.*)$/gm, '\\n$1\\n')\n .replace(/^## (.*)$/gm, '\\n$1\\n')\n .replace(/^### (.*)$/gm, '\\n$1\\n')\n .replace(/\\*\\*(.*?)\\*\\*/g, '$1')\n .replace(/^\\*\\s+/gm, '• ')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n\nformatted = `BRIEF PROFESIONAL\\n\\n${formatted}`;\n\nreturn [\n {\n json: {\n googleDocsText: formatted\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6032,
1968
],
"id": "eabec16e-cb73-4d34-951d-85e1165c536d",
"name": "Code in JavaScript4"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1376,
1568
],
"id": "f785fec1-42f0-4493-95a3-e683b4f5fdbb",
"name": "Backup document input"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1712,
1920
],
"id": "ee47538b-26d5-48cf-8677-4c83bc97254f",
"name": "Backup audio input"
},
{
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map((item, index) => ({\n json: {\n ...item.json,\n _fallbackIndex: index,\n },\n binary: item.binary,\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1760,
2208
],
"id": "40e893b3-01c2-462b-9490-76c06a7de717",
"name": "Backup image input"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "52ff398d-d5fa-4329-8755-03578f1f3965",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
2176,
2224
],
"id": "cfcdbe16-5fa4-428d-b0a3-6e9d9edce41f",
"name": "IF imagen gratis falló"
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2720,
2048
],
"id": "3c234eaf-a1b0-4b0a-a383-b550de21cffe",
"name": "Analyze an image - Pago",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup image input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar la imagen en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2416,
2048
],
"id": "dc2c44c3-ab42-4d25-959d-7ea30a26c4c9",
"name": "Recuperar binario imagen"
},
{
"parameters": {
"resource": "audio",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2656,
1744
],
"id": "8155eef1-4f26-4fe7-bcba-65db97a237e8",
"name": "Analyze audio - Pago",
"retryOnFail": false,
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "a0d47fed-e52c-4882-bd89-c7833b214111",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
2112,
1936
],
"id": "8cd45e47-ce95-4e59-b760-e7fa12645c06",
"name": "If audio gratis falló"
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup audio input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar el audio en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2448,
1744
],
"id": "2cb45af8-ddb0-4c66-a6cf-3f7c30914061",
"name": "Recuperar binario audio"
},
{
"parameters": {
"resource": "document",
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"inputType": "binary",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
2240,
1440
],
"id": "2575fc6e-17fc-458d-ade4-0143e1fe830b",
"name": "Analyze document - Pago",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "033b7aa0-7c40-4f6a-9056-83094b6451f0",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
1776,
1632
],
"id": "0d91d026-401c-4d56-8d77-da38b4f01b16",
"name": "IF documento gratis falló"
},
{
"parameters": {
"jsCode": "const failedItems = $input.all();\nconst originalItems = $('Backup document input').all();\n\nreturn failedItems.map((failedItem, index) => {\n let originalIndex = failedItem.json?._fallbackIndex;\n\n if (originalIndex === undefined && failedItem.pairedItem) {\n if (Array.isArray(failedItem.pairedItem)) {\n originalIndex = failedItem.pairedItem[0]?.item;\n } else {\n originalIndex = failedItem.pairedItem.item;\n }\n }\n\n if (originalIndex === undefined) {\n originalIndex = index;\n }\n\n const original = originalItems[originalIndex] || originalItems[index] || originalItems[0];\n\n if (!original?.binary?.data) {\n throw new Error(`No se encontró binary.data para recuperar el documento en el índice ${originalIndex}`);\n }\n\n return {\n json: {\n ...original.json,\n fallbackUsed: true,\n fallbackReason: failedItem.json?.error || 'Error en API gratis',\n },\n binary: original.binary,\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2016,
1456
],
"id": "d2c720a2-fbe7-4948-b077-eaad28729238",
"name": "Recuperar binario documento"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "models/gemini-2.5-pro",
"mode": "list",
"cachedResultName": "models/gemini-2.5-pro"
},
"messages": {
"values": [
{
"content": "=Actúa como un asistente de inteligencia artificial especializado en interpretación y estructuración de briefs creativos, estratégicos y comerciales.\n\nTu tarea es analizar todo el contenido recibido y transformarlo en un brief profesional, claro, accionable y listo para revisión interna, edición en Google Docs y representación visual en HTML.\n\nInstrucciones de trabajo:\n\n1. Captura e interpretación\n- Lee y consolida toda la información disponible.\n- Si existe texto derivado del audio, úsalo como contexto principal.\n- Si hay documentos, imágenes o referencias visuales, intégralos como soporte complementario.\n- Extrae entidades clave, objetivos, requerimientos, restricciones, entregables, fechas, audiencias, marcas, productos y cualquier dato relevante.\n- Distingue claramente entre:\n - Tipo de requerimiento = categoría general de la solicitud.\n - Tipo de entregable = pedido específico o salida concreta esperada.\n\n2. Detección de vacíos\n- Detecta campos obligatorios ausentes.\n- Identifica detalles técnicos faltantes.\n- Señala contradicciones o inconsistencias.\n- Marca información ambigua o poco clara.\n- Advierte posibles riesgos para el desarrollo creativo, estratégico o de producción.\n\n3. Enriquecimiento y estructuración\n- Reorganiza la información y conviértela en un brief profesional con redacción clara, precisa y ejecutiva.\n- Mejora la redacción sin inventar datos no proporcionados.\n- Cuando algo no esté disponible, indícalo como “No especificado” o “Pendiente de definir”.\n- Si no existe un nombre explícito para el proyecto, genera un nombre breve y profesional usando únicamente los datos reales disponibles, sin inventar información nueva.\n\n4. Reglas importantes de salida\n- No repitas información redundante.\n- No inventes datos.\n- Prioriza claridad, orden y utilidad práctica.\n- Redacta con tono profesional y ejecutivo.\n- La salida debe sentirse como un brief listo para revisión interna.\n- Debes incluir explícitamente los campos “Nombre del proyecto”, “Cliente”, “Marca”, “País”, “Tipo de requerimiento” y “Tipo de entregable”.\n- No mezcles “Tipo de requerimiento” con “Tipo de entregable”.\n- Si cliente y marca son la misma cosa, puedes repetir el valor en ambos campos.\n- Si no puedes identificar uno de los dos, usa “No especificado”.\n\n5. Genera la salida exactamente en este formato:\n\n1. Resumen ejecutivo\n- Explica de forma breve y profesional de qué trata la solicitud, cuál es el objetivo y qué se espera desarrollar.\n\n2. Información clave del brief\n- Nombre del proyecto\n- Cliente\n- Marca\n- País\n- Producto / servicio\n- Tipo de requerimiento\n- Tipo de entregable\n- Objetivo principal\n- Contexto / antecedente\n- Audiencia objetivo\n- Mensaje clave\n- Entregables solicitados\n- Canales / formatos\n- Requerimientos técnicos\n- Referencias creativas o visuales\n- Fechas o tiempos relevantes\n- Presupuesto\n- Restricciones o consideraciones especiales\n\n3. Vacíos detectados\n- Lista clara de campos faltantes, ambiguos o contradictorios.\n\n4. Riesgos o alertas\n- Señala riesgos que puedan afectar la ejecución, creatividad, tiempos, costos o claridad del proyecto.\n\n5. Recomendaciones rápidas\n- Sugiere qué información adicional conviene completar o reforzar antes de aprobar el brief final.\n\n6. Nivel de completitud\n- Indica un porcentaje estimado de completitud del brief según la información recibida.\n\nContenido recibido:\n{{$json.combined_content}}"
}
]
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"typeVersion": 1.1,
"position": [
5264,
1872
],
"id": "1eae7747-2e14-4e56-b5e8-8e33607df1b5",
"name": "Message a model - Pago",
"credentials": {
"googlePalmApi": {
"id": "jvsXYwL6IOoY2DBU",
"name": "Isaac - Gemini Api Pago"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "0ccf935c-14e8-4e1b-b7db-cb994c970733",
"leftValue": "={{ !$json.content?.parts?.[0]?.text }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
5008,
2016
],
"id": "ed065304-2526-4d89-b10f-2b2c1cd7bb58",
"name": "If"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU",
"mode": "list",
"cachedResultName": "CDC Brief - Base para Fulgencio",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Briefs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1h_d4l4FYkLvyy_Zp7bEQFKpy5hx6pVj9xZ98mjMHHSU/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"fecha_creacion": "={{ $json.fecha_creacion }}",
"brief_id": "={{ $json.brief_id }}",
"nombre_carpeta": "={{ $json.nombre_carpeta }}",
"enviado_por": "={{ $json.enviado_por }}",
"correo": "={{ $json.correo }}",
"link_carpeta_drive": "={{ $json.link_carpeta_drive }}",
"link_documento_brief": "={{ $json.link_documento_brief }}",
"estado": "={{ $json.estado }}",
"cantidad_audios": "={{ $json.cantidad_audios }}",
"cantidad_imagenes": "={{ $json.cantidad_imagenes }}",
"cantidad_documentos": "={{ $json.cantidad_documentos }}",
"cantidad_links": "={{ $json.cantidad_links }}",
"resumen_chatbot": "={{ $json.resumen_chatbot }}",
"texto_brief": "={{ $json.texto_brief }}",
"texto_busqueda": "={{ $json.texto_busqueda }}",
"fecha_entrega": "={{ $('Preparar fecha de entrega').first().json.deliveryDateLabel }}"
},
"matchingColumns": [],
"schema": [
{
"id": "fecha_creacion",
"displayName": "fecha_creacion",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "brief_id",
"displayName": "brief_id",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "nombre_carpeta",
"displayName": "nombre_carpeta",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "enviado_por",
"displayName": "enviado_por",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "correo",
"displayName": "correo",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "link_carpeta_drive",
"displayName": "link_carpeta_drive",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "link_documento_brief",
"displayName": "link_documento_brief",
"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": "cantidad_audios",
"displayName": "cantidad_audios",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_imagenes",
"displayName": "cantidad_imagenes",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_documentos",
"displayName": "cantidad_documentos",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "cantidad_links",
"displayName": "cantidad_links",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "resumen_chatbot",
"displayName": "resumen_chatbot",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "texto_brief",
"displayName": "texto_brief",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "texto_busqueda",
"displayName": "texto_busqueda",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "fecha_entrega",
"displayName": "fecha_entrega",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
9456,
1968
],
"id": "154cd73e-41e1-463a-9c19-d1a44f63e7f0",
"name": "Agregar fila a Sheet Fulgencio",
"retryOnFail": false,
"alwaysOutputData": true,
"credentials": {
"googleSheetsOAuth2Api": {
"id": "K0hDZh3a85MpOHCs",
"name": "Google Sheets account 2"
}
},
"onError": "continueRegularOutput"
},
{
"parameters": {
"jsCode": "function getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction getNodeBinary(nodeName) {\n try {\n return $(nodeName).first().binary || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction cleanText(value) {\n return String(value || '')\n .replace(/\\r\\n/g, '\\n')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nfunction limitText(value, maxLength = 45000) {\n const text = String(value || '');\n return text.length > maxLength ? text.slice(0, maxLength) : text;\n}\n\nfunction parseLinks(value) {\n if (!value) return [];\n\n if (Array.isArray(value)) {\n return value.filter(Boolean).map(String);\n }\n\n return String(value)\n .split(/\\n|,|\\s+/)\n .map(link => link.trim())\n .filter(link => /^https?:\\/\\//i.test(link));\n}\n\nconst webhookItem = getNodeJson('Webhook');\nconst webhookBinary = getNodeBinary('Webhook');\n\nconst body =\n webhookItem.body && Object.keys(webhookItem.body).length\n ? webhookItem.body\n : webhookItem;\n\nconst folderNode = getNodeJson('Create folder');\nconst docNode = getNodeJson('Copy template');\nconst finalTextNode = getNodeJson('Code in JavaScript4');\nconst fechaEntregaNode = getNodeJson('Preparar fecha de entrega');\n\nconst folderId = folderNode.id || '';\nconst folderName = folderNode.name || '';\nconst docId = docNode.id || '';\n\nconst folderUrl = folderId\n ? `https://drive.google.com/drive/u/0/folders/${folderId}`\n : '';\n\nconst docUrl = docId\n ? `https://docs.google.com/document/d/${docId}/edit`\n : '';\n\nconst submittedByName =\n body.submittedByName ||\n body.displayName ||\n body.name ||\n body.email ||\n 'No especificado';\n\nconst submittedByEmail =\n body.submittedByEmail ||\n body.email ||\n 'No especificado';\n\nconst fechaEntrega =\n fechaEntregaNode.deliveryDateLabel ||\n fechaEntregaNode.fechaEntregaTexto ||\n body.deliveryDateLabel ||\n body.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst finalBriefText =\n finalTextNode.googleDocsText ||\n finalTextNode.text ||\n finalTextNode.content ||\n '';\n\nconst files = Object.values(webhookBinary || {});\n\nconst audioCount = files.filter(file =>\n String(file.mimeType || '').startsWith('audio/')\n).length;\n\nconst imageCount = files.filter(file =>\n String(file.mimeType || '').startsWith('image/')\n).length;\n\nconst documentCount = files.filter(file => {\n const mime = String(file.mimeType || '');\n return (\n mime.includes('pdf') ||\n mime.includes('word') ||\n mime.includes('excel') ||\n mime.includes('spreadsheet') ||\n mime.includes('presentation') ||\n mime.includes('powerpoint') ||\n mime.includes('officedocument')\n );\n}).length;\n\nconst links = [\n ...parseLinks(body.links),\n ...parseLinks(body.enlaces),\n ...parseLinks(body.referenceLinks),\n ...parseLinks(body.referencias),\n ...parseLinks(body.urls),\n];\n\nconst fechaCreacion = new Date().toISOString();\n\nconst resumenChatbot = cleanText(finalBriefText).slice(0, 1200);\n\nconst textoBusqueda = [\n `Brief CDC`,\n `Fecha: ${fechaCreacion}`,\n `Fecha límite de entrega: ${fechaEntrega}`,\n `Enviado por: ${submittedByName}`,\n `Correo: ${submittedByEmail}`,\n `Carpeta: ${folderUrl}`,\n `Documento: ${docUrl}`,\n `Nombre carpeta: ${folderName}`,\n '',\n finalBriefText,\n].join('\\n');\n\nreturn [\n {\n json: {\n fecha_creacion: fechaCreacion,\n brief_id: folderId || `${Date.now()}`,\n nombre_carpeta: folderName,\n enviado_por: submittedByName,\n correo: submittedByEmail,\n fecha_entrega: fechaEntrega,\n link_carpeta_drive: folderUrl,\n link_documento_brief: docUrl,\n estado: 'Nuevo',\n cantidad_audios: audioCount,\n cantidad_imagenes: imageCount,\n cantidad_documentos: documentCount,\n cantidad_links: links.length,\n resumen_chatbot: resumenChatbot,\n texto_brief: limitText(finalBriefText),\n texto_busqueda: limitText(textoBusqueda),\n },\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
9248,
1968
],
"id": "e20f24b6-dc1b-4058-8c14-c92009068e3c",
"name": "Preparar fila para Sheet Fulgencio"
},
{
"parameters": {
"jsCode": "const inputItem = $input.first();\nconst inputJson = inputItem.json || {};\n\nconst webhookJson = $('Webhook').first().json || {};\nconst body = webhookJson.body || {};\n\nfunction formatDateEs(dateString) {\n if (!dateString) return '';\n\n const value = String(dateString).trim();\n\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return value;\n }\n\n const [year, month, day] = value.split('-');\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n\n if (Number.isNaN(date.getTime())) {\n return value;\n }\n\n return date.toLocaleDateString('es-DO', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n}\n\nconst deliveryDateRaw =\n body.deliveryDate ||\n body.fechaEntrega ||\n '';\n\nconst deliveryDateStatusRaw =\n body.deliveryDateStatus ||\n body.fechaEntregaEstado ||\n '';\n\nconst deliveryDateLabelFromFrontend =\n body.deliveryDateLabel ||\n body.fechaEntregaTexto ||\n '';\n\nconst hasDate =\n deliveryDateRaw !== undefined &&\n deliveryDateRaw !== null &&\n String(deliveryDateRaw).trim() !== '';\n\nconst normalizedStatus = String(deliveryDateStatusRaw || '').toLowerCase();\nconst normalizedLabel = String(deliveryDateLabelFromFrontend || '').toLowerCase();\n\nconst isPending =\n !hasDate &&\n (\n normalizedStatus === 'pending' ||\n normalizedStatus === 'por_confirmar' ||\n normalizedStatus === 'por confirmar' ||\n normalizedLabel === 'por confirmar'\n );\n\nconst deliveryDateLabel = isPending\n ? 'Por confirmar'\n : hasDate\n ? formatDateEs(deliveryDateRaw)\n : deliveryDateLabelFromFrontend || 'Por confirmar';\n\nreturn [\n {\n json: {\n ...inputJson,\n deliveryDateRaw,\n deliveryDateStatus: isPending ? 'pending' : 'defined',\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n fechaEntregaEstado: isPending ? 'por_confirmar' : 'definida',\n },\n binary: inputItem.binary,\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
112,
1968
],
"id": "2d61e16e-61bd-494e-a73e-d24605112564",
"name": "Preparar fecha de entrega"
},
{
"parameters": {
"jsCode": "const item = $input.first();\nconst json = item.json || {};\n\nconst fechaNode = $('Preparar fecha de entrega').first().json || {};\n\nconst deliveryDateLabel =\n fechaNode.deliveryDateLabel ||\n fechaNode.fechaEntregaTexto ||\n json.deliveryDateLabel ||\n json.fechaEntregaTexto ||\n 'Por confirmar';\n\nconst deliveryLine = `• Fecha límite de entrega: ${deliveryDateLabel}.`;\n\nlet googleDocsText = json.googleDocsText || '';\n\nif (!googleDocsText) {\n return [\n {\n json: {\n ...json,\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n },\n binary: item.binary,\n },\n ];\n}\n\n// Evita duplicar la fecha si el nodo se ejecuta más de una vez\ngoogleDocsText = googleDocsText.replace(\n /^\\s*[•-]?\\s*Fecha límite de entrega:.*$/gim,\n ''\n);\n\n// Inserta la fecha justo debajo de \"Fechas / tiempos relevantes\"\nconst fechasHeadingRegex = /(Fechas\\s*\\/\\s*tiempos\\s+relevantes\\s*:?\\s*)/i;\n\nif (fechasHeadingRegex.test(googleDocsText)) {\n googleDocsText = googleDocsText.replace(\n fechasHeadingRegex,\n `$1\\n${deliveryLine}\\n`\n );\n} else {\n // Si por alguna razón la sección no aparece, la agrega al final\n googleDocsText += `\\n\\nFechas / tiempos relevantes\\n${deliveryLine}`;\n}\n\n// Limpieza básica de saltos de línea excesivos\ngoogleDocsText = googleDocsText\n .replace(/\\n{4,}/g, '\\n\\n\\n')\n .trim();\n\nreturn [\n {\n json: {\n ...json,\n googleDocsText,\n deliveryDateLabel,\n fechaEntregaTexto: deliveryDateLabel,\n },\n binary: item.binary,\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
6240,
1968
],
"id": "685fbfcf-3f6d-4cda-85bd-9343bdb0420e",
"name": "Agregar fecha al Google Doc"
},
{
"parameters": {
"method": "POST",
"url": "https://dbit.digitalcompass.agency/rest/v1/cdc_briefs_fulgencio?on_conflict=brief_id",
"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"
},
{
"name": "Prefer",
"value": "resolution=merge-duplicates,return=representation"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\n brief_id: $json.brief_id,\n fecha_creacion: $json.fecha_creacion,\n nombre_carpeta: $json.nombre_carpeta,\n enviado_por: $json.enviado_por,\n correo: $json.correo,\n link_carpeta_drive: $json.link_carpeta_drive,\n link_documento_brief: $json.link_documento_brief,\n estado: $json.estado,\n cantidad_audios: Number($json.cantidad_audios || 0),\n cantidad_imagenes: Number($json.cantidad_imagenes || 0),\n cantidad_documentos: Number($json.cantidad_documentos || 0),\n cantidad_links: Number($json.cantidad_links || 0),\n resumen_chatbot: $json.resumen_chatbot,\n texto_brief: $json.texto_brief,\n texto_busqueda: $json.texto_busqueda,\n fecha_entrega: $json.fecha_entrega\n} }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
9696,
1968
],
"id": "125ba086-7f5f-4913-b3b8-0f8884061c64",
"name": "Guardar brief en Supabase",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 2000
},
{
"parameters": {
"jsCode": "function getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json || {};\n } catch (error) {\n return {};\n }\n}\n\nfunction clean(value, fallback = '') {\n const text = String(value ?? '').trim();\n return text || fallback;\n}\n\nconst brief = getNodeJson('Preparar fila para Sheet Fulgencio');\nconst docs = getNodeJson('Build Docs Requests');\nconst fields = docs.fields || {};\n\nconst title = clean(fields.NOMBRE_PROYECTO, clean(brief.nombre_carpeta, `Brief CDC ${brief.brief_id || ''}`));\n\nreturn [\n {\n json: {\n brief_id: clean(brief.brief_id),\n source_created_at: brief.fecha_creacion || new Date().toISOString(),\n title,\n client: clean(fields.CLIENTE),\n brand: clean(fields.MARCA),\n country: clean(fields.PAIS),\n requested_by: clean(brief.enviado_por),\n requested_by_email: clean(brief.correo),\n delivery_date: clean(brief.fecha_entrega),\n brief_link: clean(brief.link_carpeta_drive),\n document_link: clean(brief.link_documento_brief),\n summary: clean(fields.RESUMEN_EJECUTIVO, clean(brief.resumen_chatbot)),\n request_type: clean(fields.TIPO_REQUERIMIENTO),\n deliverable_type: clean(fields.TIPO_ENTREGABLE),\n raw_fields: fields,\n review_status: 'new'\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
9936,
1968
],
"id": "30c70065-27cd-489f-b1de-3980cdbba939",
"name": "Preparar bandeja Nuevos Tablero CDC"
},
{
"parameters": {
"method": "POST",
"url": "https://dbit.digitalcompass.agency/rest/v1/tablero_cdc_brief_inbox?on_conflict=brief_id",
"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"
},
{
"name": "Prefer",
"value": "resolution=ignore-duplicates,return=representation"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\n brief_id: $json.brief_id,\n source_created_at: $json.source_created_at,\n title: $json.title,\n client: $json.client,\n brand: $json.brand,\n country: $json.country,\n requested_by: $json.requested_by,\n requested_by_email: $json.requested_by_email,\n delivery_date: $json.delivery_date,\n brief_link: $json.brief_link,\n document_link: $json.document_link,\n summary: $json.summary,\n request_type: $json.request_type,\n deliverable_type: $json.deliverable_type,\n raw_fields: $json.raw_fields,\n review_status: 'new'\n} }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
10192,
1968
],
"id": "5706f51f-ef4b-45da-a088-aefe5cefd26f",
"name": "Guardar en Nuevos Tablero CDC",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 2000,
"onError": "continueRegularOutput"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Create folder",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Procesar documentos",
"type": "main",
"index": 0
}
],
[
{
"node": "Backup image input",
"type": "main",
"index": 0
}
],
[],
[
{
"node": "Backup audio input",
"type": "main",
"index": 0
}
]
]
},
"Analyze audio": {
"main": [
[
{
"node": "If audio gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Analyze an image": {
"main": [
[
{
"node": "IF imagen gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Create folder": {
"main": [
[
{
"node": "Preparar fecha de entrega",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Share folder": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Respond to Webhook": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Copy template": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Build Docs Requests": {
"main": [
[
{
"node": "Build Names",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Share folder",
"type": "main",
"index": 0
}
]
]
},
"Build Names": {
"main": [
[
{
"node": "Rename folder",
"type": "main",
"index": 0
}
]
]
},
"Rename folder": {
"main": [
[
{
"node": "Copy template",
"type": "main",
"index": 0
}
]
]
},
"If PDF missing": {
"main": [
[
{
"node": "PDF opcional omitido",
"type": "main",
"index": 0
}
],
[
{
"node": "Backup document input",
"type": "main",
"index": 0
}
]
]
},
"Analyze document": {
"main": [
[
{
"node": "IF documento gratis falló",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields documento": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"PDF opcional omitido": {
"main": [
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"Procesar documentos": {
"main": [
[
{
"node": "If PDF missing",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Code in JavaScript3",
"type": "main",
"index": 0
},
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript3": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript4": {
"main": [
[
{
"node": "Agregar fecha al Google Doc",
"type": "main",
"index": 0
}
]
]
},
"Backup document input": {
"main": [
[
{
"node": "Analyze document",
"type": "main",
"index": 0
}
]
]
},
"Backup audio input": {
"main": [
[
{
"node": "Analyze audio",
"type": "main",
"index": 0
}
]
]
},
"Backup image input": {
"main": [
[
{
"node": "Analyze an image",
"type": "main",
"index": 0
}
]
]
},
"IF imagen gratis falló": {
"main": [
[
{
"node": "Recuperar binario imagen",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario imagen": {
"main": [
[
{
"node": "Analyze an image - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze an image - Pago": {
"main": [
[
{
"node": "Edit Fields2",
"type": "main",
"index": 0
}
]
]
},
"If audio gratis falló": {
"main": [
[
{
"node": "Recuperar binario audio",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario audio": {
"main": [
[
{
"node": "Analyze audio - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze audio - Pago": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"IF documento gratis falló": {
"main": [
[
{
"node": "Recuperar binario documento",
"type": "main",
"index": 0
}
],
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"Recuperar binario documento": {
"main": [
[
{
"node": "Analyze document - Pago",
"type": "main",
"index": 0
}
]
]
},
"Analyze document - Pago": {
"main": [
[
{
"node": "Edit Fields documento",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Message a model - Pago",
"type": "main",
"index": 0
}
],
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Message a model - Pago": {
"main": [
[
{
"node": "Code in JavaScript4",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "Preparar fila para Sheet Fulgencio",
"type": "main",
"index": 0
}
]
]
},
"Preparar fila para Sheet Fulgencio": {
"main": [
[
{
"node": "Agregar fila a Sheet Fulgencio",
"type": "main",
"index": 0
}
]
]
},
"Preparar fecha de entrega": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Agregar fecha al Google Doc": {
"main": [
[
{
"node": "Build Docs Requests",
"type": "main",
"index": 0
}
]
]
},
"Agregar fila a Sheet Fulgencio": {
"main": [
[
{
"node": "Guardar brief en Supabase",
"type": "main",
"index": 0
}
]
]
},
"Guardar brief en Supabase": {
"main": [
[
{
"node": "Preparar bandeja Nuevos Tablero CDC",
"type": "main",
"index": 0
}
]
]
},
"Preparar bandeja Nuevos Tablero CDC": {
"main": [
[
{
"node": "Guardar en Nuevos Tablero CDC",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Isaac Aracena",
"name": "Version 9dbf4877",
"description": "",
"autosaved": true,
"workflowPublishHistory": [
{
"createdAt": "2026-08-22T15:30:00.695Z",
"id": 5139,
"workflowId": "Z8W67i7RfrhXRDFQ",
"versionId": "9dbf4877-d8d8-420d-9bb0-b147b948d992",
"event": "activated",
"userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
]
}
}