How It Works
isShown: false), creates them in HubSpot, and saves the current page so the next run picks up where it left off automatically.
Requirements
Setup Steps
1. Create a HubSpot Private App
- Go to Settings → Integrations → Private Apps → Create a private app
- Name it (e.g.
Lusha Sync) - Under the Scopes tab add:
crm.objects.contacts.readcrm.objects.contacts.writecrm.objects.companies.readcrm.objects.companies.write
- Click Create app and copy the
pat-...token
2. Create a Config Company Record
- In HubSpot CRM create a new Company named
Lusha Sync Config - Add a custom Number property called
lusha_current_page(default value:0) - Copy the record ID from the URL:
3. Create a Workflow & Choose a Trigger
- Go to Automations → Workflows → From scratch → Company-based
- Choose a trigger - the scheduled monthly trigger is the recommended default but any of the following work:
- Enroll the
Lusha Sync Configcompany record (for scheduled trigger) or set your enrollment criteria
If using a per-company trigger (e.g. record created), remove the pagination logic from the code and pass the company domain dynamically instead - see Using HubSpot Properties in the CONFIG Block below.
4. Add a Custom Code Action
- Inside the workflow click + → Custom code → Node.js 20.x
- In the Secrets section add:
api_key→ your Lusha API keyHUBSPOT_TOKEN→ yourpat-...token from Step 1
- Paste the template code (
HubSpot_Lusha_Prospecting_API_template.js) into the editor
5. Fill in the CONFIG Block
At the top of the code update theCONFIG section with your values. Only CONFIG_COMPANY_ID and DOMAINS are required - all other filters are optional and can be left as null.
6. Set Output Fields
In the custom code action scroll to Output fields and add:7. Test
Click Test at the bottom of the code editor. Select any contact record when prompted (it won’t be used). Check the logs for:8. Activate
Click Review and publish → Turn On. The workflow runs monthly, advancing one page per run automatically. Page counter resets to0 once all results are processed.
Available Filters
For accepted values, enums, and full schema details refer to the Lusha Prospecting API docs.Contact Filters
Company Filters
Seniority Reference
Deduplication
- Contacts already in HubSpot are matched by email address - duplicates are silently skipped (HTTP 409)
- Contacts already revealed in Lusha (
isShown: true) are skipped to avoid re-charging credits
Pagination
The workflow tracks progress using thelusha_current_page property on the config record:
To reset and start over, set
lusha_current_page back to 0 on the config company record.
Using HubSpot Properties in the CONFIG Block
The CONFIG block is static by default, but you can reference live HubSpot property values by passing them in as input fields on the custom code action. When is this useful?- You want the
DOMAINSlist driven by company records in HubSpot rather than hardcoded - You want to use a contact owner, lifecycle stage, or custom field to control filter behavior per-run
- You want different teams or accounts to trigger the workflow with their own filters
How to set it up
Step 1 - In the custom code action UI, under “Property to include in code” add:
Step 2 - In the code, read the value from
event.inputFields and use it in CONFIG: