Skip to content

Latest commit

 

History

History
379 lines (322 loc) · 17.5 KB

File metadata and controls

379 lines (322 loc) · 17.5 KB

Lead Generator CLI Tool - Development Plan

Project Overview

A CLI tool for sending mass lead emails to prospective clients from CSV files, with AI-powered template personalization and future Voice AI integration.

Core Requirements

  • Project setup and configuration
  • CSV parsing for lead data (WorkEmail, PersonalEmail, Phone fields)
  • Email sending via Mailgun API (batches of 300)
  • AI-powered email template personalization using OpenAI
  • CLI interface with multiple commands
  • NPM module support for programmatic usage
  • Voice AI stub for future Twilio integration
  • Comprehensive testing suite

Phase 1: Project Foundation ✅

  • Initialize project structure
  • Create package.json with dependencies
  • Update .env.sample with required credentials
  • Set up ESLint and Prettier configuration
  • Create basic directory structure

Phase 2: Core Modules ✅

  • CSV parser module (src/csv-parser.js)
  • Email service module (src/email-service.js)
  • AI service module (src/ai-service.js)
  • Voice AI stub module (src/voice-service.js)

Phase 3: Email Templates ✅

  • Generate 10 custom sales templates with AI placeholders
  • Save templates to src/templates/ directory
  • Create template selection and management system

Phase 4: CLI Interface ✅

  • Main CLI entry point (bin/lead-generator.js)
  • Command-line argument parsing
  • Progress bars and status reporting
  • Error handling and validation

Phase 5: NPM Module Interface ✅

  • Main module export (index.js)
  • Programmatic API for Node.js projects
  • LeadGenerator class for easy usage

Phase 6: Testing ✅

  • Unit tests for CSV parser
  • Unit tests for AI service
  • Unit tests for email service
  • Mock services for testing

Phase 7: Documentation ✅

  • README.md with usage examples
  • API documentation
  • Configuration guide
  • CLI usage examples

Completed Features ✅

Core Functionality

  • ✅ CSV file processing with validation
  • ✅ Email validation (WorkEmail/PersonalEmail priority)
  • ✅ AI-powered template personalization via OpenAI
  • ✅ Mailgun email sending with batching
  • ✅ Rate limiting and retry logic
  • ✅ Comprehensive error handling

Templates

  • ✅ 10 professional sales email templates
  • ✅ Template categorization (growth, solution, social-proof, etc.)
  • ✅ Tone classification (professional, consultative, confident, etc.)
  • ✅ AI placeholder system for personalization

CLI Commands

  • send - Send email campaigns from CSV
  • templates - List and filter available templates
  • validate - Validate CSV file format and data
  • voice - Voice AI status (stub implementation)

NPM Module

  • ✅ LeadGenerator class for programmatic usage
  • ✅ Individual module exports for granular control
  • ✅ Quick start function for simple campaigns
  • ✅ Configuration validation

Testing

  • ✅ Comprehensive test suite using Mocha + Chai
  • ✅ Mock implementations for external services
  • ✅ Edge case coverage for validation logic
  • ✅ Error handling tests

Dependencies Installed ✅

  • yargs - Command-line argument parsing
  • csv-parser - CSV file parsing
  • mailgun.js - Mailgun email API
  • openai - OpenAI API integration
  • twilio - Voice AI (stub implementation)
  • cli-progress - Progress bars
  • ansi-colors - Terminal colors
  • dotenv - Environment variable management
  • mocha + chai + sinon - Testing framework

Environment Variables Configured ✅

  • MAILGUN_API_KEY - Mailgun API key
  • MAILGUN_DOMAIN - Mailgun domain
  • OPENAI_API_KEY - OpenAI API key
  • TWILIO_ACCOUNT_SID - Twilio account SID (future)
  • TWILIO_AUTH_TOKEN - Twilio auth token (future)
  • TWILIO_PHONE_NUMBER - Twilio phone number (future)
  • ✅ Email configuration (from, reply-to, etc.)
  • ✅ Batch processing settings
  • ✅ Feature flags (personalization, tracking, etc.)

Phase 8: Bland.ai Voice AI Integration ✅ COMPLETE

Core Voice AI Features ✅

  • Bland.ai API integration for automated cold calling
  • CSV input handling for voice campaigns (Name, PhoneNumber, Email)
  • IVR system with Press 1 (SMS + Calendly) and Press 2 (opt-out) options
  • Webhook server for call outcome callbacks
  • Real-time call status monitoring

CLI Commands for Voice AI ✅

  • coldcall run --input contacts.csv - Start cold calling campaign
  • coldcall status - Show current campaign status
  • coldcall report - Generate detailed outcome reports
  • Replaced deprecated voice command with new coldcall commands

Data Management & Compliance ✅

  • Call outcome logging (successful, missed, duration, IVR choices)
  • Structured JSON/CSV reporting for follow-up
  • Compliance features (AI identification, call hours, do-not-call)
  • SMS integration placeholder for Calendly link delivery

Technical Implementation ✅

  • Bland.ai REST API client (src/bland-ai-service.js)
  • Webhook server setup with Express.js (src/webhook-server.js)
  • Enhanced CSV parser for voice-specific fields
  • Call campaign management and status tracking
  • Comprehensive test suite for CLI coldcall commands
  • Updated CLI routing and argument parsing

Phase 9: Voice AI Template System ✅ COMPLETE

Voice Call Templates ✅

  • Create voice call template system similar to email templates
  • 10 professional voice call scripts with different approaches
  • Template categorization (opener, problem-solver, social-proof, etc.)
  • Tone classification (professional, conversational, direct, etc.)
  • Placeholder system for personalization (FIRST_NAME, COMPANY_NAME, etc.)
  • Template manager for voice scripts (src/voice-templates/)

Enhanced Bland.ai Integration ✅

  • Update BlandAIService to use template system
  • Template selection and randomization
  • Dynamic script generation from templates
  • Template-based personalization for voice calls
  • Comprehensive test coverage for template system
  • Backward compatibility with existing voice calling functionality

Voice Template Features ✅

  • 10 distinct voice call templates with unique approaches:
    • Professional Opener - Value proposition focused
    • Problem Solver - Challenge-focused approach
    • Social Proof - Success story leveraging
    • Curiosity Hook - Mystery and intrigue based
    • Direct Approach - No-nonsense straightforward
    • Conversational - Friendly and approachable
    • Urgency - Time-sensitive opportunities
    • Industry Insight - Knowledge and trend sharing
    • Referral Based - Trust and connection leveraging
    • Follow-up - Persistence-based approach
  • Template organization by category and tone
  • Personalization system with contact and config data
  • Error handling and fallback mechanisms

Phase 10: CSV Status Tracking System ✅ COMPLETE

CSV Status Management ✅

  • Add status and notes columns to CSV processing
  • Track email campaign responses (sent, failed, bounced, etc.)
  • Track voice call responses (answered, voicemail, opted-out, scheduled, etc.)
  • Update original CSV file with response data
  • Preserve original data while adding tracking columns
  • Comprehensive test coverage for status tracking functionality

Response Status Categories ✅

  • Email statuses: sent, failed, bounced, opened, clicked, replied
  • Voice call statuses: answered, voicemail, no-answer, opted-out, scheduled, failed
  • Notes field for additional context and follow-up information
  • Timestamp tracking for all interactions
  • Contact lookup by email or phone number
  • Status filtering and reporting capabilities

Integration Features ✅

  • CSV status tracker module (src/csv-status-tracker.js)
  • Status constants and validation
  • Backup functionality for CSV files
  • Async/await support for all operations
  • Error handling and graceful degradation

CLI Enhancements (Future)

  • coldcall templates - List and filter available voice templates
  • Template selection options in coldcall commands
  • A/B testing support for voice scripts

Phase 11: Enhancement Roadmap 🚧 PLANNED

🟢 Quick Wins (Easy Implementation - 1-2 days each)

  • Email Tracking Pixels - Add open/click tracking to email campaigns
  • Link Shortening & Analytics - Branded short links with click analytics
  • Unsubscribe Management - One-click unsubscribe handling
  • Template Versioning - Track template changes over time
  • Bulk Operations - Mass update contact statuses
  • Export Functionality - CSV/Excel export of all campaign data
  • Enhanced CLI Interactive Mode - Guided campaign setup wizard
  • Configuration Profiles - Save and switch between different setups
  • Dry Run Mode - Preview campaigns before execution
  • Progress Indicators - Better visual feedback during operations

🟡 Medium Effort Features (3-5 days each)

  • Basic A/B Testing - Compare template performance automatically
  • Email Deliverability Tools - Bounce management and list cleaning
  • Lead Enrichment APIs - Clearbit/ZoomInfo integration for contact data
  • Simple Analytics Dashboard - Web-based campaign insights
  • Webhook Framework - Real-time data sync with external systems
  • Contact Verification - Real-time email/phone validation
  • Campaign Scheduling - Schedule campaigns for optimal timing
  • Team Collaboration - Share campaigns and results with team members
  • Mobile Notifications - Push alerts for responses and meetings
  • Voice Template CLI - coldcall templates command

🔴 Advanced Features (1-2 weeks each)

  • Smart Campaign Orchestration - Automated email → voice call sequences
  • CRM Integration Hub - Salesforce/HubSpot/Pipedrive connectivity
  • AI-Powered Personalization - Company research and social media insights
  • Advanced Analytics - Conversion funnels and ROI tracking
  • Visual Campaign Builder - Drag-and-drop workflow interface
  • Database Integration - PostgreSQL/MongoDB for large-scale management
  • Queue System - Redis/Bull for processing large campaigns
  • Multi-language Support - International campaign capabilities
  • Voice Cloning - Custom AI voices for different campaigns
  • Real-time Conversation AI - Dynamic responses during calls

🟣 Enterprise Features (3-4 weeks each)

  • Microservices Architecture - Separate services for email, voice, analytics
  • Advanced Compliance Suite - GDPR/CCPA compliance and audit trails
  • AI Sales Assistant - Conversation intelligence and next best actions
  • Mobile App Development - iOS/Android app for campaign monitoring
  • API Marketplace - Third-party integrations and plugins
  • Predictive Analytics - ML models for lead scoring and optimization
  • Enterprise Security - SSO, role-based access, encryption
  • White-label Solution - Customizable branding and deployment
  • Advanced Voice AI - Call recording, transcription, sentiment analysis
  • Global Infrastructure - Multi-region deployment and scaling

Implementation Priority Matrix

Phase 11A: Immediate Wins (Week 1-2)

  1. Email Tracking Pixels - High impact, low effort
  2. Enhanced CLI Interactive Mode - Great UX improvement
  3. Template Versioning - Important for template management
  4. Export Functionality - Frequently requested feature

Phase 11B: Core Improvements (Week 3-4)

  1. Basic A/B Testing - Critical for optimization
  2. Lead Enrichment APIs - High value for users
  3. Simple Analytics Dashboard - Visual insights
  4. Campaign Scheduling - Workflow improvement

Phase 11C: Advanced Capabilities (Month 2)

  1. Smart Campaign Orchestration - Game-changing feature
  2. CRM Integration - Enterprise requirement
  3. AI-Powered Personalization - Competitive advantage
  4. Database Integration - Scalability foundation

Phase 11D: Enterprise Features (Month 3+)

  1. Visual Campaign Builder - Professional interface
  2. Mobile App - Modern user experience
  3. Advanced Analytics - Business intelligence
  4. Microservices Architecture - Enterprise scalability

Next Steps (Future Enhancements)

Advanced Voice AI Features

  • A/B testing for voice scripts
  • Advanced call analytics and reporting
  • CRM integrations for call logging
  • Multi-language voice support

Email & Voice Integration

  • Unified campaigns (email + voice follow-up)
  • Cross-channel analytics and reporting
  • Automated sequence management

Performance & Scaling

  • Database integration for lead management
  • Queue system for large voice campaigns
  • Distributed processing support
  • Advanced rate limiting strategies

Project Status: ✅ COMPLETE - PRODUCTION READY

✅ Phase 1-10 COMPLETE

  1. CSV Processing - Robust parsing with validation
  2. Email Campaigns - Mailgun integration with batching
  3. AI Personalization - OpenAI-powered template customization
  4. CLI Interface - Full-featured command-line tool
  5. NPM Module - Programmatic API for Node.js projects
  6. Voice AI Integration - Bland.ai cold-calling with IVR system
  7. Testing - Comprehensive test coverage
  8. Documentation - Complete usage guide and API docs
  9. Voice Template System - Professional voice call script templates
  10. CSV Status Tracking - Email and voice campaign response tracking

🎉 NEW: Voice AI Template System

  • 10 Professional Templates - Diverse voice call scripts with different approaches
  • Template Categories - Organized by opener, solution, social-proof, curiosity, etc.
  • Tone Classification - Professional, conversational, direct, urgent, and more
  • Dynamic Personalization - Contact and company-specific script generation
  • Template Management - Easy selection, randomization, and customization
  • Backward Compatible - Seamless integration with existing voice calling system

🎉 Voice AI Cold-Calling Features

  • Automated Cold Calling - Bland.ai integration with template-powered voice scripts
  • IVR System - Press 1 for interest (SMS + Calendly), Press 2 to opt-out
  • Webhook Callbacks - Real-time call outcome processing
  • Compliance Features - Call hours, do-not-call lists, AI identification
  • Campaign Management - Batch processing with status tracking and reporting
  • Script Variety - Multiple template approaches for different scenarios

📞 CLI Commands Available

  • lead-generator send <csv-file> - Email campaigns
  • lead-generator coldcall run <csv-file> - Voice calling campaigns
  • lead-generator coldcall status - Campaign status monitoring
  • lead-generator coldcall report - Detailed outcome reports
  • lead-generator templates - List email templates
  • lead-generator validate <csv-file> - CSV validation
  • lead-generator setup - Interactive configuration setup

Phase 12: Configuration Management System ✅ COMPLETE

Interactive Setup Command ✅

  • Interactive setup command - Add lead-generator setup command that prompts for API keys and configuration
  • Configuration storage - Store configuration in ~/.config/lead-generator/config.json following standard patterns
  • Configuration validation - Validate required fields and email formats
  • Configuration merging - Merge user config with defaults for complete configuration
  • Force overwrite option - --force flag to overwrite existing configuration
  • Custom config path - --config-path option for custom configuration location

Configuration Manager Features ✅

  • Default configuration structure - Complete config template with all sections
  • Configuration validation - Email format validation and required field checking
  • Safe configuration loading - Graceful handling of missing or corrupted config files
  • Configuration merging - Deep merge of user config with defaults
  • Path management - Standard config path generation and directory creation
  • Error handling - Comprehensive error handling for file operations

CLI Integration ✅

  • Setup command integration - Added setup command to main CLI interface
  • Existing config detection - Warn users about existing configuration
  • Interactive prompts - User-friendly prompts for all configuration options
  • Configuration summary - Display masked configuration summary before saving
  • Confirmation workflow - User confirmation before saving configuration

Configuration Sections ✅

  • Email configuration - Mailgun API key, domain, from/reply-to addresses, batch settings
  • AI configuration - OpenAI API key, model selection, token limits
  • Voice configuration - Bland.ai API key, phone number, batch settings
  • Webhook configuration - Enable/disable webhooks, port configuration
  • General settings - Retry attempts, timeouts, logging levels

Testing Coverage ✅

  • Configuration manager tests - Complete test suite for all config operations
  • CLI setup tests - Integration tests for setup command functionality
  • Validation tests - Tests for configuration validation logic
  • Error handling tests - Tests for graceful error handling
  • File operation tests - Tests for config file creation and loading

Ready for production use with full email, voice AI, and configuration management capabilities! 🚀📧📞⚙️