@idriszade/process-enrich-apify
v0.1.0
Published
Pipeline-kit Process adapter for per-contact enrichment via Apify actors (B2B lead lookup, firmographic resolution).
Maintainers
Readme
@idriszade/process-enrich-apify
Pipeline-kit Process<RawContact, EnrichedContact> adapter for per-contact enrichment via Apify actors. Defaults target pipelinelabs/lead-scraper-apollo-zoominfo-lusha-ppe; the row mapper and input builder are pluggable for other lead-search actors.
Install
pnpm add @idriszade/process-enrich-apify @idriszade/core apify-client zodUsage
import { createEnrichApifyProcess } from '@idriszade/process-enrich-apify';
const enrich = createEnrichApifyProcess({
actorId: 'pipelinelabs/lead-scraper-apollo-zoominfo-lusha-ppe',
defaultInput: { seniorityIncludes: ['c_suite', 'vp', 'director'] },
});
// Inside a kit pipeline, use via Pipeline.from(...).through(enrich)...
// Or call directly:
const result = await enrich.run(
{ email: '[email protected]', title: 'VP Sales' },
ctx,
);
if (result.error === null) console.log(result.data.companyName);Token resolution
Reads APIFY_TOKEN first, falls back to APIFY_API_TOKEN (pursuit's name) — pass apifyToken in config to override either env path.
Cost
PPE actor at $0.001/lead with totalResults: 1 per enrichment ≈ $0.001/contact. Within kit's $0.10/run cap by 100x.
Schema discipline
Both RawContactSchema and EnrichedContactSchema use mode='before'-equivalent .catch(undefined) defaults per feedback_pydantic_boundary_coercion.md — boundary validators must coerce, never reject batches.
Supported actor row shapes
The default row mapper targets two known schemas:
- Nested
company.{...}(Apollo / pipelinelabs PPE actor) — top-levelemail,fullName,title,seniority, pluscompany: { name, domain, industry, employees, location: { country } }. - Flat snake_case (legacy ZoomInfo / Lusha-derived actors) —
person_email,full_name/name,job_title,company_name,company_domain, etc.
If you point this adapter at an actor with a different output schema, supply a custom rowMapper:
const enrich = createEnrichApifyProcess({
actorId: 'your-org/custom-actor',
rowMapper: (row) => ({
email: row.contactEmail,
companyName: row.organizationName,
// ...etc
}),
});When the default mapper resolves NO top-level identity fields (email, fullName, companyName, companyDomain), it logs a warning to console.warn with the unrecognized row keys. Downstream Zod validation then handles the row gracefully — actor schema drift never throws, only warns.
MCP server
Ships a stdio MCP server alongside the kit primitive:
npx -y @idriszade/process-enrich-apifyExposes a single tool enrich_contact_apify. Wire into Claude Desktop / Cursor / Smithery via mcp.json.
License
MIT.
