{
  "name": "Workflow 2",
  "nodes": [
    {
      "parameters": {
        "content": "## FLUJO 2 · Lectura del comprobante\n### Bloque 2 · acá entra la IA\n\n**El modelo lee. La lógica decide.**\n\nEl agente no tiene herramientas y no decide nada. Extrae y reporta. El Switch de la derecha es el que decide, y es 100% determinista.\n\n**Los dos gates corren ANTES del modelo.**\nFiltrar es gratis, llamar al modelo no. Un mensaje de texto sin adjunto nunca debería llegar a Gemini.\n\n**Trampa para decir en voz alta:** los echeques llegan como PDF del banco. El filtro de mime NO los detecta. Esa exclusión vive en la clasificación, no acá.",
        "height": 660,
        "width": 460,
        "color": 3
      },
      "id": "1afc5294-8540-4080-beb9-0bf6a59b8e39",
      "name": "Nota 2 · Cabecera",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -688,
        -96
      ]
    },
    {
      "parameters": {
        "content": "### El esquema deja decir \"no sé\"\n\n`campos_ilegibles` es la lista de lo que el modelo NO pudo leer, y es lo que escribe la respuesta al cliente.\n\n**La regla del prompt que más importa:**\nnunca inferir un campo que no esté visible.\n\nUn monto inventado se ve igual que uno correcto. La corrupción silenciosa es peor que la falla visible.",
        "height": 300,
        "width": 380,
        "color": 6
      },
      "id": "99a86d48-a975-406c-b3b6-b1089ef6a349",
      "name": "Nota 2 · Esquema",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        64,
        -400
      ]
    },
    {
      "parameters": {
        "options": {
          "allowFileUploads": true,
          "responseMode": "responseNodes"
        }
      },
      "id": "7db113aa-07b4-409a-bf50-b81a25a5f42c",
      "name": "2 · Chat con archivos",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        -128,
        288
      ],
      "webhookId": "9a705923-bc82-4430-a153-8756eebb6630"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "f1",
              "leftValue": "={{ $input.first().binary }}",
              "rightValue": 0,
              "operator": {
                "type": "object",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "d91af04b-d75f-465d-8510-ef3556e1651e",
      "name": "2 · Gate 1 · Tiene adjunto",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        80,
        288
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "g1",
              "leftValue": "={{ $binary.data0.mimeType }}",
              "rightValue": "image/jpeg",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "f3fd273b-7560-45db-9411-1698c1b86a08",
              "leftValue": "={{ $binary.data0.mimeType }}",
              "rightValue": "image/png",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "41d3497b-fe1d-415b-bf45-cc42edffbd92",
              "leftValue": "={{ $binary.data0.mimeType }}",
              "rightValue": "application/pdf",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "id": "e7e4aa3a-37c2-4d71-bbf6-39e914c51b02",
      "name": "2 · Gate 2 · Formato permitido",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        288,
        80
      ]
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "id": "b279dce2-0ec8-429f-a58a-010666dd770e",
      "name": "2 · Modelo de lectura",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        448,
        304
      ],
      "credentials": {
        "googlePalmApi": {
          "id": "RgVqEdOagyRoNvuP",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"tipo_documento\": \"comprobante_transferencia\",\n  \"monto\": 125430.50,\n  \"fecha\": \"2026-08-14\",\n  \"numero_operacion\": \"0012345678\",\n  \"titular_origen\": \"Carniceria San Martin SRL\",\n  \"cbu_cvu_destino\": \"0170099220000012345678\",\n  \"alias_destino\": \"frigorifico.oeste\",\n  \"banco_origen\": \"Banco Galicia\",\n  \"cuenta_origen\": \"CBU o CVU o ALIAS de origen\",\n  \"campos_ilegibles\": [\"monto\"]\n}"
      },
      "id": "f2e0a174-9318-420c-b30b-d74272e9c152",
      "name": "2 · Esquema del comprobante",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        720,
        304
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "h1",
              "name": "tipo_documento",
              "value": "={{ $json.output?.tipo_documento ?? $json.tipo_documento ?? \"\" }}",
              "type": "string"
            },
            {
              "id": "h2",
              "name": "monto",
              "value": "={{ $json.output.monto }}",
              "type": "number"
            },
            {
              "id": "h3",
              "name": "fecha",
              "value": "={{ $json.output.fecha }}",
              "type": "string"
            },
            {
              "id": "h4",
              "name": "numero_operacion",
              "value": "={{ $json.output.numero_operacion }}",
              "type": "string"
            },
            {
              "id": "h5",
              "name": "titular_origen",
              "value": "={{ $json.output.titular_origen }}",
              "type": "string"
            },
            {
              "id": "h6",
              "name": "cbu_cvu_destino",
              "value": "={{ $json.output.cbu_cvu_destino }}",
              "type": "string"
            },
            {
              "id": "h7",
              "name": "alias_destino",
              "value": "={{ $json.output.alias_destino }}",
              "type": "string"
            },
            {
              "id": "h8",
              "name": "banco_origen",
              "value": "={{ $json.output.banco_origen }}",
              "type": "string"
            },
            {
              "id": "h9",
              "name": "campos_ilegibles",
              "value": "={{ ($json.output.campos_ilegibles ?? []).join(\", \") }}",
              "type": "string"
            },
            {
              "id": "184805c4-6fba-4d6e-95b4-8cae65947fb9",
              "name": "cuenta_origen",
              "value": "={{ $json.output.cuenta_origen }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "f2dc4d0e-746b-4c25-a591-c0ca78d4e3da",
      "name": "2 · Aplanar la salida",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        880,
        128
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "k3",
                    "leftValue": "={{ $json.tipo_documento }}",
                    "operator": {
                      "operation": "equals",
                      "type": "string"
                    },
                    "rightValue": "comprobante_transferencia"
                  },
                  {
                    "id": "k3b",
                    "leftValue": "={{ $json.campos_ilegibles }}",
                    "operator": {
                      "operation": "empty",
                      "singleValue": true,
                      "type": "string"
                    },
                    "rightValue": ""
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "k2",
                    "leftValue": "={{ $json.tipo_documento }}",
                    "rightValue": "echeque",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "k1",
                    "leftValue": "={{ $json.campos_ilegibles }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "notEmpty",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "rechazo"
        }
      },
      "id": "5efafa77-fbcd-4ac5-b98f-cad42172860e",
      "name": "2 · La lógica decide",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1072,
        96
      ]
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "U5Kd6nJ96fI4ESk9",
          "mode": "list",
          "cachedResultUrl": "/workflow/U5Kd6nJ96fI4ESk9",
          "cachedResultName": "n8n Argentina — Workshop - Workflow 1"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "monto": "={{ $json.monto }}",
            "fecha": "={{ $json.fecha }}",
            "numero_operacion": "={{ $json.numero_operacion }}",
            "titular_origen": "={{ $json.titular_origen }}",
            "cbu_cvu_destino": "={{ $json.cbu_cvu_destino }}",
            "alias_destino": "={{ $json.alias_destino }}",
            "banco_origen": "={{ $json.banco_origen }}",
            "cuenta_origen": "={{ $json.cuenta_origen }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "monto",
              "displayName": "monto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "number",
              "removed": false
            },
            {
              "id": "fecha",
              "displayName": "fecha",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "numero_operacion",
              "displayName": "numero_operacion",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "titular_origen",
              "displayName": "titular_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "cbu_cvu_destino",
              "displayName": "cbu_cvu_destino",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "alias_destino",
              "displayName": "alias_destino",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "banco_origen",
              "displayName": "banco_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "cuenta_origen",
              "displayName": "cuenta_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "id": "631adbbe-7da7-4991-b8dc-6caf0e039d8f",
      "name": "2 · Registrar en el pipeline",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        1312,
        -176
      ]
    },
    {
      "parameters": {
        "message": "=Recibimos un echeque. Lo revisa una persona del equipo y te confirmamos.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        1376,
        272
      ],
      "id": "aeea4391-d0c3-48e6-9e3a-2ab06315ffa9",
      "name": "2 · Respuesta · echeque",
      "webhookId": "8e3cc7a9-60dd-4079-af7f-320ba0b216b9"
    },
    {
      "parameters": {
        "message": "=Eso no parece un comprobante de transferencia. Me lo mandas de nuevo como imagen o PDF?",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        1376,
        432
      ],
      "id": "def5ad93-af8c-411d-8cb1-8f5271c3543f",
      "name": "2 · Respuesta · no es comprobante",
      "webhookId": "8e3cc7a9-60dd-4079-af7f-320ba0b216b9"
    },
    {
      "parameters": {
        "message": "={{ \"No pude leer bien: \" + $json.campos_ilegibles + \". Me mandas una foto mas clara del comprobante?\" }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        1376,
        112
      ],
      "id": "cf5d8d80-81ff-4457-ad32-73d26546c57e",
      "name": "2 · Respuesta · foto más clara",
      "webhookId": "8e3cc7a9-60dd-4079-af7f-320ba0b216b9"
    },
    {
      "parameters": {
        "message": "=Solo podemos leer imagenes (JPG, PNG) o PDF. Me lo mandas en alguno de esos formatos?",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        576,
        -96
      ],
      "id": "63dccb92-b310-425f-8fb4-4b4cc1e085cd",
      "name": "2 · Respuesta · formato no soportado",
      "webhookId": "8e3cc7a9-60dd-4079-af7f-320ba0b216b9"
    },
    {
      "parameters": {
        "message": "=Mandanos el comprobante como imagen o PDF y lo cargamos al toque.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        288,
        384
      ],
      "id": "fc87718f-9a71-4309-929a-eab7db53bcf1",
      "name": "2 · Respuesta · falta adjunto",
      "webhookId": "8e3cc7a9-60dd-4079-af7f-320ba0b216b9"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "Extrae los datos del comprobante adjunto y devolvelos segun el esquema.",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=Sos un extractor de datos de comprobantes de transferencia bancaria de Argentina.\n\nDevolves unicamente los campos del esquema, sin explicaciones.\n\nReglas:\n\n1. Nunca infieras ni completes un campo que no este visible en el documento. Si no se puede leer, devolve cadena vacia.\n\n2. Todo campo que no puedas leer con certeza va listado en campos_ilegibles.\n\n3. monto es un numero, sin simbolo de moneda y con punto como separador decimal. Todos los montos son en pesos argentinos.\n\n4. fecha es la fecha en que se hizo la transferencia, no la fecha en que se recibio el documento. Formato YYYY-MM-DD.\n\n5. cbu_cvu_destino es la cuenta que recibe el dinero. Si esta enmascarada, devolve exactamente lo que se ve.\n\n6. tipo_documento:\n   comprobante_transferencia = comprobante de transferencia o pago\n   echeque = cheque electronico\n   otro_documento = es un documento pero no un comprobante de pago (factura, remito, DNI)\n   no_es_documento = la imagen no es un documento\n\n7. cuenta_origen\n   se refiere al CVU o CBU o Alias del origen de la transacción si existe",
          "passthroughBinaryImages": true,
          "passthroughBinaryPdfs": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        528,
        128
      ],
      "id": "dba9fae8-8af8-4ce9-ae5f-3187072e2ce3",
      "name": "2 · Leer el comprobante"
    },
    {
      "parameters": {
        "content": "### El orden del Switch importa\n\n1. `echeque` → fuera de alcance\n2. `comprobante_transferencia` **Y** sin campos ilegibles → se registra\n3. `campos_ilegibles` no vacío → pedir foto\n4. fallback → rechazo\n\n**La condición doble del caso 2 es el arreglo.** Sin ella, un comprobante válido pero borroso matchea el caso 2 antes que el 3, y se registra con campos vacíos en vez de pedir una foto mejor.\n\nEs el comprobante #4 del kit de prueba. Vale correrlo en vivo.",
        "height": 340,
        "width": 380,
        "color": 5
      },
      "id": "06aab796-d0ab-472a-8783-18c5295c68c3",
      "name": "Nota 2 · Switch",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1904,
        192
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.body.message.kapso.media_data.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data0"
            }
          }
        }
      },
      "id": "ac1a2b7d-19eb-449c-bad0-6a6ae692b021",
      "name": "2.5 · Descargar adjunto de Kapso",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        128,
        640
      ],
      "disabled": true
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "workshop-kapso",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -144,
        640
      ],
      "id": "6bdf7f06-08eb-49c9-9921-01e8c3c2da27",
      "name": "2.5 · Webhook de Kapso",
      "webhookId": "0511ec3e-2236-46d0-9e1c-e12b9991fc70",
      "disabled": true
    },
    {
      "parameters": {
        "content": "## 2.5 · El puente\n### Entre el bloque 2 y el bloque 3\n\nAcá se muestra, sin construirlo entero, que la diferencia entre el chat y WhatsApp es **un solo nodo**.\n\nEl Chat Trigger entrega binario directo.\nKapso entrega una URL.\n\nEste HTTP Request es todo lo que hace falta para cubrir esa diferencia. El resto del flujo 2 no se toca.\n\nQueda desconectado a propósito, es para mostrarlo en pantalla.\n\nCuidado con el URL del webhook no exista en otro Workflow publicado",
        "height": 504,
        "width": 400,
        "color": 7
      },
      "id": "af433b2c-65e3-46d9-96bc-14d599836a6a",
      "name": "Nota 2.5 · Puente",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        432,
        560
      ]
    },
    {
      "parameters": {
        "message": "={{ \"Listo, registramos tu transferencia de $\" + $('2 · Aplanar la salida').item.json.monto + \" del \" + $('2 · Aplanar la salida').item.json.fecha + \". Gracias!\" }}",
        "options": {}
      },
      "id": "3c64f4c1-deee-4d71-a19f-93d6db28344e",
      "name": "2 · Respuesta · registrado",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        1584,
        -176
      ],
      "webhookId": "6e68c7b4-1a9d-42fc-aa2e-dcd331d9a5ea"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1X-IWEO-UXIM8SQUzAew9bsA0LZD64m4C2HgS4CFjTDo",
          "mode": "list",
          "cachedResultName": "Workshop - Planilla",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1X-IWEO-UXIM8SQUzAew9bsA0LZD64m4C2HgS4CFjTDo/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 192787763,
          "mode": "list",
          "cachedResultName": "Comprobantes",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1X-IWEO-UXIM8SQUzAew9bsA0LZD64m4C2HgS4CFjTDo/edit#gid=192787763"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "monto": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.monto }}",
            "fecha": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.fecha }}",
            "numero_operacion": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.numero_operacion }}",
            "titular_origen": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.titular_origen }}",
            "banco_origen": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.banco_origen }}",
            "estado": "Recibido",
            "recibido_en": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.recibido_en }}",
            "alias_destino": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.alias_destino }}",
            "cbu_cvu_destino": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.cbu_cvu_destino }}",
            "cuenta_origen": "={{ $('1 · Check 1 · Cuenta destino es nuestra').item.json.cuenta_origen }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "recibido_en",
              "displayName": "recibido_en",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "estado",
              "displayName": "estado",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "monto",
              "displayName": "monto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "fecha",
              "displayName": "fecha",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "numero_operacion",
              "displayName": "numero_operacion",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "titular_origen",
              "displayName": "titular_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "banco_origen",
              "displayName": "banco_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "cuenta_origen",
              "displayName": "cuenta_origen",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "cbu_cvu_destino",
              "displayName": "cbu_cvu_destino",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "alias_destino",
              "displayName": "alias_destino",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "detalle",
              "displayName": "detalle",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "bb5441af-9383-4edd-b052-2eecb8a4517a",
      "name": "Guardar en la planilla (opcional)",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1664,
        256
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "w7bVwc6Va7gj643u",
          "name": "Google Sheets account"
        }
      },
      "disabled": true,
      "onError": "continueErrorOutput"
    }
  ],
  "pinData": {
    "3 · Webhook de Kapso": [
      {
        "json": {
          "headers": {
            "host": "tanco.app.n8n.cloud",
            "user-agent": "Ruby",
            "content-length": "2979",
            "accept": "*/*",
            "accept-encoding": "gzip, br",
            "baggage": "sentry-trace_id=9eb835a58ae247209e7c97f34f46ee26,sentry-environment=production,sentry-release=3d2a21d78bf48c5895f7758554a84c600bf94a6e,sentry-public_key=8ca2cccc6fc9b2350baf295c391c484b",
            "cdn-loop": "cloudflare; loops=1; subreqs=1",
            "cf-connecting-ip": "74.220.48.184",
            "cf-ew-via": "15",
            "cf-ipcountry": "US",
            "cf-ray": "a360fd64e86f302c-PDX",
            "cf-visitor": "{\"scheme\":\"https\"}",
            "cf-worker": "n8n.cloud",
            "content-type": "application/json",
            "sentry-trace": "9eb835a58ae247209e7c97f34f46ee26-7ed5ac073eff480a",
            "x-forwarded-for": "74.220.48.184, 104.23.160.43",
            "x-forwarded-host": "tanco.app.n8n.cloud",
            "x-forwarded-port": "443",
            "x-forwarded-proto": "https",
            "x-forwarded-server": "traefik-prod-users-gwc-76-5cbf5f4d76-676b4",
            "x-idempotency-key": "8d5114553b9b26948371efaa962fde30b9ccc7dcb6fb663c0580854a701aef7b",
            "x-is-trusted": "yes",
            "x-real-ip": "74.220.48.184",
            "x-webhook-event": "whatsapp.message.received",
            "x-webhook-payload-version": "v2",
            "x-webhook-signature": "96d7d98020e7abea607a7ac5acfa10ccb5dc127d8ff8cc1fcdf8b4ea2060514e"
          },
          "params": {},
          "query": {},
          "body": {
            "message": {
              "id": "wamid.HBgNNTQ5MTEyNTEwMjk5ORUCABIYIEFDNDI0MkRDNjYxNTE5Q0M5QjJEMEQ3NTMyMTExNjlCAA==",
              "from": "541125102999",
              "type": "image",
              "image": {
                "id": "1797960724692043",
                "url": "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1797960724692043&source=webhook&ext=1788567103&hash=ATwdMC2qdxzAxt75MZJcGH8oYn90ycFh6QUB9KKTzOrIFg",
                "link": "https://app.kapso.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6ImIxZWQ5YmIyLWQ1NWItNDk3OC05ZTQ2LWMxYThjOWJhNzdmZCIsInB1ciI6ImJsb2JfaWQifX0=--ec6a3153bfc897f084c771265a2f835267b8de8e/image_aad2580b4cdc.jpeg",
                "sha256": "Nrx57GDv329J+i9cvqab/v+MAJ00khEzG26/nc2z/Ww=",
                "mime_type": "image/jpeg"
              },
              "kapso": {
                "origin": "cloud_api",
                "status": "delivered",
                "content": "Image attached (image_aad2580b4cdc.jpeg) [Size: 54.5 KB | Type: image/jpeg] URL: https://app.kapso.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6ImIxZWQ5YmIyLWQ1NWItNDk3OC05ZTQ2LWMxYThjOWJhNzdmZCIsInB1ciI6ImJsb2JfaWQifX0=--ec6a3153bfc897f084c771265a2f835267b8de8e/image_aad2580b4cdc.jpeg",
                "direction": "inbound",
                "has_media": true,
                "media_url": "https://app.kapso.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6ImIxZWQ5YmIyLWQ1NWItNDk3OC05ZTQ2LWMxYThjOWJhNzdmZCIsInB1ciI6ImJsb2JfaWQifX0=--ec6a3153bfc897f084c771265a2f835267b8de8e/image_aad2580b4cdc.jpeg",
                "media_data": {
                  "url": "https://app.kapso.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6ImIxZWQ5YmIyLWQ1NWItNDk3OC05ZTQ2LWMxYThjOWJhNzdmZCIsInB1ciI6ImJsb2JfaWQifX0=--ec6a3153bfc897f084c771265a2f835267b8de8e/image_aad2580b4cdc.jpeg",
                  "filename": "image_aad2580b4cdc.jpeg",
                  "byte_size": 55845,
                  "content_type": "image/jpeg"
                },
                "message_type_data": {
                  "caption": "",
                  "has_media": true
                },
                "processing_status": "pending"
              },
              "context": {
                "forwarded": true
              },
              "username": null,
              "timestamp": "1788566803",
              "from_user_id": "AR.1104624778565417",
              "from_parent_user_id": null
            },
            "conversation": {
              "id": "4cd65b1d-019f-4770-aa58-8659beddcb67",
              "kapso": {
                "messages_count": 8,
                "last_inbound_at": "2026-09-05T00:06:43.736012Z",
                "last_message_id": "wamid.HBgNNTQ5MTEyNTEwMjk5ORUCABIYIEFDNDI0MkRDNjYxNTE5Q0M5QjJEMEQ3NTMyMTExNjlCAA==",
                "last_outbound_at": "2026-09-05T00:06:09.603707Z",
                "last_message_text": "Image attached (image_aad2580b4cdc.jpeg) [Size: 54.5 KB | Type: image/jpeg] URL: https://app.kapso.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6ImIxZWQ5YmIyLWQ1NWItNDk3OC05ZTQ2LWMxYThjOWJhNzdmZCIsInB1ciI6ImJsb2JfaWQifX0=--ec6a3153bfc897f084c771265a2f835267b8de8e/image_aad2580b4cdc.jpeg",
                "last_message_type": "image",
                "last_message_timestamp": "2026-09-05T00:06:43.736012Z"
              },
              "status": "active",
              "metadata": {},
              "username": null,
              "created_at": "2026-09-04T18:39:41-04:00",
              "updated_at": "2026-09-04T20:06:43-04:00",
              "contact_name": "Tanco",
              "phone_number": "541125102999",
              "last_active_at": "2026-09-04T20:06:43-04:00",
              "phone_number_id": "597907523413541",
              "business_scoped_user_id": "AR.1104624778565417",
              "parent_business_scoped_user_id": null
            },
            "phone_number_id": "597907523413541",
            "is_new_conversation": false
          },
          "webhookUrl": "https://tanco.app.n8n.cloud/webhook/workshop-kapso",
          "executionMode": "production"
        }
      }
    ],
    "2 · Chat con archivos": [
      {
        "json": {
          "action": "sendMessage",
          "sessionId": "0565b17e06264b8483b131020d352002",
          "chatInput": "Mi comprobante",
          "files": [
            {
              "fileName": "WhatsApp Image 2026-09-05 at 11.35.55.jpeg",
              "fileSize": "63.8 kB",
              "fileType": "image",
              "mimeType": "image/jpeg",
              "fileExtension": "jpg",
              "binaryKey": "data0"
            }
          ]
        },
        "binary": {
          "data0": {
            "mimeType": "image/jpeg",
            "fileType": "image",
            "fileExtension": "jpg",
            "data": "filesystem-v2",
            "fileName": "WhatsApp Image 2026-09-05 at 11.35.55.jpeg",
            "id": "filesystem-v2:workflows/tO3GT78sVxlmAkn5/executions/temp/binary_data/85cbf2ee-d3ba-44da-8344-1ba4674d9159",
            "fileSize": "63.8 kB",
            "bytes": 63753
          }
        },
        "pairedItem": {
          "item": 0
        }
      }
    ]
  },
  "connections": {
    "2 · Chat con archivos": {
      "main": [
        [
          {
            "node": "2 · Gate 1 · Tiene adjunto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · Gate 1 · Tiene adjunto": {
      "main": [
        [
          {
            "node": "2 · Gate 2 · Formato permitido",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2 · Respuesta · falta adjunto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · Gate 2 · Formato permitido": {
      "main": [
        [
          {
            "node": "2 · Leer el comprobante",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2 · Respuesta · formato no soportado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · Modelo de lectura": {
      "ai_languageModel": [
        [
          {
            "node": "2 · Leer el comprobante",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "2 · Esquema del comprobante": {
      "ai_outputParser": [
        [
          {
            "node": "2 · Leer el comprobante",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "2 · Aplanar la salida": {
      "main": [
        [
          {
            "node": "2 · La lógica decide",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · La lógica decide": {
      "main": [
        [
          {
            "node": "2 · Registrar en el pipeline",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2 · Respuesta · echeque",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2 · Respuesta · foto más clara",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2 · Respuesta · no es comprobante",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · Leer el comprobante": {
      "main": [
        [
          {
            "node": "2 · Aplanar la salida",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2 · Registrar en el pipeline": {
      "main": [
        []
      ]
    },
    "2.5 · Webhook de Kapso": {
      "main": [
        [
          {
            "node": "2.5 · Descargar adjunto de Kapso",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": true
  },
  "versionId": "84855db3-911a-41b2-ae6c-41c49eb456c4",
  "meta": {
    "aiBuilderAssisted": true,
    "builderVariant": "mcp",
    "templateCredsSetupCompleted": true,
    "instanceId": "5368e3d42db5094d7b9c43512651646c73789011a338d7142afe9f0fc528d5ec"
  },
  "nodeGroups": [],
  "id": "tO3GT78sVxlmAkn5",
  "tags": []
}