{
  "id": "y7Xgm9g2LjSPwU7w",
  "createdAt": "2023-07-13T14:28:22.925Z",
  "updatedAt": "2024-01-05T04:05:34.928Z",
  "name": "[Oscar] EstadoEnrolamientoSitioFinanciamiento",
  "active": true,
  "nodes": [
    {
      "parameters": {
        "path": "c0d1ed04-c1b7-4058-a8dd-ec70a5af08dc",
        "options": {
          "responseData": "Sucess"
        }
      },
      "id": "470a9b5b-2c85-41a9-8328-d13bbadfac06",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        100,
        920
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "rut_proveedor",
              "value": "={{ $json.query.rut_proveedor}}"
            },
            {
              "name": "dealId",
              "value": "={{ $json.query.hs_object_id }}"
            },
            {
              "name": "nombre",
              "value": "={{ $json.query.nombre }}"
            }
          ]
        },
        "options": {}
      },
      "id": "37d0efc5-0f4f-41f9-a8fc-45fc541ec3a4",
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "position": [
        360,
        920
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "appToken",
        "operation": "update",
        "dealId": "={{$node[\"Set1\"].json[\"dealId\"] }}",
        "updateFields": {
          "stage": "=65298799"
        }
      },
      "id": "871a9f23-a7e7-4a46-82c3-0b9eaec9a5fd",
      "name": "HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1240,
        1080
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "appToken",
        "operation": "get",
        "dealId": "={{$node[\"Set1\"].json[\"dealId\"] }}",
        "additionalFields": {}
      },
      "id": "f8da7094-cf3f-4a3f-ace8-b2fe82e5a475",
      "name": "HubSpot1",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1420,
        1080
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "CompanyId",
              "value": "={{ $json[\"associations\"][\"associatedCompanyIds\"][0] }}"
            },
            {
              "name": "ownerId",
              "value": "={{ $json[\"properties\"][\"hubspot_owner_id\"][\"value\"] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "79fe5cf8-662c-40a6-8619-55b754e29907",
      "name": "Set4",
      "type": "n8n-nodes-base.set",
      "position": [
        1620,
        1080
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "company",
        "operation": "update",
        "companyId": "={{ $json[\"CompanyId\"]}}",
        "updateFields": {
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "property": "estado_enroladmiento_fapro",
                "value": "Credencial Incorrecta"
              }
            ]
          }
        }
      },
      "id": "a7ff3dbe-472a-46e0-b764-b25fc1f8b7dd",
      "name": "HubSpot2",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1820,
        1080
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "appToken",
        "operation": "get",
        "dealId": "={{$node[\"Set1\"].json[\"dealId\"] }}",
        "additionalFields": {}
      },
      "id": "41d20c7f-2a77-44f5-ae84-3f5e51312bf4",
      "name": "HubSpot3",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1240,
        800
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "CompanyId",
              "value": "={{ $json[\"associations\"][\"associatedCompanyIds\"][0] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "7f336bc6-9a47-4459-b0ce-01581e73181f",
      "name": "Set5",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        800
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "company",
        "operation": "update",
        "companyId": "={{ $json[\"CompanyId\"]}}",
        "updateFields": {
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "property": "estado_enroladmiento_fapro",
                "value": "Activo"
              }
            ]
          }
        }
      },
      "id": "8b1d095c-ac71-4876-8af1-e993fd87d4ff",
      "name": "HubSpot4",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1640,
        800
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "engagement",
        "type": "task",
        "metadata": {
          "body": "=Cliente ingresa<strong> INCORRECTAMENTE </strong> su contrase\u00f1a en el sitio de financiamiento, favor, comunicarse con el cliente.",
          "forObjectType": "COMPANY"
        },
        "additionalFields": {
          "associations": {
            "companyIds": "={{ $node[\"Set4\"].json[\"CompanyId\"]}}",
            "dealIds": "={{$node[\"Set1\"].json[\"dealId\"] }}",
            "ownerIds": "={{$node[\"Set4\"].json[\"ownerId\"] }}"
          }
        }
      },
      "id": "83ffbe9e-fa50-40e1-9853-5eb9776f40e4",
      "name": "HubSpot5",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2000,
        1080
      ],
      "typeVersion": 1,
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://thecage.production.cumplo.com/login_sii/{{ $json.rut_proveedor }}",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {}
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "8V0ZZJGPDb3ylzzdbSgPK7vYAOL9q2nT5arDt2JX"
            }
          ]
        },
        "options": {}
      },
      "id": "318acedd-a58a-4f47-90c5-054e4b4f1a21",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        700,
        920
      ],
      "alwaysOutputData": true,
      "executeOnce": true,
      "retryOnFail": true,
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.cookie.CSESSIONID }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "id": "b3b724e6-4b28-4e8c-bcb1-5fa50548902e",
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        940,
        920
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://suvjibemry.us-west-2.awsapprunner.com/api/empresas/createEmpresaCustom/{{$node[\"Set1\"].json[\"rut_proveedor\"] }}/{{$node[\"Set1\"].json[\"nombre\"] }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "<redacted-credential>"
            }
          ]
        },
        "options": {}
      },
      "id": "4d7e646c-943a-4ac0-814b-ef129dc83368",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1860,
        800
      ]
    }
  ],
  "connections": {
    "Set4": {
      "main": [
        [
          {
            "node": "HubSpot2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set5": {
      "main": [
        [
          {
            "node": "HubSpot4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot": {
      "main": [
        [
          {
            "node": "HubSpot1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot1": {
      "main": [
        [
          {
            "node": "Set4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot2": {
      "main": [
        [
          {
            "node": "HubSpot5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot3": {
      "main": [
        [
          {
            "node": "Set5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set1": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "HubSpot3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot4": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all",
    "saveExecutionProgress": false,
    "saveManualExecutions": false,
    "callerPolicy": "workflowsFromSameOwner"
  },
  "staticData": null,
  "versionId": "b0f08e52-409c-47c0-b4e8-acf6225dc6d7",
  "triggerCount": 1,
  "tags": []
}