{
  "id": "xWCRwevxltYv1ioI",
  "createdAt": "2023-07-13T03:35:15.303Z",
  "updatedAt": "2023-08-17T17:07:37.426Z",
  "name": "[eliminado] HS Owners",
  "active": false,
  "nodes": [
    {
      "parameters": {},
      "id": "c62d3e1f-e8b4-4f15-a64e-632f972a6c30",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1720,
        340
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "amount": "0.3",
        "unit": "seconds"
      },
      "id": "773a756e-cab9-4a1f-8199-8f4e36d49420",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        660,
        40
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "https://api.hubapi.com/crm/v3/owners/",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotAppToken",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "archived",
              "value": "true"
            }
          ]
        },
        "options": {}
      },
      "id": "fa9ad95f-7ab4-4153-af87-d51186dd11b7",
      "name": "Hubspot request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1460,
        340
      ],
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 3,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "notes": "request facturas"
    },
    {
      "parameters": {
        "fieldToSplitOut": "results",
        "options": {}
      },
      "id": "e793097d-3e4f-4a87-899f-278f2deb220b",
      "name": "Split results1",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        -1220,
        340
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "hubspot_request_after",
              "value": "={{ $node['Hubspot request1'].json.paging.next.after }}"
            }
          ]
        },
        "options": {}
      },
      "id": "bbdb4b43-54d2-43c3-899d-4e9f7b676b61",
      "name": "Set after",
      "type": "n8n-nodes-base.set",
      "position": [
        -680,
        340
      ],
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "https://api.hubapi.com/crm/v3/owners/",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotAppToken",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "after",
              "value": "={{ $json.hubspot_request_after }}"
            },
            {
              "name": "archived",
              "value": "true"
            }
          ]
        },
        "options": {}
      },
      "id": "9f0179a1-f7ed-4603-883a-41017edee1c7",
      "name": "Hubspot request 2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -500,
        340
      ],
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 3,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "notes": "request facturas"
    },
    {
      "parameters": {
        "fieldToSplitOut": "results",
        "options": {}
      },
      "id": "b5d35be6-1fda-486b-a92e-f705612daa56",
      "name": "Split results 2",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        -260,
        340
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "id",
              "value": "={{ $json.id }}"
            }
          ],
          "string": [
            {
              "name": "email",
              "value": "={{ $json.email }}"
            },
            {
              "name": "first_name",
              "value": "={{ $json.firstName }}"
            },
            {
              "name": "last_name",
              "value": "={{ $json.lastName }}"
            }
          ],
          "boolean": [
            {
              "name": "archived",
              "value": "={{ $json.archived }}"
            }
          ]
        },
        "options": {}
      },
      "id": "8c44489a-8f2d-466e-bc29-3e56d837629f",
      "name": "Set variables 2",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        340
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "hubspot_request_after",
              "value": "={{ $node['Hubspot request 2'].json.paging.next.after }}"
            }
          ]
        },
        "options": {}
      },
      "id": "f997f52c-67b3-4839-aefd-3e99925d1ba3",
      "name": "Set after 2",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        40
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "upsert",
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "owners",
          "cachedResultName": "owners"
        },
        "columnToMatchOn": "id",
        "options": {}
      },
      "id": "caea28ef-abe7-447b-b207-43a99ef67285",
      "name": "Insert 1",
      "type": "n8n-nodes-base.mySql",
      "position": [
        -860,
        340
      ],
      "typeVersion": 2.1,
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $node['Hubspot request 2'].json }}",
              "operation": "contains",
              "value2": "paging"
            }
          ]
        },
        "combineOperation": "any"
      },
      "id": "0a86dfc2-0afa-4b2e-8e9d-a4b38aa9ed10",
      "name": "Request contains paging",
      "type": "n8n-nodes-base.if",
      "position": [
        400,
        340
      ],
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "upsert",
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "owners",
          "cachedResultName": "owners"
        },
        "columnToMatchOn": "id",
        "options": {}
      },
      "id": "a5867f8d-6862-45fa-a8ec-9e00411e4fb3",
      "name": "Insert 2",
      "type": "n8n-nodes-base.mySql",
      "position": [
        180,
        340
      ],
      "typeVersion": 2.1,
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "Can't request with empty 'after'",
        "height": 80,
        "width": 255.18336978030985
      },
      "id": "8ec87700-8d59-44a9-885a-a5e77a49c012",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1300,
        200
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "number": [
            {
              "name": "id",
              "value": "={{ $json.id }}"
            }
          ],
          "string": [
            {
              "name": "email",
              "value": "={{ $json.email }}"
            },
            {
              "name": "first_name",
              "value": "={{ $json.firstName }}"
            },
            {
              "name": "last_name",
              "value": "={{ $json.lastName }}"
            }
          ],
          "boolean": [
            {
              "name": "archived",
              "value": "={{ $json.archived }}"
            }
          ]
        },
        "options": {}
      },
      "id": "352d569d-de86-477c-85cc-d1e74aaa73c7",
      "name": "Set variables 1",
      "type": "n8n-nodes-base.set",
      "position": [
        -1020,
        340
      ],
      "typeVersion": 2
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Hubspot request 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert 1": {
      "main": [
        [
          {
            "node": "Set after",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert 2": {
      "main": [
        [
          {
            "node": "Request contains paging",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set after": {
      "main": [
        [
          {
            "node": "Hubspot request 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set after 2": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split results1": {
      "main": [
        [
          {
            "node": "Set variables 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set variables 1": {
      "main": [
        [
          {
            "node": "Insert 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set variables 2": {
      "main": [
        [
          {
            "node": "Insert 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split results 2": {
      "main": [
        [
          {
            "node": "Set variables 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hubspot request1": {
      "main": [
        [
          {
            "node": "Split results1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hubspot request 2": {
      "main": [
        [
          {
            "node": "Split results 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request contains paging": {
      "main": [
        [
          {
            "node": "Set after 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Hubspot request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "staticData": null,
  "versionId": "e50c3b31-e6d5-42ea-af7e-d08d19dea774",
  "triggerCount": 0,
  "tags": [
    {
      "id": "iL2ywDmPqVO6K3AI",
      "createdAt": "2023-08-17T17:06:40.880Z",
      "updatedAt": "2023-08-17T17:06:40.880Z",
      "name": "hubspot"
    },
    {
      "id": "v25eD48xihLAmSfO",
      "createdAt": "2023-07-14T19:51:55.716Z",
      "updatedAt": "2023-07-14T19:51:55.716Z",
      "name": "bi"
    }
  ]
}