What You Get
- -Lead enrichment automation
- -Intelligent lead scoring and tagging
- -Auto-assignment to sales reps
- -Follow-up sequence triggers
- -CRM health dashboard
Step by Step
1. Set up CRM webhook listener
Create a webhook endpoint in Next.js that receives new contact events from HubSpot (or Salesforce). Validate the webhook signature. Incoming lead data includes: name, email, company, phone, source. Store in a local PostgreSQL table as a processing queue.
2. Build the enrichment service
For each new lead, use OpenAI to enrich: look up company domain from email, fetch website content via Playwright, extract company size range, industry, tech stack, and funding stage. Also look up the lead's LinkedIn headline for role seniority.
3. Implement lead scoring
Use OpenAI to score each lead as hot/warm/cold based on: company fit (target industry match), role seniority (C-level/VP vs manager), engagement signals (opened emails, visited pricing page), and budget indicators.
4. Build auto-tagging
Use OpenAI to generate relevant tags from lead and company description. Tag examples: 'tech-startup', 'enterprise-50+', 'e-commerce', 'SaaS', 'marketing', 'founder'. Apply tags to CRM contact record via API.
5. Implement auto-assignment
Build a routing engine: hot leads go to senior sales reps (round-robin), warm leads go to junior reps, cold leads go to a nurture sequence (automated email drip). Validate assignment with a 1-hour cooldown per lead.
6. Build the dashboard
Create a metrics dashboard: enrichment stats (leads enriched, enrichment success rate), assignment accuracy (follow-up rate per rep), pipeline stats (hot/warm/cold distribution), and conversion tracking.
Stack
Build This
Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.
Common Failure Modes
- !Over-enrichment with irrelevant data
- !Wrong lead assignment from bad scoring
- !Email fatigue from over-automation
- !CRM API quota exhaustion
Implementation Notes
Start with enrichment only (no auto-assign or email) for 1 week to validate data quality. Add auto-assign in week 2. Add email in week 3.
Related skill: neon crm automation
Want crm automation pipeline running in your business?
4M Labs can deploy crm automation pipeline as a production workflow:
- Connected to your tools and data sources
- Secured for your team with proper access controls
- Deployed with monitoring and error handling
- Documented for handoff and future maintenance