8
n8n 中文网amn8n.com

Agile CRM 的 INSEE 数据丰富

中级

这是一个Sales, Marketing领域的自动化工作流,包含 14 个节点。主要使用 Set, Code, Merge, AgileCrm, HttpRequest 等节点。 为 Agile CRM 进行 INSEE 公司数据丰富(仅限法国公司)

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "G0hO05fypS8n8uYu",
  "meta": {
    "instanceId": "8fb286e504ea5ce6aeb12bf5c0c97ce11908b5b1aaa495ddfa0ef349661b832e"
  },
  "name": "Agile CRM 的 INSEE 数据丰富",
  "tags": [],
  "nodes": [
    {
      "id": "a45b34c1-514e-4221-b363-abf2d4de43c4",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -3440,
        -320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d406941b-80a1-43a3-ba19-2e29570192f2",
      "name": "在 SIREN 数据库中查找公司",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -2660,
        -220
      ],
      "parameters": {
        "url": "=https://api.insee.fr/api-sirene/3.11/siren?q=periode(denominationUniteLegale:\"{{ $json.denominationUniteLegale }}\")",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "X-INSEE-Api-Key-Integration",
              "value": "={{ $('Set Insee API Key').all()[0].json['X-INSEE-Api-Key-Integration']  }}"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "6ab3818b-2f09-44e2-874a-87c51478572b",
      "name": "从 SIREN 数据库请求所有数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2420,
        -240
      ],
      "parameters": {
        "url": "=https://api.insee.fr/api-sirene/3.11/siret/{{ $json.unitesLegales[0].siren }}{{ $json.unitesLegales[0].periodesUniteLegale[0].nicSiegeUniteLegale }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "X-INSEE-Api-Key-Integration",
              "value": "={{ $('Set Insee API Key').all()[0].json['X-INSEE-Api-Key-Integration']  }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "89c223fe-289b-4d0f-922a-e9c0ad672b51",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3420,
        -640
      ],
      "parameters": {
        "width": 460,
        "height": 240,
        "content": "### 使用法国 INSEE 开放数据库 API 丰富 CRM 数据"
      },
      "typeVersion": 1
    },
    {
      "id": "0bdc49dd-6f26-447f-a8ba-c2ba615dc7ec",
      "name": "过滤掉所有设置了只读键的公司",
      "type": "n8n-nodes-base.code",
      "position": [
        -2880,
        -220
      ],
      "parameters": {
        "jsCode": "// Get input data\nconst input = $input.all();\nconst output = input.filter(item => {\n    const properties = item.json.properties || [];\n    return !properties.some(property => property.name === \"RO\" && property.value === \"1\"); // Remove all ReadOnly entries\n}).map(item => {\n    const companyId = item.json.id;\n    const denominationUniteLegale = item.json.properties[0]?.value || null; \n    return {\n        json: {\n            companyId,\n            denominationUniteLegale\n        }\n    };\n});\n\n// Return the transformed output\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "0ef184f7-219c-4eb3-bfe0-4e68d2ce0b43",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2940,
        -640
      ],
      "parameters": {
        "color": 5,
        "width": 647,
        "height": 232,
        "content": "### 👨‍🎤 设置"
      },
      "typeVersion": 1
    },
    {
      "id": "78255253-195d-472d-a76c-ab63ceac126b",
      "name": "设置 INSEE API 密钥",
      "type": "n8n-nodes-base.set",
      "position": [
        -3260,
        -220
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e993e665-cf31-48b1-8ca8-a4829dc82642",
              "name": "X-INSEE-Api-Key-Integration",
              "type": "string",
              "value": "put-your-insee-api-key-here"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "90b13481-6570-4bfc-b3dc-4b6017c6c8b5",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -3440,
        -140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "88c8a6c6-2175-42c3-bfdb-f1d32a5d1c2d",
      "name": "clean_route",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -2660,
        -360
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "522d83f6-752e-40b4-a889-334f0a96998b",
      "name": "从 Agile CRM 获取所有公司",
      "type": "n8n-nodes-base.agileCrm",
      "position": [
        -3080,
        -220
      ],
      "parameters": {
        "options": {},
        "resource": "company",
        "operation": "getAll"
      },
      "credentials": {
        "agileCrmApi": {
          "id": "wb0EgiQFLQbiFuy4",
          "name": "AgileCRM account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8ff0632b-6aca-47d8-b611-72dbc8dec09b",
      "name": "使用 INSEE 数据丰富 CRM",
      "type": "n8n-nodes-base.agileCrm",
      "position": [
        -1960,
        -340
      ],
      "parameters": {
        "resource": "company",
        "companyId": "={{ $json.companyId }}",
        "operation": "update",
        "additionalFields": {
          "addressOptions": {
            "addressProperties": [
              {
                "address": "={{ $json.etablissement.adresseEtablissement.complementAdresseEtablissement }}\n{{ $json.etablissement.adresseEtablissement.typeVoieEtablissement }} {{ $json.etablissement.adresseEtablissement.libelleVoieEtablissement }}\n{{ $json.etablissement.adresseEtablissement.codePostalEtablissement }}{{ $json.etablissement.adresseEtablissement.libelleCommuneEtablissement }}",
                "subtype": "office"
              }
            ]
          },
          "customProperties": {
            "customProperty": [
              {
                "name": "SIREN",
                "value": "={{ $json.etablissement.siren }}",
                "subtype": "TEXT"
              }
            ]
          }
        }
      },
      "credentials": {
        "agileCrmApi": {
          "id": "wb0EgiQFLQbiFuy4",
          "name": "AgileCRM account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8720be96-8181-4ea7-b114-ce0f5b8e09c1",
      "name": "将来自 CRM 和 SIREN 数据库的数据与为 CRM 丰富的数据合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        -2180,
        -340
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "advanced": true,
        "mergeByFields": {
          "values": [
            {
              "field1": "denominationUniteLegale",
              "field2": "etablissement.uniteLegale.denominationUniteLegale"
            }
          ]
        }
      },
      "typeVersion": 3
    },
    {
      "id": "855a39e2-83ef-49d9-b630-ec31aaa96e72",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3460,
        20
      ],
      "parameters": {
        "height": 80,
        "content": "👆 您可以使用这两个触发器中的任何一个来启动流程。"
      },
      "typeVersion": 1
    },
    {
      "id": "b003c1b8-6244-4b72-bbb0-025f563b5d71",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2260,
        -640
      ],
      "parameters": {
        "width": 380,
        "height": 240,
        "content": "### 🗒️ 备注:"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9f328182-d131-4300-a1f4-2cb3dfe91632",
  "connections": {
    "clean_route": {
      "main": [
        [
          {
            "node": "Merge data from CRM and SIREN database with enriched for the CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Insee API Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Insee API Key": {
      "main": [
        [
          {
            "node": "Get all Compagnies from Agile CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Company in SIREN database": {
      "main": [
        [
          {
            "node": "Request all data from SIREN database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all Compagnies from Agile CRM": {
      "main": [
        [
          {
            "node": "FilterOut all Company that have the ReadOnly Key set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Insee API Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request all data from SIREN database": {
      "main": [
        [
          {
            "node": "Merge data from CRM and SIREN database with enriched for the CRM",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "FilterOut all Company that have the ReadOnly Key set": {
      "main": [
        [
          {
            "node": "Find Company in SIREN database",
            "type": "main",
            "index": 0
          },
          {
            "node": "clean_route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge data from CRM and SIREN database with enriched for the CRM": {
      "main": [
        [
          {
            "node": "Enrich CRM with INSEE Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 销售, 营销

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量14
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流