Skip to content

Commit c0642ce

Browse files
fix(enrichments): unify company-info employee count across providers
Hunter's companies/find returns an employee range string (e.g. "11-50") not a numeric count, so the number-typed employeeCount column was blank whenever Hunter matched. Make employeeCount a string so Hunter's range and PDL's exact count both populate it, and put the free Hunter provider first with PDL as paid fallback.
1 parent 7e751b8 commit c0642ce

1 file changed

Lines changed: 24 additions & 21 deletions

File tree

apps/sim/enrichments/company-info/company-info.ts

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ function num(value: unknown): number | undefined {
1010

1111
/**
1212
* Company Info enrichment. Looks up firmographics for a company domain, trying
13-
* People Data Labs first (richest record, incl. employee count) then Hunter as
14-
* a fallback.
13+
* Hunter first (free) then People Data Labs as a fallback. `employeeCount` is a
14+
* string so both Hunter's range bucket (e.g. `"11-50"`) and PDL's exact count
15+
* map onto the same column — the result stays consistent regardless of which
16+
* provider fills the cell.
1517
*/
1618
export const companyInfoEnrichment: EnrichmentConfig = {
1719
id: 'company-info',
@@ -22,11 +24,29 @@ export const companyInfoEnrichment: EnrichmentConfig = {
2224
inputs: [{ id: 'domain', name: 'Company domain', type: 'string', required: true }],
2325
outputs: [
2426
{ id: 'industry', name: 'industry', type: 'string' },
25-
{ id: 'employeeCount', name: 'employee count', type: 'number' },
27+
{ id: 'employeeCount', name: 'employee count', type: 'string' },
2628
{ id: 'foundedYear', name: 'founded year', type: 'number' },
2729
{ id: 'description', name: 'description', type: 'string' },
2830
],
2931
providers: [
32+
toolProvider({
33+
id: 'hunter',
34+
label: 'Hunter',
35+
toolId: 'hunter_companies_find',
36+
buildParams: (inputs) => {
37+
const domain = normalizeDomain(inputs.domain)
38+
if (!domain) return null
39+
return { domain }
40+
},
41+
mapOutput: (output) => {
42+
return filterUndefined({
43+
industry: str(output.industry) || undefined,
44+
employeeCount: str(output.size) || undefined,
45+
foundedYear: num(output.founded_year),
46+
description: str(output.description) || undefined,
47+
})
48+
},
49+
}),
3050
toolProvider({
3151
id: 'pdl',
3252
label: 'People Data Labs',
@@ -40,28 +60,11 @@ export const companyInfoEnrichment: EnrichmentConfig = {
4060
const company = output.company as Record<string, unknown> | undefined
4161
return filterUndefined({
4262
industry: str(company?.industry) || undefined,
43-
employeeCount: num(company?.employee_count),
63+
employeeCount: str(company?.employee_count) || undefined,
4464
foundedYear: num(company?.founded),
4565
description: str(company?.summary) || undefined,
4666
})
4767
},
4868
}),
49-
toolProvider({
50-
id: 'hunter',
51-
label: 'Hunter',
52-
toolId: 'hunter_companies_find',
53-
buildParams: (inputs) => {
54-
const domain = normalizeDomain(inputs.domain)
55-
if (!domain) return null
56-
return { domain }
57-
},
58-
mapOutput: (output) => {
59-
return filterUndefined({
60-
industry: str(output.industry) || undefined,
61-
foundedYear: num(output.founded_year),
62-
description: str(output.description) || undefined,
63-
})
64-
},
65-
}),
6669
],
6770
}

0 commit comments

Comments
 (0)