{
  "name": "n8n-mi-primer-flujo",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -656,
        16
      ],
      "id": "8cd2b836-1df2-4126-a7f6-64010349b354",
      "name": "clic"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE",
          "mode": "list",
          "cachedResultName": "n8n-mi-primer-flujo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Hoja 1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -432,
        -208
      ],
      "id": "76edfa5b-a2b8-453e-86a5-40a0a688d0ee",
      "name": "Obtener-filas",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "5e78eda5-753b-409b-9205-90f5db2b59e6",
              "leftValue": "={{ $json.Name }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            },
            {
              "id": "904ab979-aeb5-49f2-b30d-e1fba9007055",
              "leftValue": "={{ $json.Tipo }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        -208,
        -208
      ],
      "id": "c72444d0-d3b0-470f-9219-b7da97115f99",
      "name": "Filtrar-datos"
    },
    {
      "parameters": {
        "url": "=https://pokeapi.co/api/v2/pokemon/{{ $json.ID }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        16,
        -208
      ],
      "id": "564e3037-1bc9-44c0-9c77-a3d86286ee35",
      "name": "Obtener-datos"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ca0ef82d-737e-4e6b-925e-6a9563033d99",
              "name": "id",
              "value": "={{ $json.id }}",
              "type": "number"
            },
            {
              "id": "013b37a8-5dee-486f-a36d-03d59a94cc5e",
              "name": "name",
              "value": "={{ $json.name }}",
              "type": "string"
            },
            {
              "id": "e4b6d381-3938-435e-8b48-e9aed0dbc148",
              "name": "type",
              "value": "={{ $json.types[0].type.name }}",
              "type": "string"
            },
            {
              "id": "5d17b38a-5737-434a-bfff-faaaa01b4626",
              "name": "photos.front",
              "value": "={{ $json.sprites.front_default }}",
              "type": "string"
            },
            {
              "id": "c22abdc6-fe5d-4265-99c0-1a109cf46e2e",
              "name": "photos.back",
              "value": "={{ $json.sprites.back_default }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        -208
      ],
      "id": "483f9231-beed-471c-b82b-87f6ff6ea1c8",
      "name": "Extraer-datos"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE",
          "mode": "list",
          "cachedResultName": "n8n-mi-primer-flujo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Hoja 1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1FDZm-Sskbwe0fJPEohECBmf35Koa_ppN5ZNy6b7IzkE/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $json.id }}",
            "Name": "={{ $json.name }}",
            "Tipo": "={{ $json.type }}",
            "Sprite Frontal": "={{ $json.photos.front }}",
            "Sprite Posterior": "={{ $json.photos.back }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Tipo",
              "displayName": "Tipo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Sprite Frontal",
              "displayName": "Sprite Frontal",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Sprite Posterior",
              "displayName": "Sprite Posterior",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        464,
        -208
      ],
      "id": "64613b08-de4f-4184-ac26-c71b20546de3",
      "name": "Actualizar-filas",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "ID"
            },
            {
              "fieldToAggregate": "Name"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        688,
        -208
      ],
      "id": "76c15ae3-ffdf-4dd2-a545-8104a65d869d",
      "name": "Combinar-resultado"
    },
    {
      "parameters": {
        "sendTo": "jncordovaa@gmail.com",
        "subject": "Registro Pokemon Actualizado",
        "message": "=<h1>Proceso Terminado</h1>\n\n<h2>Nuevos registros</h2>\n{{ $json.ID }}\n<br/>\n{{ $json.Name }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        912,
        -208
      ],
      "id": "20bb3b89-f67b-4146-90f1-cb46017a68d8",
      "name": "Enviar-correo",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 1
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -656,
        -208
      ],
      "id": "3abd3671-3482-4d36-a820-16a9cb2d56c0",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "clic": {
      "main": [
        []
      ]
    },
    "Obtener-filas": {
      "main": [
        [
          {
            "node": "Filtrar-datos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtrar-datos": {
      "main": [
        [
          {
            "node": "Obtener-datos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Obtener-datos": {
      "main": [
        [
          {
            "node": "Extraer-datos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraer-datos": {
      "main": [
        [
          {
            "node": "Actualizar-filas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Actualizar-filas": {
      "main": [
        [
          {
            "node": "Combinar-resultado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combinar-resultado": {
      "main": [
        [
          {
            "node": "Enviar-correo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Obtener-filas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7f0256fe-36d8-4f56-a7ec-07091b9751bf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Ps2rmpKSZntr5Dw9",
  "tags": []
}