{
  "id": "glCmWxJzmXExqPi8",
  "createdAt": "2023-08-07T22:49:28.196Z",
  "updatedAt": "2024-01-29T13:00:17.678Z",
  "name": "Base Link a DW",
  "active": true,
  "nodes": [
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst uniqueItems = [];\nconst seenValues = {};\n\nfor (let i = $input.all().length - 1; i >= 0; i--) {\n  const item = $input.all()[i];\n  const rut = item.json['Rut_pagadores'].toString().replace('k', 'K').replace(/[-.\\n]/g, '');\n  \n  if (!seenValues[rut]) {\n    uniqueItems.unshift(item);\n    seenValues[rut] = true;\n  }\n}\n\nreturn uniqueItems;\n\n"
      },
      "id": "14682e29-eb55-4f55-b1f0-5075f5339754",
      "name": "Code4",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        360
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyWeek",
              "hour": 10
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E/edit?usp=drivesdk",
          "cachedResultName": "CL Panel de Riesgo"
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1713282289,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E/edit#gid=1713282289",
          "cachedResultName": "lista LINK"
        },
        "options": {}
      },
      "id": "7911a20f-5cce-4382-ab15-095898edec8e",
      "name": "Llamar Lista Link",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -20,
        360
      ],
      "typeVersion": 1,
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "document_number",
              "value": "={{ $json.Rut_pagadores }}"
            },
            {
              "name": "classification",
              "value": "={{ $json.LINK }}"
            }
          ]
        },
        "options": {}
      },
      "id": "59356750-44dc-422f-a09a-0b834277673f",
      "name": "Set4",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        360
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.document_number }}",
              "operation": "notEqual",
              "value2": "={{ '' }}"
            }
          ]
        }
      },
      "id": "40f3791c-f469-4b2b-b34f-f80c86f5e356",
      "name": "Filter4",
      "type": "n8n-nodes-base.filter",
      "position": [
        680,
        360
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "=insert into link_classification (document_number, classification)\nvalues ('{{ $json[\"document_number\"] }}','{{ $json[\"classification\"] }}')\non duplicate key update classification = '{{ $json[\"classification\"] }}'",
        "options": {}
      },
      "id": "054985c8-ff1d-4e92-86a4-9e6552fad2a8",
      "name": "MySQL2",
      "type": "n8n-nodes-base.mySql",
      "position": [
        1040,
        360
      ],
      "typeVersion": 2.1,
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Set4": {
      "main": [
        [
          {
            "node": "Filter4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code4": {
      "main": [
        [
          {
            "node": "Set4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter4": {
      "main": [
        [
          {
            "node": "MySQL2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Llamar Lista Link": {
      "main": [
        [
          {
            "node": "Code4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "staticData": {
    "node:Llamar Post-confirmado": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 394331852,
      "lastRevision": 5704,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=5704&exportFormat=xlsx"
    },
    "node:Llamar Lista Link": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 1713282289,
      "lastRevision": 10330,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=10330&exportFormat=xlsx"
    },
    "node:Llamar Grupos econ\u00f3micos": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 924453781,
      "lastRevision": 5706,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=5706&exportFormat=xlsx"
    },
    "node:Llamar Bloqueados": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 940588543,
      "lastRevision": 5707,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=5707&exportFormat=xlsx"
    },
    "node:Llamar Comit\u00e9": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 1052543507,
      "lastRevision": 5278,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=5278&exportFormat=xlsx"
    },
    "node:Llamar Lista Pagadores": {
      "documentId": "1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E",
      "sheetId": 924696945,
      "lastRevision": 5275,
      "lastRevisionLink": "https://docs.google.com/spreadsheets/export?id=1gfL6x1A6n2lbKuqaNrj-44lKxyX3HOLXtfoLcFONl6E&revision=5275&exportFormat=xlsx"
    }
  },
  "versionId": "01f4ba9a-ee45-442a-9e31-3b64ace83a5d",
  "triggerCount": 1,
  "tags": []
}