Skip to content

Commit c20d5fc

Browse files
fix(enrichment): stop PDL billing on no-match via required-field gating (#5184)
PDL bills per matched profile, but each cascade only counts a hit when mapOutput yields a specific field. A confident profile (likelihood >= 6) lacking that field was billed yet recorded as no_match. Pass PDL's required param so it 404s (free) when the extracted field is absent, aligning PDL's billing unit with the cascade's success unit.
1 parent bf5077b commit c20d5fc

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

apps/sim/enrichments/company-domain/company-domain.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('company-domain enrichment cascade', () => {
2222
const p = provider('pdl')
2323
it('matches by name and normalizes the returned website', () => {
2424
expect(p.toolId).toBe('pdl_company_enrich')
25-
expect(p.buildParams(nameInput)).toEqual({ name: 'Acme Inc' })
25+
expect(p.buildParams(nameInput)).toEqual({ name: 'Acme Inc', required: 'website' })
2626
expect(p.buildParams({ companyName: '' })).toBeNull()
2727
expect(p.mapOutput({ company: { website: 'https://www.acme.com' } })).toEqual({
2828
domain: 'acme.com',

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export const companyDomainEnrichment: EnrichmentConfig = {
2121
buildParams: (inputs) => {
2222
const name = str(inputs.companyName)
2323
if (!name) return null
24-
return { name }
24+
// `required` makes PDL 404 (free) when the match has no website,
25+
// instead of charging a credit for a match we'd discard as a no-match.
26+
return { name, required: 'website' }
2527
},
2628
mapOutput: (output) => {
2729
const company = output.company as Record<string, unknown> | undefined

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export const companyInfoEnrichment: EnrichmentConfig = {
4545
buildParams: (inputs) => {
4646
const website = normalizeDomain(inputs.domain)
4747
if (!website) return null
48-
return { website }
48+
// `required` makes PDL 404 (free) when neither field we extract is
49+
// present, instead of charging a credit for a match we'd discard.
50+
return { website, required: 'employee_count OR summary' }
4951
},
5052
mapOutput: (output) => {
5153
const company = output.company as Record<string, unknown> | undefined

apps/sim/enrichments/phone-number/phone-number.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ export const phoneNumberEnrichment: EnrichmentConfig = {
3131
buildParams: (inputs) => {
3232
const name = str(inputs.fullName)
3333
if (!name) return null
34+
// `required` makes PDL 404 (free) when the profile has no phone,
35+
// instead of charging a credit for a match we'd discard as a no-match.
3436
return filterUndefined({
3537
name,
3638
company: normalizeDomain(inputs.companyDomain) || undefined,
3739
min_likelihood: 6,
40+
required: 'phone_numbers OR mobile_phone',
3841
})
3942
},
4043
mapOutput: (output) => {

apps/sim/enrichments/work-email/work-email.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ export const workEmailEnrichment: EnrichmentConfig = {
122122
buildParams: (inputs) => {
123123
const name = str(inputs.fullName)
124124
if (!name) return null
125+
// `required` makes PDL 404 (free) when the profile has no work email,
126+
// instead of charging a credit for a match we'd discard as a no-match.
125127
return filterUndefined({
126128
name,
127129
company: normalizeDomain(inputs.companyDomain) || undefined,
128130
min_likelihood: 6,
131+
required: 'work_email',
129132
})
130133
},
131134
mapOutput: (output) => {

0 commit comments

Comments
 (0)