{
  "nodes": [
    {
      "id": "2744df51-ca51-4c01-9a49-b29c5b27f7bf",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        200
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cae73f18-028e-4cb5-aee2-a18768c5367e",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        480,
        100
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "urls"
      },
      "typeVersion": 1
    },
    {
      "id": "398d41cf-c555-44d7-bf08-2732a47a18e7",
      "name": "URLs",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        100
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\"urls\":{\"URL 1\":\"https://example.com\",\"URL 2\":\"https://google.es\",\"URL 3\":\"https://github.com\"}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "760cea59-8d84-4abf-b91a-c277ca122420",
      "name": "Run trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "01fd1dbc-ca4c-4a94-abbc-e1d67a7dd775",
      "name": "Bucle URLs",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        700,
        100
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "464a16ea-17f0-4757-b491-1b331395cd14",
      "name": "Request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        960,
        220
      ],
      "parameters": {
        "url": "={{ $json.urls }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "876e4ca3-c607-4443-a4ec-cb83fe84e6c3",
      "name": "Success",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        260
      ],
      "parameters": {
        "columns": {
          "value": {
            "Caida": "=",
            "Funcional": "=Funciona: {{ $('Split Out').item.json.urls }}"
          },
          "schema": [
            {
              "id": "Funcional",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Funcional",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caida",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Caida",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c99e1ec7-0b11-4278-8f97-d6b9cef798cd",
      "name": "Error",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        460
      ],
      "parameters": {
        "columns": {
          "value": {
            "Caida": "=Caida: {{ $json.urls }}"
          },
          "schema": [
            {
              "id": "Funcional",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Funcional",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caida",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Caida",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d5fb83e9-689f-44f3-a02a-32ff511c9ee0",
      "name": "Split Out2",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1360,
        20
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "url"
      },
      "typeVersion": 1
    },
    {
      "id": "9aeec8f1-1498-4381-bfab-a76c8e40a862",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1560,
        20
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Te informamos que actualmente estos URLs se encuentran caídos: {{ $json.url }}",
        "options": {},
        "subject": "Webs caídas"
      },
      "typeVersion": 2.1
    },
    {
      "id": "1ec7a4ea-e929-4f50-b4b8-4732b9e439ed",
      "name": "Total",
      "type": "n8n-nodes-base.summarize",
      "position": [
        960,
        20
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Caida"
            },
            {
              "field": "Funcional"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "code",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1160,
        20
      ],
      "parameters": {
        "jsCode": "const items = $items('Bucle URLs'); const caidaUrls = items.map(it => it.json.Caida).filter(url => typeof url === 'string' && url.trim().length); if (caidaUrls.length === 0) { throw new Error('No se encontraron URLs en la propiedad \"Caida\".'); } return caidaUrls.map(url => ({ json: { url } }));"
      },
      "typeVersion": 2
    },
    {
      "id": "5df0c197-037d-46da-bc4b-fd7ed514bbe5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        40
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 220,
        "content": "### Enter URLs to scan here"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Run trigger": {
      "main": [
        [
          {
            "node": "URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URLs": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Bucle URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bucle URLs": {
      "main": [
        [
          {
            "node": "Total",
            "type": "main",
            "index": 0
          },
          {
            "node": "Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Total": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Split Out2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out2": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          },
          {
            "node": "Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}