8
n8n 中文网amn8n.com

Hubspot -> Salesforce - 最终版

中级

这是一个Sales, AI领域的自动化工作流,包含 11 个节点。主要使用 Code, Merge, Filter, Hubspot, Salesforce 等节点,结合人工智能技术实现智能自动化。 使用Explorium.ai从HubSpot到Salesforce自动化联系人信息丰富

前置要求
  • HubSpot API Key
  • Salesforce OAuth 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "A1ANYPPCR58x29nH",
  "meta": {
    "instanceId": "0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77",
    "templateCredsSetupCompleted": true
  },
  "name": "Hubspot -> Salesforce - final",
  "tags": [],
  "nodes": [
    {
      "id": "306813bf-056d-48fc-ba8b-e64ddb01beda",
      "name": "Match_prospect",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1820,
        360
      ],
      "parameters": {
        "url": "https://api.explorium.ai/v1/prospects/match",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prospects_to_match\": [\n    {\n      \"full_name\": \"{{ ($json.properties.firstname.value || '') + ' ' + ($json.properties.lastname.value || '') }}\",\n      \"company_name\": \"{{ ($json.properties.company.value || '').trim() }}\",\n      \"email\": \"{{ $json['identity-profiles'][0].identities.find(id => id.type === 'EMAIL').value }}\"\n    }\n  ]\n}",
        "sendBody": true,
        "jsonHeaders": "{\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\"\n}",
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "specifyHeaders": "json",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "85mkGmNNdK1951hF",
          "name": "Header Auth Connection"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "08e9aa3a-6957-4f88-9ad7-f492652046e4",
      "name": "Extract Prospect IDs from Matched Results",
      "type": "n8n-nodes-base.code",
      "position": [
        -1380,
        360
      ],
      "parameters": {
        "jsCode": "const allItems = $input.all();\nconst prospectIds = allItems.map(item => \n  item.json.matched_prospects.map(prospect => prospect.prospect_id)\n).flat();\n\nreturn [{\n  json: {\n    prospect_ids: prospectIds\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e786a130-996c-414a-b87c-aec3a61a960e",
      "name": "Explorium Enrich Contacts Information",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1160,
        260
      ],
      "parameters": {
        "url": "https://api.explorium.ai/v1/prospects/contacts_information/bulk_enrich",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { \"prospect_ids\": $json.prospect_ids } }}",
        "sendBody": true,
        "jsonHeaders": "{\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\"\n}",
        "sendHeaders": true,
        "specifyBody": "=json",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "specifyHeaders": "json",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "85mkGmNNdK1951hF",
          "name": "Header Auth Connection"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "205c6a21-e0fd-4963-aacf-8498eba0e838",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -940,
        360
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "fieldsToMatchString": "data[0].prospect_id"
      },
      "typeVersion": 3.1
    },
    {
      "id": "faa070fd-841b-460c-b25f-0e3bed266f17",
      "name": "HubSpot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "position": [
        -2260,
        360
      ],
      "webhookId": "d359fd68-9568-4787-93dd-192be0fda279",
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {}
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "hubspotDeveloperApi": {
          "id": "MpQJKDhz8ijUUHzc",
          "name": "HubSpot Developer account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76b419d5-f31d-4657-8157-a26d83564b2d",
      "name": "HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -2040,
        360
      ],
      "parameters": {
        "contactId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $input.item.json.contactId }}"
        },
        "operation": "get",
        "authentication": "appToken",
        "additionalFields": {}
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "cBozD4139iWohcJ2",
          "name": "HubSpot App Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "17e5e938-690b-41f0-b9b1-10981f109f20",
      "name": "Salesforce",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -500,
        360
      ],
      "parameters": {
        "company": "={{ $json.experience[0].company.name }}",
        "lastname": "={{ $json.full_name }}",
        "additionalFields": {
          "city": "={{ $json.city || null }}",
          "email": "={{ $json.professions_email || null }}",
          "phone": "={{ $json.phone_numbers?.[0]?.phone_number || \"null\" }}\n",
          "state": "={{ $json.region_name || '' }}",
          "title": "={{ $json.experience?.[0]?.title?.name || null }}",
          "country": "={{ $json.country_name || null }}",
          "website": "={{ $json.experience?.[0]?.company?.website || null }}",
          "mobilePhone": "={{ $json.mobile_phone }}"
        }
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "unhmsSbB64eNwCMO",
          "name": "Salesforce account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53699185-4fe8-4add-8b6f-4825e481dcf3",
      "name": "Code - flatten",
      "type": "n8n-nodes-base.code",
      "position": [
        -720,
        360
      ],
      "parameters": {
        "jsCode": "return $input.all().map(item => \n    item.json.data.map(prospect => ({\n      prospect_id: prospect.prospect_id,\n      ...prospect.data\n    }))\n  ).flat()"
      },
      "typeVersion": 2
    },
    {
      "id": "a39d10c7-e80e-4493-a555-f1fe36216c59",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3320,
        80
      ],
      "parameters": {
        "width": 960,
        "height": 2800,
        "content": "# Automatically enrich prospect data from HubSpot using Explorium and create leads in Salesforce\n\nThis n8n workflow streamlines the process of enriching prospect information by automatically pulling data from HubSpot, processing it through Explorium's AI-powered tools, and creating new leads in Salesforce with enhanced prospect details.\n\n## Credentials Required\n\nTo use this workflow, set up the following credentials in your n8n environment:\n\n### HubSpot\n- **Type**: App Token (or OAuth2 for broader compatibility)\n- **Used for**: triggering on new contacts, fetching contact data\n\n### Explorium API\n- **Type**: Generic Header Auth\n- **Header**: Authorization\n- **Value**: Bearer YOUR_API_KEY\n\n### Salesforce\n- **Type**: OAuth2 or Username/Password\n- **Used for**: creating new lead records\n\nGo to Settings → Credentials, create these three credentials, and assign them in the respective nodes before running the workflow.\n\n## Workflow Overview\n\n### Node 1: HubSpot Trigger\nThis node listens for real-time events from the connected HubSpot account. Once triggered, the node passes metadata about the event to the next step in the flow.\n\n### Node 2: HubSpot\nThis node fetches contact details from HubSpot after the trigger event.\n\n- **Credential**: Connected using a HubSpot App Token\n- **Resource**: Contact\n- **Operation**: Get Contact\n- **Return All**: Disabled\n\nThis node retrieves the full contact details needed for further processing and enrichment.\n\n### Node 3: Match prospect\nThis node sends each contact's data to Explorium's AI-powered prospect matching API in real time.\n\n- **Method**: POST\n- **Endpoint**: https://api.explorium.ai/v1/prospects/match\n- **Authentication**: Generic Header Auth (using a configured credential)\n- **Headers**: Content-Type: application/json\n\nThe request body is dynamically built from contact data, typically including: full_name, company_name, email, phone_number, linkedin. These fields are matched against Explorium's intelligence graph to return enriched or validated profiles.\n\n**Response Output**: total_matches, matched_prospects, and a prospect_id. Each response is used downstream to enrich, validate, or create lead information.\n\n### Node 4: Filter\nThis node filters the output from the Match prospect step to ensure that only valid, matched results continue in the flow. Only records that contain at least one matched prospect with a non-null prospect_id are passed forward.\n\n**Status**: Currently deactivated (as shown by the \"Deactivate\" label)\n\n### Node 5: Extract Prospect IDs from Matched Results\nThis node extracts all valid prospect_id values from previously matched prospects and compiles them into a flat array. It loops over all matched items, extracts each prospect_id from the matched_prospects array and returns a single object with an array of all prospect_ids.\n\n### Node 6: Explorium Enrich Contacts Information\nThis node performs bulk enrichment of contacts by querying Explorium with a list of matched prospect_ids.\n\n**Node Configuration:**\n- **Method**: POST\n- **Endpoint**: https://api.explorium.ai/v1/prospects/contacts_information/bulk_enrich\n- **Authentication**: Header Auth (using saved credentials)\n- **Headers**: \"Content-Type\": \"application/json\", \"Accept\": \"application/json\"\n\nReturns enriched contact information, such as:\n- **emails**: professional/personal email addresses\n- **phone_numbers**: mobile and work numbers\n- **professions_email**, **professional_email_status**, **mobile_phone**\n\n### Node 7: Explorium Enrich Profiles\nThis additional enrichment node provides supplementary contact data enhancement, running in parallel with the primary enrichment process.\n\n### Node 8: Merge\nThis node combines multiple data streams from the parallel enrichment processes into a single output, allowing you to consolidate data from different Explorium enrichment endpoints. The \"combine\" setting indicates it will merge the incoming data streams rather than overwriting them.\n\n### Node 9: Code - flatten\nThis custom code node processes and transforms the merged enrichment data before creating the Salesforce lead. It can be used to:\n- Flatten nested data structures\n- Format data according to Salesforce field requirements\n- Apply business logic or data validation\n- Map Explorium fields to Salesforce lead properties\n- Handle data type conversions\n\n### Node 10: Salesforce\nThis final node creates new leads in Salesforce using the enriched data returned by Explorium.\n\n- **Credential**: Salesforce OAuth2 or Username/Password\n- **Resource**: Lead\n- **Operation**: Create Lead\n\nThe node creates new lead records with enriched information including contact details, company information, and professional data obtained through the Explorium enrichment process.\n\n## Workflow Flow Summary\n\n1. **Trigger**: HubSpot webhook triggers on new/updated contacts\n2. **Fetch**: Retrieve contact details from HubSpot\n3. **Match**: Find prospect matches using Explorium\n4. **Filter**: Keep only successfully matched prospects (currently deactivated)\n5. **Extract**: Compile prospect IDs for bulk enrichment\n6. **Enrich**: Parallel enrichment of contact information through multiple Explorium endpoints\n7. **Merge**: Combine enrichment results\n8. **Transform**: Flatten and prepare data for Salesforce (Code node)\n9. **Create**: Create new lead records in Salesforce\n\nThis workflow ensures comprehensive data enrichment while maintaining data quality and providing a seamless integration between HubSpot prospect data and Salesforce lead creation. The parallel enrichment structure maximizes data collection efficiency before creating high-quality leads in your CRM system."
      },
      "typeVersion": 1
    },
    {
      "id": "60f1e6d3-7bbe-435a-85af-59c79f81aa5f",
      "name": "Filter - non matched",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1600,
        360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6896e951-8d66-41b1-87a5-a96d2e049675",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.matched_prospects.some(prospect => prospect.prospect_id !== null).toBoolean() }}",
              "rightValue": "null"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "459bb55b-663d-4913-b11a-b3be6b16de06",
      "name": "Explorium Enrich Profiles",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1160,
        460
      ],
      "parameters": {
        "url": "https://api.explorium.ai/v1/prospects/profiles/bulk_enrich",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { \"prospect_ids\": $json.prospect_ids } }}",
        "sendBody": true,
        "jsonHeaders": "{\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\"\n}",
        "sendHeaders": true,
        "specifyBody": "=json",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "specifyHeaders": "json",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "85mkGmNNdK1951hF",
          "name": "Header Auth Connection"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d2824b55-3ef6-41ac-a550-ef8701401167",
  "connections": {
    "205c6a21-e0fd-4963-aacf-8498eba0e838": {
      "main": [
        [
          {
            "node": "53699185-4fe8-4add-8b6f-4825e481dcf3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "76b419d5-f31d-4657-8157-a26d83564b2d": {
      "main": [
        [
          {
            "node": "306813bf-056d-48fc-ba8b-e64ddb01beda",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "53699185-4fe8-4add-8b6f-4825e481dcf3": {
      "main": [
        [
          {
            "node": "17e5e938-690b-41f0-b9b1-10981f109f20",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "306813bf-056d-48fc-ba8b-e64ddb01beda": {
      "main": [
        [
          {
            "node": "60f1e6d3-7bbe-435a-85af-59c79f81aa5f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "faa070fd-841b-460c-b25f-0e3bed266f17": {
      "main": [
        [
          {
            "node": "76b419d5-f31d-4657-8157-a26d83564b2d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "60f1e6d3-7bbe-435a-85af-59c79f81aa5f": {
      "main": [
        [
          {
            "node": "08e9aa3a-6957-4f88-9ad7-f492652046e4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "459bb55b-663d-4913-b11a-b3be6b16de06": {
      "main": [
        [
          {
            "node": "205c6a21-e0fd-4963-aacf-8498eba0e838",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "e786a130-996c-414a-b87c-aec3a61a960e": {
      "main": [
        [
          {
            "node": "205c6a21-e0fd-4963-aacf-8498eba0e838",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "08e9aa3a-6957-4f88-9ad7-f492652046e4": {
      "main": [
        [
          {
            "node": "e786a130-996c-414a-b87c-aec3a61a960e",
            "type": "main",
            "index": 0
          },
          {
            "node": "459bb55b-663d-4913-b11a-b3be6b16de06",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 销售, 人工智能

需要付费吗?

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

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

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

作者
explorium

explorium

@explorium

Explorium empowers businesses to build high-performance GTM agents with specialized data infrastructure. Our seamless API integrations and high-quality data drive faster agent development and better results. With years of experience and robust data sets, we deliver context-aware solutions, helping AI agents achieve human-level support. Explorium is the essential data partner for teams building agent-driven technologies.

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34