Skip to main content
Docs reference: Lusha Prospecting Search & Enrich API

How It Works

Each run searches Lusha using your configured filters, enriches only contacts not yet revealed (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

  1. Go to Settings → Integrations → Private Apps → Create a private app
  2. Name it (e.g. Lusha Sync)
  3. Under the Scopes tab add:
    • crm.objects.contacts.read
    • crm.objects.contacts.write
    • crm.objects.companies.read
    • crm.objects.companies.write
  4. Click Create app and copy the pat-... token

2. Create a Config Company Record

  1. In HubSpot CRM create a new Company named Lusha Sync Config
  2. Add a custom Number property called lusha_current_page (default value: 0)
  3. Copy the record ID from the URL:

3. Create a Workflow & Choose a Trigger

  1. Go to Automations → Workflows → From scratch → Company-based
  2. Choose a trigger - the scheduled monthly trigger is the recommended default but any of the following work:
  1. Enroll the Lusha Sync Config company 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

  1. Inside the workflow click + → Custom code → Node.js 20.x
  2. In the Secrets section add:
    • api_key → your Lusha API key
    • HUBSPOT_TOKEN → your pat-... token from Step 1
  3. 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 the CONFIG 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 to 0 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 the lusha_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 DOMAINS list 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:

What can be passed in

Only values that map directly to a Lusha API filter are useful here. Passing in an arbitrary HubSpot property won’t do anything unless the code uses it to build the search payload.
Input fields only support flat string/number values - no arrays or objects. Any list (e.g. multiple domains) needs to be stored as comma-separated text and split in the code.