leads:lookup:bq is the warehouse-backed version of lead generation. It builds SQL from an ICP, can emit that SQL to disk, can execute it with the local bq CLI, and can normalize the resulting rows into the Salesprompter lead contract.
What the command does
The command combines:
- ICP filters from
IcpSchema - warehouse field mapping
- optional keyword search across multiple text columns
- Salesprompter safety guards by default
The result is a query you can inspect before you execute it.
Default table and fields
By default, the command targets:
icpidentifier.SalesGPT.leadPool_new
Default field mappings:
| Purpose | Default field |
|---|---|
| company | companyName |
| domain | domain |
| title | jobTitle |
| industry | industry |
| company size | companySize |
| country | company_countryCode |
| first name | firstName |
| last name | lastName |
email |
|
| keyword search fields | companyName,industry,description,tagline,specialties |
Override any of these with the command options when your warehouse schema differs.
Safety guards
Unless you pass --no-salesprompter-guards, the generated SQL automatically filters out rows that are:
- missing email
- email invalid
- company blacklisted
- already in sequence
- replied
- bounced
- title blacklisted
These guards are meant to protect the default production lead-pool path. Disable them only when you have a clear reason.
Common usage patterns
SQL only
node ./dist/cli.js leads:lookup:bq \
--icp ./data/icp.json \
--limit 200 \
--sql-out ./data/lead-lookup.sql
Execute and keep raw rows
node ./dist/cli.js leads:lookup:bq \
--icp ./data/icp.json \
--limit 200 \
--execute \
--out ./data/lead-rows.json
Execute and normalize into lead artifacts
node ./dist/cli.js leads:lookup:bq \
--icp ./data/icp.json \
--limit 200 \
--execute \
--out ./data/lead-rows.json \
--lead-out ./data/leads.json
Additional predicates
Use --additional-where when you need a one-off warehouse filter:
node ./dist/cli.js leads:lookup:bq \
--icp ./data/icp.json \
--additional-where "LOWER(companyName) LIKE '%deel%'" \
--sql-out ./data/custom.sql
Treat this as an escape hatch. It appends raw SQL into the generated WHERE clause, so it should be used intentionally and reviewed before execution.
Normalization behavior
When you use --lead-out, the CLI normalizes warehouse rows into the standard Lead shape:
companySizebuckets becomeemployeeCount- blank region values are derived from country
- the output source is
bigquery-leadpool - signals are initialized as an empty array