{ "id": "S0xh8JWwi3y3nGuQ", "meta": { "instanceId": "0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77" }, "name": "Automate HubSpot to Salesforce Lead Creation with Explorium AI Enrichment", "tags": [], "nodes": [ { "id": "6a2473f3-2ede-4863-82e6-32ef4e90db26", "name": "Match_prospect", "type": "n8n-nodes-base.httpRequest", "position": [ 1500, 280 ], "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" }, "typeVersion": 4.2 }, { "id": "e577c912-901b-4a80-91f9-7c1bc9e7da55", "name": "Extract Prospect IDs from Matched Results", "type": "n8n-nodes-base.code", "position": [ 1940, 280 ], "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": "2bcf24c5-1660-45bf-a734-cca39e4c8e42", "name": "Explorium Enrich Contacts Information", "type": "n8n-nodes-base.httpRequest", "position": [ 2160, 180 ], "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" }, "typeVersion": 4.2 }, { "id": "b5d2f108-46a2-410f-87c5-23f4fc0e6cd3", "name": "Merge", "type": "n8n-nodes-base.merge", "position": [ 2380, 280 ], "parameters": { "mode": "combine", "options": {}, "fieldsToMatchString": "data[0].prospect_id" }, "typeVersion": 3.1 }, { "id": "b09bb534-b5e9-41ee-9aaf-4b1184754dca", "name": "HubSpot Trigger", "type": "n8n-nodes-base.hubspotTrigger", "position": [ 1060, 280 ], "webhookId": "d359fd68-9568-4787-93dd-192be0fda279", "parameters": { "eventsUi": { "eventValues": [ {} ] }, "additionalFields": {} }, "typeVersion": 1 }, { "id": "98dcb78c-c355-4acf-b981-a89811492b79", "name": "HubSpot", "type": "n8n-nodes-base.hubspot", "position": [ 1280, 280 ], "parameters": { "contactId": { "__rl": true, "mode": "id", "value": "={{ $input.item.json.contactId }}" }, "operation": "get", "authentication": "appToken", "additionalFields": {} }, "typeVersion": 2.1 }, { "id": "f7db7871-05d8-4153-aabd-62b2d89dbb2e", "name": "Salesforce", "type": "n8n-nodes-base.salesforce", "position": [ 2820, 280 ], "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 }}" } }, "typeVersion": 1 }, { "id": "739eb304-1972-4de8-ad36-760398eeef21", "name": "Code - flatten", "type": "n8n-nodes-base.code", "position": [ 2600, 280 ], "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": "957f0749-8b3d-4136-8e86-16972c63be60", "name": "Filter - non matched", "type": "n8n-nodes-base.filter", "position": [ 1720, 280 ], "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": "9b23c2b0-5e67-4db5-bd17-0f7bee7a29ff", "name": "Explorium Enrich Profiles", "type": "n8n-nodes-base.httpRequest", "position": [ 2160, 380 ], "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" }, "typeVersion": 4.2 }, { "id": "bd035ccb-8992-4024-bc6a-f2da971ac5e5", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1020, 580 ], "parameters": { "width": 600, "height": 760, "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." }, "typeVersion": 1 }, { "id": "6f74e78c-45b3-4fc7-85cc-266b52b8c949", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 1640, 580 ], "parameters": { "color": 6, "width": 880, "height": 1880, "content": "## 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." }, "typeVersion": 1 }, { "id": "84e08fdb-2f50-4bfd-9b75-a148426d7260", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 2540, 580 ], "parameters": { "color": 4, "width": 600, "height": 760, "content": "## 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 } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "versionId": "75d2149a-71dd-4dce-89ba-f7582aab6065", "connections": { "Merge": { "main": [ [ { "node": "Code - flatten", "type": "main", "index": 0 } ] ] }, "HubSpot": { "main": [ [ { "node": "Match_prospect", "type": "main", "index": 0 } ] ] }, "Code - flatten": { "main": [ [ { "node": "Salesforce", "type": "main", "index": 0 } ] ] }, "Match_prospect": { "main": [ [ { "node": "Filter - non matched", "type": "main", "index": 0 } ] ] }, "HubSpot Trigger": { "main": [ [ { "node": "HubSpot", "type": "main", "index": 0 } ] ] }, "Filter - non matched": { "main": [ [ { "node": "Extract Prospect IDs from Matched Results", "type": "main", "index": 0 } ] ] }, "Explorium Enrich Profiles": { "main": [ [ { "node": "Merge", "type": "main", "index": 1 } ] ] }, "Explorium Enrich Contacts Information": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "Extract Prospect IDs from Matched Results": { "main": [ [ { "node": "Explorium Enrich Contacts Information", "type": "main", "index": 0 }, { "node": "Explorium Enrich Profiles", "type": "main", "index": 0 } ] ] } } }