Data Enrichment Pipeline

Enrich lead data with company information, technographics, and intent signals.

This workflow takes basic lead information and enriches it with firmographics, tech stack, funding data, and contact details.

Implementation

1import { relay } from "@relayplane/workflows";
2
3const result = await relay
4 .workflow("data-enrichment")
5
6 // Step 1: Research company information
7 .step("company-research")
8 .with("perplexity:sonar-pro")
9 .prompt(`Research this company:
10
11Company: {{companyName}}
12Domain: {{domain}}
13
14Gather:
15- Company size (employee count)
16- Industry and sub-industry
17- Headquarters location
18- Year founded
19- Funding stage and total raised
20- Key products/services
21- Recent news or expansions
22
23Provide structured data with sources.`)
24
25 // Step 2: Identify technology stack
26 .step("tech-stack")
27 .with("openai:gpt-4o")
28 .depends("company-research")
29 .prompt(`Based on this company profile, infer their technology stack:
30
31{{company-research.output}}
32Website: {{domain}}
33
34Likely technologies:
35- Cloud infrastructure (AWS/GCP/Azure)
36- CRM system (Salesforce/HubSpot)
37- Marketing tools
38- Development stack
39- Data/analytics platforms
40
41Also identify:
42- Pain points related to their stack
43- Potential need for our product
44- Competitive intel (if they use competitors)`)
45
46 // Step 3: Find decision makers
47 .step("find-contacts")
48 .with("anthropic:claude-3.5-sonnet")
49 .depends("company-research", "tech-stack")
50 .prompt(`Identify decision makers for our product:
51
52Company Data: {{company-research.output}}
53Tech Stack: {{tech-stack.output}}
54
55Our Product: {{productDescription}}
56
57Who to target:
58- Job titles of decision makers
59- Departments involved in buying decision
60- Typical org structure for this company size
61- Champions vs economic buyers
62
63Provide LinkedIn search queries to find these people.`)
64
65 // Step 4: Generate account score
66 .step("score-account")
67 .with("openai:gpt-4o")
68 .depends("company-research", "tech-stack", "find-contacts")
69 .prompt(`Score this account as a sales opportunity:
70
71Company: {{company-research.output}}
72Tech: {{tech-stack.output}}
73Contacts: {{find-contacts.output}}
74
75Scoring criteria:
76- Company size fit (0-25 points)
77- Industry fit (0-25 points)
78- Tech stack compatibility (0-20 points)
79- Budget indicators (0-15 points)
80- Intent signals (0-15 points)
81
82Total score (0-100) with breakdown.
83Recommend: Pursue, Nurture, or Disqualify`)
84
85 // Step 5: Draft personalized outreach
86 .step("draft-outreach")
87 .with("anthropic:claude-3.5-sonnet")
88 .depends("company-research", "tech-stack", "score-account")
89 .prompt(`Draft personalized outreach email:
90
91Company Context: {{company-research.output}}
92Tech Stack: {{tech-stack.output}}
93Account Score: {{score-account.output}}
94
95Target Role: {{targetRole}}
96Our Value Prop: {{valueProposition}}
97
98Email requirements:
99- Personalized hook (reference specific company detail)
100- Relevant pain point based on their tech stack
101- Concise value proposition (2 sentences)
102- Soft CTA (15-min chat)
103- Under 100 words total
104
105Professional but conversational tone.`)
106
107 .run({
108 companyName: "TechCorp Solutions",
109 domain: "techcorp.com",
110 productDescription: "AI workflow automation platform for enterprises",
111 targetRole: "VP of Engineering",
112 valueProposition: "Reduce engineering ops overhead by 60% with AI agents",
113 });
114
115// Update CRM
116await updateCRM({
117 company: result.steps["company-research"].output,
118 enrichmentData: {
119 techStack: result.steps["tech-stack"].output,
120 accountScore: result.steps["score-account"].output,
121 contacts: result.steps["find-contacts"].output,
122 },
123 draftEmail: result.steps["draft-outreach"].output,
124});

Batch Processing

1// Enrich list of leads
2import { relay } from "@relayplane/workflows";
3
4async function enrichLeadList(leads: Array<{ company: string; domain: string }>) {
5 const results = [];
6
7 for (const lead of leads) {
8 const enriched = await relay
9 .workflow("data-enrichment")
10 .run({
11 companyName: lead.company,
12 domain: lead.domain,
13 productDescription: "Workflow automation platform",
14 targetRole: "Engineering Leader",
15 valueProposition: "Ship faster with AI-powered workflows",
16 });
17
18 const score = JSON.parse(enriched.steps["score-account"].output);
19
20 results.push({
21 company: lead.company,
22 score: score.total,
23 recommendation: score.recommendation,
24 outreach: enriched.steps["draft-outreach"].output,
25 });
26
27 // Rate limit: 1 per second
28 await new Promise(resolve => setTimeout(resolve, 1000));
29 }
30
31 // Sort by score
32 return results.sort((a, b) => b.score - a.score);
33}
34
35const enrichedLeads = await enrichLeadList(csvLeads);
36console.log("Top prospects:", enrichedLeads.slice(0, 10));

Webhook Integration

1# Auto-enrich leads from form submissions
2relayplane webhooks create lead-enrichment \
3 --workflow data-enrichment \
4 --secret ${WEBHOOK_SECRET}
5
6# Configure in your form handler:
7# POST https://api.relayplane.com/webhooks/lead-enrichment
8# { "companyName": "...", "domain": "..." }

Sample Output

**Account Score Breakdown:** - Company Size Fit: 25/25 (500-1000 employees, perfect ICP) - Industry Fit: 20/25 (B2B SaaS, high intent) - Tech Stack: 18/20 (Modern stack, no competitor detected) - Budget: 12/15 (Series B funded, $50M raised) - Intent: 10/15 (Recent job posting for automation engineer) **Total: 85/100 - PURSUE** **Recommended Action:** High-priority outbound sequence

Data Sources

  • Perplexity: Real-time web research for company data
  • BuiltWith/Wappalyzer: Technology stack detection
  • LinkedIn: Decision maker identification
  • Crunchbase API: Funding and growth data