Rellenar automáticamente empresas de HubSpot según el NIP de Polonia

Intermedio

Este es unLead Generationflujo de automatización del dominio deautomatización que contiene 15 nodos.Utiliza principalmente nodos como If, Code, Hubspot, HttpRequest, HubspotTrigger. usoNIP标识符a través de波兰CEIDGdatos丰富HubSpot公司信息

Requisitos previos
  • Clave de API de HubSpot
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "KifsNxjgoHTGzDxt",
  "meta": {
    "instanceId": "a244e08ca65e768d1cee097a486ef066f1968b077e055f21a34efe4e78c40e76"
  },
  "name": "Auto-populate HubSpot company from Polish NIP",
  "tags": [
    {
      "id": "AOZlNztgqiOQKd6j",
      "name": "n8n Creators",
      "createdAt": "2025-09-28T11:02:15.227Z",
      "updatedAt": "2025-09-28T11:02:15.227Z"
    }
  ],
  "nodes": [
    {
      "id": "538bb51e-c5dd-4173-b0ca-a13934985a72",
      "name": "Verificar si existe NIP",
      "type": "n8n-nodes-base.if",
      "position": [
        128,
        432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.propertyValue }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6f3002a3-ba7f-43f0-801c-9aac9d30e538",
      "name": "Cuando cambia la propiedad NIP",
      "type": "n8n-nodes-base.hubspotTrigger",
      "position": [
        -96,
        432
      ],
      "webhookId": "7a4af938-f0f4-49cb-84f1-de35a042d791",
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {
              "name": "company.propertyChange",
              "property": "nip"
            }
          ]
        },
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "d1ace6e8-5170-4093-94cc-04662969523b",
      "name": "Actualizar empresa en HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1056,
        304
      ],
      "parameters": {
        "resource": "company",
        "companyId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Check if NIP exists').item.json.companyId }}"
        },
        "operation": "update",
        "updateFields": {
          "city": "={{ $json.properties.city }}",
          "name": "={{ $json.properties.name }}",
          "postalCode": "={{ $json.properties.zip }}",
          "websiteUrl": "={{ $json.properties.website }}",
          "phoneNumber": "={{ $json.properties.phone }}",
          "stateRegion": "={{ $json.properties.state }}",
          "countryRegion": "={{ $json.properties.country }}",
          "streetAddress": "={{ $json.properties.address }}",
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "value": "={{ $json.properties.description }}",
                "property": "ceidg_notes"
              }
            ]
          }
        },
        "authentication": "appToken"
      },
      "typeVersion": 2.2
    },
    {
      "id": "183aaa16-4d06-44c6-86a0-19b7332bf565",
      "name": "Obtener datos de empresa desde CEIDG",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        352,
        320
      ],
      "parameters": {
        "url": "=https://dane.biznes.gov.pl/api/ceidg/v3/firmy",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "nip",
              "value": "={{ $json.propertyValue }}"
            }
          ]
        },
        "nodeCredentialType": "httpBearerAuth"
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "6abd961a-2c92-44dc-96a6-cf094b36e01a",
      "name": "Transformar datos para HubSpot",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        304
      ],
      "parameters": {
        "jsCode": "// Input: single item from \"Fetch company data from CEIDG\" node (CEIDG v3 API)\n// Structure: { firmy: [ { nazwa, adresDzialalnosci:{...}, wlasciciel:{ nip, regon }, ... } ], ... }\n\nconst data = $input.item.json;\n\n// Validation\nif (!data || !Array.isArray(data.firmy) || data.firmy.length === 0) {\n  throw new Error('No company found in CEIDG response');\n}\n\n// First company from the list\nconst company = data.firmy[0];\n\n// Get companyId from HubSpot Trigger\nconst hubspotPayload = $item(0).$node[\"When NIP property changes\"].json;\nconst companyId = hubspotPayload.companyid || hubspotPayload.objectId;\n\n// CEIDG v3: address is in \"adresDzialalnosci\"\nconst addr = company.adresDzialalnosci || {};\n\nconst street = [\n  addr.ulica,\n  addr.budynek,\n  addr.lokal ? `/${addr.lokal}` : ''\n]\n.filter(Boolean)\n.join(' ');\n\n// Owner → NIP/REGON\nconst owner = company.wlasciciel || {};\nconst nip = owner.nip || '';\nconst regon = owner.regon || '';\n\n// Return format ready for HubSpot Company → Update\nreturn {\n  json: {\n    companyId: companyId,\n    properties: {\n      name: company.nazwa || '',\n      address: street || '',\n      city: addr.miasto || '',\n      zip: addr.kod || '',\n      state: addr.wojewodztwo || '',\n      country: 'Poland',\n      phone: company.telefon || '',\n      website: company.www || '',\n      description: `Auto-populated from CEIDG. NIP: ${nip || '—'}, REGON: ${regon || '—'}. Start: ${company.dataRozpoczecia || 'N/A'}`,\n    },\n  },\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "03b138e2-84c9-4fcd-87b3-34e97a639484",
      "name": "Marcar error en HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1056,
        896
      ],
      "parameters": {
        "resource": "company",
        "companyId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Check if NIP exists').item.json.companyId }}"
        },
        "operation": "update",
        "updateFields": {
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "value": "=Invalid NIP / No data found in CEIDG database",
                "property": "ceidg_notes"
              }
            ]
          }
        },
        "authentication": "appToken"
      },
      "typeVersion": 2.2
    },
    {
      "id": "641f0344-7de8-46de-b7ea-29a67c1b1946",
      "name": "Verificar si se obtuvieron datos",
      "type": "n8n-nodes-base.if",
      "position": [
        576,
        320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "05aca5e7-3131-4e58-9e38-a5caa08f93a9",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.count }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "52855cc7-4754-4582-b0ef-803f31f9db06",
      "name": "Descripción del flujo de trabajo",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -64
      ],
      "parameters": {
        "color": 4,
        "width": 678.2462538708118,
        "height": 1181.1692474064032,
        "content": "## Auto-populate HubSpot company from Polish NIP\n\nThis workflow automatically enriches HubSpot company records with official data from the Polish CEIDG (Central Register and Information on Economic Activity) database when a NIP (Polish Tax ID) is added or updated.\n\n## Who's it for\n\nPolish sales teams, marketing agencies, and CRM administrators who work with Polish companies in HubSpot and want to save time on manual data entry while ensuring data accuracy.\n\n## How it works\n\n1. **Trigger**: Monitors HubSpot for changes to the \"NIP\" property on company records\n2. **Validation**: Checks if the NIP field is not empty\n3. **API Query**: Fetches official company data from the Polish CEIDG database using the provided NIP\n4. **Data Check**: Verifies if company data was successfully retrieved\n5. **Transform**: Maps CEIDG data to HubSpot company properties\n6. **Update**: Enriches the HubSpot company record with:\n   - Company name\n   - Full address (street, city, postal code, state)\n   - Phone number\n   - Website URL\n   - NIP and REGON numbers\n   - Business start date\n7. **Error Handling**: If NIP is invalid or no data found, adds a note to the company record\n\n## Requirements\n\n- **HubSpot account** with:\n  - Custom property \"nip\" created for companies\n  - Custom property \"ceidg_notes\" created for companies (optional, for storing API notes)\n  - App token or developer API credentials\n- **CEIDG API Token** (free registration at https://dane.biznes.gov.pl/)\n- **n8n instance** (self-hosted or cloud)\n\n## How to set up\n\n1. **Create HubSpot custom properties**:\n   - Go to HubSpot Settings > Properties > Company Properties\n   - Create a \"nip\" property (single-line text)\n   - Create a \"ceidg_notes\" property (multi-line text) for storing API responses\n\n2. **Get CEIDG API Token**:\n   - Register at https://dane.biznes.gov.pl/\n   - Navigate to API section and generate your token\n   - Add token to n8n credentials (HTTP Bearer YOUR_TOKEN_HERE)\n\n3. **Configure HubSpot credentials**:\n   - Add your HubSpot App Token in n8n credentials\n   - Or use HubSpot Developer API credentials\n\n4. **Activate the workflow**:\n   - Import this workflow to your n8n instance\n   - Configure the credentials in all HubSpot and HTTP nodes\n   - Activate the workflow\n\n5. **Test**:\n   - Add or update a NIP value in any HubSpot company record\n   - Check if the company data gets automatically populated\n\n## How to customize\n\n- **Add more fields**: Modify the \"Transform data for HubSpot\" Code node to map additional CEIDG fields\n- **Change trigger property**: Update the HubSpot Trigger to monitor a different property name\n- **Notification**: Add an email or Slack notification node after successful updates\n- **Batch processing**: Add a schedule trigger to process multiple companies at once\n- **Data validation**: Add nodes to validate NIP format before making the API call\n- **Logging**: Add a Google Sheets or database node to log all enrichment activities\n\n## Notes\n\n- CEIDG database contains data for sole proprietorships registered in Poland\n- For limited liability companies (sp. z o.o.) and other entities, you'll need to use KRS (National Court Register) API instead\n- The workflow processes one company at a time as they are updated\n- API rate limits apply based on your CEIDG API plan"
      },
      "typeVersion": 1
    },
    {
      "id": "3104719e-08b1-4a4a-916e-11976d4ea6ed",
      "name": "Paso 1: Activador HubSpot",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        80
      ],
      "parameters": {
        "width": 217,
        "height": 525,
        "content": "## Trigger\n\nMonitors HubSpot for changes to the NIP property on company records.\n\nWhen a NIP is added or updated, the workflow starts automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "a8758064-a305-4d97-9481-406261c56462",
      "name": "Paso 2: Validar entrada",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        80
      ],
      "parameters": {
        "width": 201,
        "height": 525,
        "content": "## Validation\n\nChecks if the NIP field has a value.\n\nIf empty, the workflow ends here to avoid unnecessary API calls."
      },
      "typeVersion": 1
    },
    {
      "id": "cdcc5ce1-0b8b-4243-817c-fe5521273dad",
      "name": "Paso 3: Obtener datos",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -32
      ],
      "parameters": {
        "width": 201,
        "height": 525,
        "content": "## CEIDG API Query\n\nFetches official company data from the Polish government database.\n\nRequires a free API token from dane.biznes.gov.pl"
      },
      "typeVersion": 1
    },
    {
      "id": "eb23700a-c13a-4a0b-aadc-374b4558259c",
      "name": "Paso 4: Verificar respuesta",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -32
      ],
      "parameters": {
        "width": 201,
        "height": 525,
        "content": "## Data Verification\n\nChecks if the API returned any company records.\n\nIf count > 0, proceeds to update HubSpot.\nIf count = 0, marks an error."
      },
      "typeVersion": 1
    },
    {
      "id": "d176a34a-25db-46d9-9605-9111608faf53",
      "name": "Paso 5: Mapear campos",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -32
      ],
      "parameters": {
        "width": 217,
        "height": 525,
        "content": "## Transform Data\n\nMaps CEIDG API response to HubSpot company properties.\n\nExtracts:\n- Company name\n- Address components\n- Contact details\n- NIP/REGON numbers"
      },
      "typeVersion": 1
    },
    {
      "id": "97f97f48-e594-4a81-a97f-827434f46ff1",
      "name": "Paso 6: Actualización exitosa",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -32
      ],
      "parameters": {
        "width": 265,
        "height": 525,
        "content": "## Success Path\n\nUpdates the HubSpot company record with all enriched data from CEIDG.\n\nIncludes company name, address, phone, website, and notes."
      },
      "typeVersion": 1
    },
    {
      "id": "5daf227a-3112-4812-9d92-442ec883d08b",
      "name": "Manejo de errores",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        528
      ],
      "parameters": {
        "width": 265,
        "height": 525,
        "content": "## Error Path\n\nIf NIP is invalid or not found in CEIDG, this node adds a note to the HubSpot company.\n\nHelps identify problematic records."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5599e99c-c3b9-4cc1-97a8-0af7dee05ac0",
  "connections": {
    "538bb51e-c5dd-4173-b0ca-a13934985a72": {
      "main": [
        [
          {
            "node": "183aaa16-4d06-44c6-86a0-19b7332bf565",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "03b138e2-84c9-4fcd-87b3-34e97a639484",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "641f0344-7de8-46de-b7ea-29a67c1b1946": {
      "main": [
        [
          {
            "node": "6abd961a-2c92-44dc-96a6-cf094b36e01a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "03b138e2-84c9-4fcd-87b3-34e97a639484",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6f3002a3-ba7f-43f0-801c-9aac9d30e538": {
      "main": [
        [
          {
            "node": "538bb51e-c5dd-4173-b0ca-a13934985a72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6abd961a-2c92-44dc-96a6-cf094b36e01a": {
      "main": [
        [
          {
            "node": "d1ace6e8-5170-4093-94cc-04662969523b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "183aaa16-4d06-44c6-86a0-19b7332bf565": {
      "main": [
        [
          {
            "node": "641f0344-7de8-46de-b7ea-29a67c1b1946",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Generación de leads

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos15
Categoría1
Tipos de nodos6
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34