Usar la API de CNPJ y Google Sheets para enriquecer datos de empresas brasileñas
Este es unLead Generation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 15 nodos.Utiliza principalmente nodos como Set, Limit, Telegram, HttpRequest, GoogleSheets. usoCNPJ APIyGoogle Sheets丰富巴西公司datos
- •Bot Token de Telegram
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Credenciales de API de Google Sheets
Nodos utilizados (15)
Categoría
{
"id": "eObdW8oqxSRIvxi2",
"meta": {
"instanceId": "943057ae9865dd2906869d78fba63cb807e3403d288699c0026d3aaf59867c7a",
"templateCredsSetupCompleted": true
},
"tags": [],
"nodes": [
{
"id": "4a712b97-03ff-4f47-b17a-d2db1730cd4b",
"name": "Ejecutar Flujo de Trabajo Manualmente",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-368,
176
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a6a2f770-8850-49f5-a475-8069d852f35d",
"name": "Configuración",
"type": "n8n-nodes-base.set",
"position": [
-112,
176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "dc5f25ff-443b-42b9-be1f-2299632c747c",
"name": "telegram_id",
"type": "string",
"value": "YOUR_TELEGRAM_ID"
},
{
"id": "2c3806e7-5ef5-450a-a9cb-bc688b3e38cf",
"name": "api_base_url",
"type": "string",
"value": "https://minhareceita.org/"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5ce78f98-1dcf-4048-bb3e-8c038470e991",
"name": "Bucle de CNPJs",
"type": "n8n-nodes-base.splitInBatches",
"position": [
496,
176
],
"parameters": {
"options": {},
"batchSize": 100
},
"typeVersion": 3
},
{
"id": "4e6e8675-949d-4a39-b779-efc3738a5445",
"name": "Enviar Solicitud API",
"type": "n8n-nodes-base.httpRequest",
"position": [
800,
304
],
"parameters": {
"url": "={{ $('Settings').item.json.api_base_url }}{{ $json.cnpj }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "bcfd66a0-8e12-41b0-a87e-067bbe79dc30",
"name": "Actualizar Información de CNPJ en la Hoja",
"type": "n8n-nodes-base.googleSheets",
"position": [
1136,
304
],
"parameters": {
"columns": {
"value": {
"uf": "={{ $json.uf }}",
"cep": "={{ $json.cep }}",
"pais": "={{ $json.pais }}",
"email": "={{ $json.email }}",
"porte": "={{ $json.porte }}",
"bairro": "={{ $json.bairro }}",
"numero": "={{ $json.numero }}",
"ddd_fax": "={{ $json.ddd_fax }}",
"municipio": "={{ $json.municipio }}",
"logradouro": "={{ $json.logradouro }}",
"row_number": "={{ $('Loop CNPJs').item.json.row_number }}",
"codigo_pais": "={{ $json.codigo_pais }}",
"complemento": "={{ $json.complemento }}",
"codigo_porte": "={{ $json.codigo_porte }}",
"razao_social": "={{ $json.razao_social }}",
"nome_fantasia": "={{ $json.nome_fantasia }}",
"capital_social": "={{ $json.capital_social }}",
"ddd_telefone_1": "={{ $json.ddd_telefone_1 }}",
"ddd_telefone_2": "={{ $json.ddd_telefone_2 }}",
"codigo_municipio": "={{ $json.codigo_municipio }}",
"natureza_juridica": "={{ $json.natureza_juridica }}",
"codigo_municipio_ibge": "={{ $json.codigo_municipio_ibge }}",
"nome_cidade_no_exterior": "={{ $json.nome_cidade_no_exterior }}",
"descricao_tipo_de_logradouro": "={{ $json.descricao_tipo_de_logradouro }}"
},
"schema": [
{
"id": "cnpj",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "cnpj",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "razao_social",
"type": "string",
"display": true,
"required": false,
"displayName": "razao_social",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "nome_fantasia",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "nome_fantasia",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "capital_social",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "capital_social",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "porte",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "porte",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "codigo_porte",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "codigo_porte",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "uf",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "uf",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "municipio",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "municipio",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "codigo_municipio",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "codigo_municipio",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "codigo_municipio_ibge",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "codigo_municipio_ibge",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "bairro",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "bairro",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "logradouro",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "logradouro",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao_tipo_de_logradouro",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "descricao_tipo_de_logradouro",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "numero",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "numero",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "complemento",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "complemento",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "cep",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "cep",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "pais",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "pais",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "codigo_pais",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "codigo_pais",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "nome_cidade_no_exterior",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "nome_cidade_no_exterior",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ddd_telefone_1",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ddd_telefone_1",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ddd_telefone_2",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ddd_telefone_2",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ddd_fax",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ddd_fax",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "natureza_juridica",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "natureza_juridica",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "codigo_natureza_juridica",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "codigo_natureza_juridica",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "cnae_fiscal",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "cnae_fiscal",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "cnae_fiscal_descricao",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "cnae_fiscal_descricao",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "cnaes_secundarios",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "cnaes_secundarios",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "regime_tributario",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "regime_tributario",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "qualificacao_do_responsavel",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "qualificacao_do_responsavel",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "situacao_cadastral",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "situacao_cadastral",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao_situacao_cadastral",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "descricao_situacao_cadastral",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "motivo_situacao_cadastral",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "motivo_situacao_cadastral",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao_motivo_situacao_cadastral",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "descricao_motivo_situacao_cadastral",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "situacao_especial",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "situacao_especial",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "identificador_matriz_filial",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "identificador_matriz_filial",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "descricao_identificador_matriz_filial",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "descricao_identificador_matriz_filial",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ente_federativo_responsavel",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ente_federativo_responsavel",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_inicio_atividade",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_inicio_atividade",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_situacao_cadastral",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_situacao_cadastral",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_situacao_especial",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_situacao_especial",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "opcao_pelo_mei",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "opcao_pelo_mei",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_opcao_pelo_mei",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_opcao_pelo_mei",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_exclusao_do_mei",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_exclusao_do_mei",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "opcao_pelo_simples",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "opcao_pelo_simples",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_opcao_pelo_simples",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_opcao_pelo_simples",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data_exclusao_do_simples",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "data_exclusao_do_simples",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "qsa",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "qsa",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s/edit#gid=0",
"cachedResultName": "Página1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s/edit?usp=drivesdk",
"cachedResultName": "Planilha sem título"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "ZhVoDN9ufnYKR8Jv",
"name": "Google Sheets VIKTHYR"
}
},
"typeVersion": 4.7
},
{
"id": "9aa7367f-4a85-4007-a482-4828fd276654",
"name": "Notificar al Finalizar",
"type": "n8n-nodes-base.telegram",
"position": [
976,
-112
],
"webhookId": "62ebc9be-d3bb-475e-898b-dc43479e3772",
"parameters": {
"text": "=CNPJ info extraction complete!",
"chatId": "={{ $('Settings').item.json.telegram_id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "g96RKSo0I2Vcf1oP",
"name": "Telegram N8N VIKTHYR Bot"
}
},
"typeVersion": 1.2
},
{
"id": "bdb3fd23-cedc-43d9-872f-32bf099c4665",
"name": "Limitar Interacciones del Notificador",
"type": "n8n-nodes-base.limit",
"position": [
704,
-112
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6a1ba7c8-9358-46db-be11-21d98ab87506",
"name": "Obtener Todos los CNPJs en la Hoja",
"type": "n8n-nodes-base.googleSheets",
"position": [
224,
176
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupColumn": "razao_social"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s/edit#gid=0",
"cachedResultName": "Página1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Y5GlbWxbWD8zCnB8-vJIlTVtrWEqztyTXeaE6OTuY8s/edit?usp=drivesdk",
"cachedResultName": "Planilha sem título"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "ZhVoDN9ufnYKR8Jv",
"name": "Google Sheets VIKTHYR"
}
},
"typeVersion": 4.7
},
{
"id": "573946b9-f954-4b25-b039-0631abd131a1",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-208,
-16
],
"parameters": {
"color": 7,
"width": 304,
"height": 336,
"content": "## ⚙️ INITIAL SETUP\n- Configure your Telegram ID for notifications\n- API URL is already configured (MinhaReceita.org)\n- Make sure Google Sheets credentials are active"
},
"typeVersion": 1
},
{
"id": "b0c352e7-4f9e-4290-9b34-e5603423143f",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
-16
],
"parameters": {
"color": 7,
"width": 320,
"height": 336,
"content": "## 📊 DATA SOURCE\n- Reads CNPJs from Google Sheets spreadsheet\n- Filters by empty 'razao_social' column\n- Processes only CNPJs without data"
},
"typeVersion": 1
},
{
"id": "1a464427-aed0-4d9e-9176-2728d947bad7",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
688,
112
],
"parameters": {
"color": 7,
"width": 320,
"height": 352,
"content": "## 🌐 API DETAILS\n- API: minhareceita.org/{cnpj}\n- Returns +40 fields from Federal Revenue\n- Updated and official data\n- Includes IBGE codes and classifications\n- Cadastral status history\n- Free, no authentication required"
},
"typeVersion": 1
},
{
"id": "8f07398e-256f-4e33-9972-9786519a37e1",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
864,
-240
],
"parameters": {
"color": 7,
"width": 320,
"height": 288,
"content": "## 📱 NOTIFICATIONS\n- Telegram notifies when finished\n- Limiter prevents notification spam\n- One notification per complete execution"
},
"typeVersion": 1
},
{
"id": "82a3945d-fac6-4ff5-820a-f3d6aacbc31e",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1024,
112
],
"parameters": {
"color": 7,
"width": 320,
"height": 352,
"content": "## 📄 INSERT NEW DATA\n- Retrieves data from API\n- Updates corresponding row in spreadsheet with new information"
},
"typeVersion": 1
},
{
"id": "3de014ac-1ab2-483e-90bb-fda01fdbf431",
"name": "Nota Adhesiva6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-208,
-528
],
"parameters": {
"width": 272,
"height": 112,
"content": "# 📌 Follow me:\n## [LinkedIn](https://www.linkedin.com/in/vikthyr)"
},
"typeVersion": 1
},
{
"id": "36960786-d9cd-4527-957d-4762b2131aa7",
"name": "Nota Adhesiva7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-208,
-400
],
"parameters": {
"width": 640,
"height": 368,
"content": "# 📋 HOW THE WORKFLOW WORKS\n\n**1️⃣ START:** Manual execution triggers the process\n\n**2️⃣ SETUP:** Defines variables (Telegram ID and API URL)\n\n**3️⃣ READING:** Searches for all CNPJs in the spreadsheet that don't have data (empty 'razao_social' column)\n\n**4️⃣ PROCESSING:** For each CNPJ found:\n • Makes HTTP request to MinhaReceita API\n • Receives complete company data\n • Updates corresponding row in spreadsheet\n\n**5️⃣ NOTIFICATION:** Upon completion of entire process, sends Telegram message confirming conclusion\n\n**🔄 The loop continues until all pending CNPJs are processed**"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "71a2befa-8a16-419d-b2cf-750ef55a4ab2",
"connections": {
"a6a2f770-8850-49f5-a475-8069d852f35d": {
"main": [
[
{
"node": "6a1ba7c8-9358-46db-be11-21d98ab87506",
"type": "main",
"index": 0
}
]
]
},
"5ce78f98-1dcf-4048-bb3e-8c038470e991": {
"main": [
[
{
"node": "bdb3fd23-cedc-43d9-872f-32bf099c4665",
"type": "main",
"index": 0
}
],
[
{
"node": "4e6e8675-949d-4a39-b779-efc3738a5445",
"type": "main",
"index": 0
}
]
]
},
"4e6e8675-949d-4a39-b779-efc3738a5445": {
"main": [
[
{
"node": "bcfd66a0-8e12-41b0-a87e-067bbe79dc30",
"type": "main",
"index": 0
}
]
]
},
"6a1ba7c8-9358-46db-be11-21d98ab87506": {
"main": [
[
{
"node": "5ce78f98-1dcf-4048-bb3e-8c038470e991",
"type": "main",
"index": 0
}
]
]
},
"4a712b97-03ff-4f47-b17a-d2db1730cd4b": {
"main": [
[
{
"node": "a6a2f770-8850-49f5-a475-8069d852f35d",
"type": "main",
"index": 0
}
]
]
},
"bcfd66a0-8e12-41b0-a87e-067bbe79dc30": {
"main": [
[
{
"node": "5ce78f98-1dcf-4048-bb3e-8c038470e991",
"type": "main",
"index": 0
}
]
]
},
"bdb3fd23-cedc-43d9-872f-32bf099c4665": {
"main": [
[
{
"node": "9aa7367f-4a85-4007-a482-4828fd276654",
"type": "main",
"index": 0
}
]
]
}
}
}¿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, IA Multimodal
¿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.
Flujos de trabajo relacionados recomendados
Vitorio Magalhães
@vikthyrBrazilian Full Stack Developer passionate about making automation accessible to everyone. I create free n8n workflows that solve real problems - from NASA space content to marketing automation. Proving that powerful automation doesn't need to be expensive or complicated. Teaching through templates, one node at a time.
Compartir este flujo de trabajo