This repository implements a full-featured, AI-powered B2B lead pipeline designed for agencies and SaaS platforms that require scalable, automated outbound lead generation. The pipeline covers the entire journey from raw contact data to enriched, personalized outreach, and is built to be modular, extensible, and production-ready.
Key Features:
- Contact Data Normalization: Cleans and standardizes raw lead data.
- Automated Web Scraping: Gathers company context (website, LinkedIn, etc.) for each contact.
- AI Market Research: Summarizes company background and pain points using LLMs.
- Personalized Outreach: Generates custom first lines/emails based on research.
- Seamless Integration: Pushes enriched leads into outbound platforms (e.g., SalesBlaster AI Voice).
- Batch & Incremental Processing: Supports large-scale, bi-weekly lead drops and incremental enrichment.
- Multi-Tenant Ready: Designed for agencies serving multiple clients with customizable workflows.
This pipeline was built to power the SalesBlaster DFY High Ticket Offer—a 3-month program for agencies and SMBs to automate and scale outbound campaigns using AI. The system is designed to be generic and configurable, allowing agencies to onboard new clients by simply swapping out a few variables and context files.
Typical Workflow:
- Input: Upload a CSV of raw leads.
- Normalization: Standardize and validate contact data.
- Scraping: Collect company context (website, LinkedIn, etc.).
- Market Research: Use LLMs to generate a research report for each company.
- Personalization: Generate a custom first-line/email for each contact.
- Export: Push enriched leads to outbound platforms for automated campaigns.
lead-pipeline/
│
├── .input/ # All user-supplied data and configuration
│ ├── config.json # Offer-specific config (pain points, value props, etc.)
│ ├── contacts.csv # Input CSV(s) of raw leads
│ ├── collection/ # Example configs for different agencies/clients
│ └── ... # Prompt variables, templates, etc.
│
├── libs/
│ ├── lead-pipeline/ # Main pipeline logic
│ │ ├── src/
│ │ │ ├── main.ts # Entry point for running the pipeline
│ │ │ ├── lib/
│ │ │ │ ├── csv/
│ │ │ │ │ └── pipe.ts # Core CSV processing and enrichment logic
│ │ │ │ ├── llm/
│ │ │ │ │ └── prompts/ # LLM prompt templates and logic
│ │ │ │ └── ... # Other helpers/utilities
│ │ └── ...
│ └── lead-pipeline-scraper/ # Apify/Crawlee-based web scraper
│ └── ... # Scraper code for collecting website markdown
│
├── storage/
│ └── datasets/ # Scraped website data, organized by dataset name
│
├── cli/ # (Deprecated) Old CLI interface (see notes below)
│
├── README.md
└── package.json
cd lead-pipeline
npm install- Place your input CSV(s) in the
.input/directory. - Edit
.input/config.jsonto reflect your offer, value props, and pain points. - (Optional) Add or modify prompt templates in
.input/orsrc/lib/llm/prompts/.
- Use the Apify/Crawlee scraper in
libs/lead-pipeline-scraperto collect website markdown for each company. - Scraped data will be stored in
storage/datasets/<dataset_name>/. - The pipeline will automatically match dataset names to the correct context.
# Basic usage
tsx libs/lead-pipeline/src/main.ts <dataset_name>
# With input file
tsx libs/lead-pipeline/src/main.ts <dataset_name> contacts.csv
# With research and AI options
tsx libs/lead-pipeline/src/main.ts <dataset_name> contacts.csv -r 10 -a 10
# Flags:
# -r / --research: Number of new market research entries to generate
# -a / --ai: Number of new personalized lines to generate- The pipeline will only process rows that do not already have research or personalized lines, allowing for incremental/batch processing.
- Enriched, personalized leads are output to the specified location or pushed directly to your outbound platform (e.g., SalesBlaster AI Voice).
- Multi-Tenant Support: To onboard a new agency/client, simply add a new config in
.input/collection/and point the pipeline to the correct dataset. - Prompt Engineering: All LLM prompts and variables are easily editable in
.input/andsrc/lib/llm/prompts/. - Scraper: The web scraper is modular and can be extended to collect additional context (e.g., social profiles, news, etc.).
- Integration: The final step can be customized to push leads to any outbound platform or CRM.
- The
/clidirectory contains a deprecated CLI interface. The current approach is to run the pipeline directly viatsxfor simplicity and reproducibility. - Make sure to run all commands from the directory containing your
.envfile for environment variable support.
This codebase was built as a proof-of-concept for a fully automated, AI-driven lead pipeline. The next step is to migrate this logic to a workflow engine (ideally with a no-code UI) to:
- Reduce key-person risk
- Enable non-technical users to manage pipelines via a UI
- Support multi-tenant, client-facing workflows
- Leverage pre-built templates and integrations
If you are evaluating this repository for migration or partnership, focus on:
src/main.tsandsrc/lib/csv/pipe.tsfor the core logic.input/for configuration and prompt managementlibs/lead-pipeline-scraperfor scraping context
The AI Growth Infrastructure program is designed to help agencies and SMBs scale outbound campaigns using AI-driven automation. This repository powers the backend for our DFY (Done-For-You) offer, enabling high-volume, high-quality lead generation and outreach at scale.
Happy automating!