Actualizar Flujo de n8n: Tablero CDC - Sync Proyecto a Banco Fulgencio.json
This commit is contained in:
@@ -0,0 +1,610 @@
|
||||
{
|
||||
"name": "Tablero CDC - Sync Proyecto a Banco Fulgencio",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "tablero-cdc-sync-fulgencio",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
-272,
|
||||
96
|
||||
],
|
||||
"id": "5fbd25cf-6c2d-4364-a10e-91954b61256f",
|
||||
"name": "Webhook",
|
||||
"webhookId": "b9c9551b-86ee-4f3d-bbe2-12e93eef4b35"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "const input = $json || {};\nconst body = input.body || input;\n\nconst projectId =\n body.project_id ||\n body.projectId ||\n body.id ||\n '';\n\nconst action =\n String(body.action || 'sync').trim().toLowerCase();\n\nif (!projectId) {\n throw new Error('Falta project_id en el payload del webhook');\n}\n\nreturn [\n {\n json: {\n action,\n project_id: projectId,\n received_at: new Date().toISOString(),\n },\n },\n];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-64,
|
||||
96
|
||||
],
|
||||
"id": "61c5d83f-33d1-45d8-bb6a-4f657461f3c1",
|
||||
"name": "Code - Preparar project_id"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "=https://dbit.digitalcompass.agency/rest/v1/tablero_cdc_projects?id=eq.{{ $('Code - Preparar project_id').first().json.project_id }}&select=*",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "apikey",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
||||
},
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": " application/json"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.4,
|
||||
"position": [
|
||||
144,
|
||||
96
|
||||
],
|
||||
"id": "007cdb0b-ab8e-4558-8ce0-b4cf238b2ef9",
|
||||
"name": "Supabase - Leer proyecto"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "=https://dbit.digitalcompass.agency/rest/v1/tablero_cdc_project_links?project_id=eq.{{ $('Code - Preparar project_id').first().json.project_id }}&select=*&order=created_at.asc",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "apikey",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
||||
},
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": " application/json"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.4,
|
||||
"position": [
|
||||
320,
|
||||
96
|
||||
],
|
||||
"id": "ab47b077-7d17-4145-9a19-c0b9134a7931",
|
||||
"name": "Supabase - Leer links del proyecto",
|
||||
"alwaysOutputData": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "function getNodeJson(nodeName) {\n try {\n return $(nodeName).first().json;\n } catch (error) {\n return {};\n }\n}\n\nfunction getNodeItems(nodeName) {\n try {\n return $(nodeName).all();\n } catch (error) {\n return [];\n }\n}\n\nfunction normalizeProjectResponse(value) {\n if (Array.isArray(value)) return value[0] || null;\n return value || null;\n}\n\nfunction normalizeLinksResponse(items) {\n const links = [];\n\n for (const item of items) {\n const json = item.json;\n\n if (Array.isArray(json)) {\n links.push(...json);\n } else if (json && typeof json === 'object') {\n links.push(json);\n }\n }\n\n return links.filter(link => link && link.url);\n}\n\nfunction clean(value) {\n return String(value ?? '').trim();\n}\n\nfunction getYear(value) {\n const date = value ? new Date(value) : new Date();\n\n if (Number.isNaN(date.getTime())) {\n return String(new Date().getFullYear());\n }\n\n return String(date.getFullYear());\n}\n\nfunction extractGoogleFileId(url) {\n const text = clean(url);\n\n if (!text) return '';\n\n const patterns = [\n /\\/d\\/([a-zA-Z0-9_-]+)/,\n /id=([a-zA-Z0-9_-]+)/,\n /\\/file\\/d\\/([a-zA-Z0-9_-]+)/,\n /\\/presentation\\/d\\/([a-zA-Z0-9_-]+)/,\n ];\n\n for (const pattern of patterns) {\n const match = text.match(pattern);\n if (match && match[1]) return match[1];\n }\n\n return '';\n}\n\nconst rawProject = getNodeJson('Supabase - Leer proyecto');\nconst project = normalizeProjectResponse(rawProject);\n\nif (!project || !project.id) {\n throw new Error('No se encontró el proyecto en Supabase. Revisa el project_id.');\n}\n\nconst linkItems = getNodeItems('Supabase - Leer links del proyecto');\nconst links = normalizeLinksResponse(linkItems);\n\nconst proposalLinks = links.filter(link =>\n String(link.link_type || '').toLowerCase() === 'proposal'\n);\n\nif (!proposalLinks.length) {\n return [\n {\n json: {\n ok: true,\n skipped: true,\n reason: 'El proyecto no tiene links de propuesta. No se escribe en Banco Fulgencio.',\n project_id: project.id,\n },\n },\n ];\n}\n\nreturn proposalLinks.map((link, index) => {\n const proposalUrl = clean(link.url);\n const fileId = extractGoogleFileId(proposalUrl);\n const syncKey = `${project.id}::${fileId || proposalUrl}`;\n\n return {\n json: {\n skipped: false,\n\n 'NOMBRE': project.title || '',\n 'TIPO DE ACCION': 'PENDIENTE CLASIFICAR',\n 'CLIENTE': project.client || '',\n 'MARCA': project.brand || '',\n 'PAIS': project.country || '',\n 'CANAL': '',\n 'AMBIENTE DE COMPRA (RE)': '',\n 'TÁCTICA PROMOCIONAL': '',\n 'APROBADA': '',\n 'ETIQUETAS': '',\n 'AÑO': getYear(project.created_at),\n 'Enlace a la propuesta': proposalUrl,\n 'Descripcion': project.description || project.title || '',\n 'file_id': fileId,\n 'nombre_archivo': '',\n 'mime_type': '',\n 'fuente_pais': 'Tablero CDC',\n 'confianza_pais': '',\n 'requiere_revision': '',\n 'procesado_ia': 'NO',\n 'ultima_actualizacion': new Date().toISOString(),\n 'motivos_revision': '',\n 'Enlaces a propuestas ejecutadas': '',\n\n 'tablero_sync_key': syncKey,\n 'tablero_project_id': project.id,\n 'tablero_origen': 'Tablero CDC',\n },\n };\n});"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
528,
|
||||
96
|
||||
],
|
||||
"id": "4a37a2a6-3138-455b-8806-288d852873a6",
|
||||
"name": "Code - Preparar filas Fulgencio"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict",
|
||||
"version": 3
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "8b0c7244-a4a1-4fd9-b2eb-dc62b98fb7a3",
|
||||
"leftValue": "={{ $json.skipped }}",
|
||||
"rightValue": "",
|
||||
"operator": {
|
||||
"type": "boolean",
|
||||
"operation": "false",
|
||||
"singleValue": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2.3,
|
||||
"position": [
|
||||
736,
|
||||
96
|
||||
],
|
||||
"id": "5b14f1ea-8203-4daf-8f14-b39da2a7dc97",
|
||||
"name": "IF - Tiene filas para escribir?"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "json",
|
||||
"responseBody": "{\n \"ok\": true,\n \"message\": \"Proyecto sincronizado con Banco Fulgencio\",\n \"source\": \"Tablero CDC\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [
|
||||
1248,
|
||||
0
|
||||
],
|
||||
"id": "c221409e-9777-4453-afa1-ad8bc7107910",
|
||||
"name": "Respond to Webhook"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "json",
|
||||
"responseBody": "{\n \"ok\": true,\n \"skipped\": true,\n \"message\": \"Proyecto sin links de propuesta. No se escribió en Banco Fulgencio.\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1.5,
|
||||
"position": [
|
||||
944,
|
||||
192
|
||||
],
|
||||
"id": "363e5ac4-43be-4a9e-afd0-923bec81a017",
|
||||
"name": "Respond to Webhook1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "appendOrUpdate",
|
||||
"documentId": {
|
||||
"__rl": true,
|
||||
"value": "1iy3lC3DS3ZfShb7d26iQOrPjx9s_3B-PC07XfYew7ng",
|
||||
"mode": "list",
|
||||
"cachedResultName": "BANCO DE PROPUESTAS DE CDC PARA FULGENCIO FUMADO",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iy3lC3DS3ZfShb7d26iQOrPjx9s_3B-PC07XfYew7ng/edit?usp=drivesdk"
|
||||
},
|
||||
"sheetName": {
|
||||
"__rl": true,
|
||||
"value": "gid=0",
|
||||
"mode": "list",
|
||||
"cachedResultName": "propuestas",
|
||||
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iy3lC3DS3ZfShb7d26iQOrPjx9s_3B-PC07XfYew7ng/edit#gid=0"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "defineBelow",
|
||||
"value": {
|
||||
"NOMBRE": "={{ $json[\"NOMBRE\"] }}",
|
||||
"TIPO DE ACCION": "={{ $json[\"TIPO DE ACCION\"] }}",
|
||||
"CLIENTE": "={{ $json[\"CLIENTE\"] }}",
|
||||
"MARCA": "={{ $json[\"MARCA\"] }}",
|
||||
"PAIS": "={{ $json[\"PAIS\"] }}",
|
||||
"CANAL": "={{ $json[\"CANAL\"] }}",
|
||||
"AMBIENTE DE COMPRA (RE)": "={{ $json[\"AMBIENTE DE COMPRA (RE)\"] }}",
|
||||
"TÁCTICA PROMOCIONAL": "={{ $json[\"TÁCTICA PROMOCIONAL\"] }}",
|
||||
"APROBADA": "={{ $json[\"APROBADA\"] }}",
|
||||
"ETIQUETAS": "={{ $json[\"ETIQUETAS\"] }}",
|
||||
"AÑO": "={{ $json[\"AÑO\"] }}",
|
||||
"Enlace a la propuesta": "={{ $json[\"Enlace a la propuesta\"] }}",
|
||||
"Descripcion": "={{ $json[\"Descripcion\"] }}",
|
||||
"file_id": "={{ $json[\"file_id\"] }}",
|
||||
"nombre_archivo": "={{ $json[\"nombre_archivo\"] }}",
|
||||
"mime_type": "={{ $json[\"mime_type\"] }}",
|
||||
"fuente_pais": "={{ $json[\"fuente_pais\"] }}",
|
||||
"confianza_pais": "={{ $json[\"confianza_pais\"] }}",
|
||||
"requiere_revision": "={{ $json[\"requiere_revision\"] }}",
|
||||
"procesado_ia": "={{ $json[\"procesado_ia\"] }}",
|
||||
"ultima_actualizacion": "={{ $json[\"ultima_actualizacion\"] }}",
|
||||
"motivos_revision": "={{ $json[\"motivos_revision\"] }}",
|
||||
"Enlaces a propuestas ejecutadas": "={{ $json[\"Enlaces a propuestas ejecutadas\"] }}",
|
||||
"tablero_project_id": "={{ $json[\"tablero_project_id\"] }}",
|
||||
"tablero_origen": "={{ $json[\"tablero_origen\"] }}",
|
||||
"tablero_sync_key": "={{ $json[\"tablero_sync_key\"] }}"
|
||||
},
|
||||
"matchingColumns": [
|
||||
"tablero_sync_key"
|
||||
],
|
||||
"schema": [
|
||||
{
|
||||
"id": "NOMBRE",
|
||||
"displayName": "NOMBRE",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TIPO DE ACCION",
|
||||
"displayName": "TIPO DE ACCION",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CLIENTE",
|
||||
"displayName": "CLIENTE",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "MARCA",
|
||||
"displayName": "MARCA",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "PAIS",
|
||||
"displayName": "PAIS",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "CANAL",
|
||||
"displayName": "CANAL",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "AMBIENTE DE COMPRA (RE)",
|
||||
"displayName": "AMBIENTE DE COMPRA (RE)",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "TÁCTICA PROMOCIONAL",
|
||||
"displayName": "TÁCTICA PROMOCIONAL",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "APROBADA",
|
||||
"displayName": "APROBADA",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "ETIQUETAS",
|
||||
"displayName": "ETIQUETAS",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "AÑO",
|
||||
"displayName": "AÑO",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Enlace a la propuesta",
|
||||
"displayName": "Enlace a la propuesta",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Descripcion",
|
||||
"displayName": "Descripcion",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "file_id",
|
||||
"displayName": "file_id",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "nombre_archivo",
|
||||
"displayName": "nombre_archivo",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "mime_type",
|
||||
"displayName": "mime_type",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "fuente_pais",
|
||||
"displayName": "fuente_pais",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "confianza_pais",
|
||||
"displayName": "confianza_pais",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "requiere_revision",
|
||||
"displayName": "requiere_revision",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "procesado_ia",
|
||||
"displayName": "procesado_ia",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "ultima_actualizacion",
|
||||
"displayName": "ultima_actualizacion",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "motivos_revision",
|
||||
"displayName": "motivos_revision",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "Enlaces a propuestas ejecutadas",
|
||||
"displayName": "Enlaces a propuestas ejecutadas",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "tablero_sync_key",
|
||||
"displayName": "tablero_sync_key",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true,
|
||||
"removed": false
|
||||
},
|
||||
{
|
||||
"id": "tablero_project_id",
|
||||
"displayName": "tablero_project_id",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
},
|
||||
{
|
||||
"id": "tablero_origen",
|
||||
"displayName": "tablero_origen",
|
||||
"required": false,
|
||||
"defaultMatch": false,
|
||||
"display": true,
|
||||
"type": "string",
|
||||
"canBeUsedToMatch": true
|
||||
}
|
||||
],
|
||||
"attemptToConvertTypes": false,
|
||||
"convertFieldsToString": false
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.googleSheets",
|
||||
"typeVersion": 4.7,
|
||||
"position": [
|
||||
1040,
|
||||
0
|
||||
],
|
||||
"id": "f3bee0f1-50da-4908-923f-51b17a2dbbdc",
|
||||
"name": "Google Sheets - Upsert Banco Fulgencio",
|
||||
"credentials": {
|
||||
"googleSheetsOAuth2Api": {
|
||||
"id": "K0hDZh3a85MpOHCs",
|
||||
"name": "Google Sheets account 2"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "# 🔄 SYNC TABLERO CDC → BANCO FULGENCIO\n\nSincroniza automáticamente un proyecto del Tablero CDC con el Banco de Propuestas de Fulgencio.\n\nFuncionamiento:\n\n1. Recibe mediante Webhook el identificador del proyecto.\n2. Normaliza y valida el project_id recibido.\n3. Consulta en Supabase los datos principales del proyecto.\n4. Recupera los enlaces asociados, como propuestas, presentaciones y artes finales.\n5. Convierte la información al formato requerido por el Banco Fulgencio.\n6. Valida si existen filas aptas para escribir.\n7. Inserta o actualiza el proyecto en Google Sheets.\n8. Devuelve al sistema solicitante el resultado de la sincronización.\n\nDatos procesados:\n\n- Identificador del proyecto.\n- Nombre o descripción de la propuesta.\n- Cliente y marca.\n- País o unidad de negocio.\n- Responsable del proyecto.\n- Estado y fechas disponibles.\n- Enlaces relacionados con la propuesta.\n- Información necesaria para las consultas de Fulgencio.\n\nReglas:\n\n- Supabase es la fuente oficial de los datos del proyecto.\n- Los enlaces se consultan por separado y se relacionan mediante el project_id.\n- El Upsert actualiza una fila existente o crea una nueva, evitando duplicados.\n- Solo se escribe cuando existe información válida para el Banco Fulgencio.\n- Si no hay filas procesables, el flujo termina correctamente sin modificar el Sheet.\n- Ambas ramas responden al Webhook para evitar solicitudes abiertas o tiempos de espera.",
|
||||
"height": 960,
|
||||
"width": 1792,
|
||||
"color": "#24555C"
|
||||
},
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-336,
|
||||
-624
|
||||
],
|
||||
"id": "f561433a-a85c-497c-b3ef-fd36eef3b0b6",
|
||||
"name": "Sticky Note"
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Preparar project_id",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Preparar project_id": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Supabase - Leer proyecto",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Supabase - Leer proyecto": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Supabase - Leer links del proyecto",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Supabase - Leer links del proyecto": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Code - Preparar filas Fulgencio",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Code - Preparar filas Fulgencio": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF - Tiene filas para escribir?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF - Tiene filas para escribir?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Google Sheets - Upsert Banco Fulgencio",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Respond to Webhook1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Google Sheets - Upsert Banco Fulgencio": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Webhook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1",
|
||||
"binaryMode": "separate",
|
||||
"availableInMCP": true,
|
||||
"timeSavedMode": "fixed",
|
||||
"errorWorkflow": "puF4LUczoSz3hcek",
|
||||
"timezone": "America/Santo_Domingo",
|
||||
"callerPolicy": "workflowsFromSameOwner"
|
||||
},
|
||||
"versionId": "5b0c04ba-7275-4352-b6af-323cd6ead268",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "b4b77b17af092830e794eef639ce2f6d7daccf7eddc075060b03b3b6545aac70"
|
||||
},
|
||||
"id": "k2NNakqj2TaP0HKy",
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user