{
  "name": "Practica 3 - Ejercicio 1",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        176
      ],
      "id": "e04eafdf-fcbb-4d1b-a254-7fc88d4f669a",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "url": "https://v2.jokeapi.dev/joke/Programming,Misc,Dark?type=single&amount=10",
        "options": {
          "response": {
            "response": {}
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        224,
        176
      ],
      "id": "5a67a64e-e1d8-4c4e-a16b-ae2b4c4e3940",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "fieldToSplitOut": "jokes",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        448,
        176
      ],
      "id": "e2bd1423-ea60-4669-a1df-f7db633b62eb",
      "name": "Split Out"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Programming",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "d79e69b0-2021-4552-b069-7a1bcd35b0fa"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Programming"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "73b9d479-6c9f-40d8-8a1a-37c58487b33f",
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Misc",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Misc"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c2a3dffd-59ce-48a2-92b2-f471b92805ec",
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Dark",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Dark"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        672,
        160
      ],
      "id": "b7fa8030-fe2e-401a-8ee8-e9c059710c69",
      "name": "Switch"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "={{ $env.SHEET_ID_CHISTES }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $env.SHEET_NAME_MISC }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1120,
        176
      ],
      "id": "6202f15e-21a1-400a-b249-be3ce16f37ba",
      "name": "Append or update row in sheet1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "={{ $env.SHEET_ID_CHISTES }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $env.SHEET_NAME_DARK }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1120,
        368
      ],
      "id": "9f0d3d63-afff-42cc-b70d-a18e18987f79",
      "name": "Append or update row in sheet2",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "={{ $env.SHEET_ID_CHISTES }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $env.SHEET_NAME_PROG }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1120,
        -16
      ],
      "id": "1a07d44e-2410-4578-9b05-9926351354f4",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"ID\": {{ $json.id }},\n  \"Chiste\": {{ JSON.stringify($json.joke) }},\n  \"Fecha de Procesamiento\": {{ JSON.stringify($now) }}\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        896,
        176
      ],
      "id": "0f9179d5-894f-47c6-b844-2680c37252c3",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"ID\": {{ $json.id }},\n  \"Chiste\": {{ JSON.stringify($json.joke) }},\n  \"Fecha de Procesamiento\": {{ JSON.stringify($now) }}\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        896,
        -16
      ],
      "id": "a4462c26-7328-43c3-a250-b958ac2c012a",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"ID\": {{ $json.id }},\n  \"Chiste\": {{ JSON.stringify($json.joke) }},\n  \"Fecha de Procesamiento\": {{ JSON.stringify($now) }}\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        896,
        368
      ],
      "id": "3c41145e-76bf-4e71-87bb-207a17f4f369",
      "name": "Edit Fields2"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Append or update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Append or update row in sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "48e370c4-74d7-4fe1-bbc6-7c0a348d1b61",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "xpK0ULioW5TQjpON",
  "tags": []
}