An AI-powered sales prospecting bot that automatically identifies and researches potential leads based on your ideal customer profile. This system combines advanced AI capabilities with robust automation to create a powerful lead generation and research tool.
-
Lead Discovery Engine
- Automated keyword-based lead search using configurable criteria
- Smart filtering based on company relevance and potential fit
- Rate-limited API calls to prevent throttling
- Asynchronous processing for improved performance
-
AI Research Module
- Integration with Groq's LLM API for advanced analysis
- Intelligent HTML parsing and content extraction
- Contextual understanding of company profiles
- Automated relevance scoring system
-
Data Management
- SQLAlchemy ORM for robust database operations
- Automated schema management and migrations
- Efficient data caching and retrieval
- Transaction management for data integrity
-
Notification System
- Real-time email notifications via Resend
- Customizable notification templates
- Delivery status tracking
- Error handling and retry mechanisms
-
Scheduling System
- APScheduler-based job management
- Configurable execution intervals
- Job persistence across restarts
- Error recovery mechanisms
- Automated lead discovery using customizable search criteria
- AI-powered research and analysis of each lead's company
- Relevance scoring to prioritize the most promising leads
- Email notifications for new lead discoveries
- Persistent storage of all lead data and research insights
- Rate limiting and throttling protection
- Robust error handling and recovery
- Configurable scheduling system
- Transaction-safe database operations
- Comprehensive logging system
-
Clone repository:
git clone https://github.com/yourusername/prospecting-bot.git cd prospecting-bot
-
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a .env file with the following variables:
GROQ_API_KEY=<your_groq_api_key> DATABASE_URL=<your_database_url> RESEND_API_KEY=<your_resend_api_key>
-
Run the bot:
python main.py
The application can be run in containers for both development and production:
# Build and start the container
docker-compose up --build
# View logs
docker-compose logs -f
# Stop the container
docker-compose down
For production deployment, we maintain compatibility with the existing configuration while providing containerization:
-
Build the container:
docker build -t prospecting-bot .
-
Run with production settings:
docker run -d \ --name prospecting-bot \ -v app_data:/app/data \ --env-file .env \ prospecting-bot
GROQ_API_KEY
: API key for Groq LLM services (get from console.groq.com)DATABASE_URL
: Connection string for your database (default: sqlite:///./app.db)RESEND_API_KEY
: API key for email notifications via Resend
The application uses a robust configuration system with the following key settings:
-
Database Settings
- Configurable database URL with SQLite default
- Connection pooling and timeout settings
- Transaction isolation levels
-
Lead Search Settings
- Minimum relevance score threshold (default: 30)
- Maximum leads per run (default: 10)
- Customizable search criteria
-
Scheduler Settings
- Configurable search interval (default: 24 hours)
- Job persistence options
- Error handling configuration
-
Email Settings
- SMTP server configuration
- Authentication settings
- Template customization
The system uses SQLAlchemy models for robust data management:
- User Model: Stores user and company information
- Lead Model: Manages prospective lead data
- Research Model: Stores AI-generated research insights
- Email Model: Tracks notification history
The system implements comprehensive error handling:
-
API Rate Limiting
- Automatic backoff on API limits
- Request queuing and retry logic
- Circuit breaker pattern for external services
-
Database Operations
- Transaction rollback on errors
- Connection pool management
- Deadlock detection and retry
-
Job Processing
- Failed job tracking
- Automatic retry with exponential backoff
- Error notification system
The system includes detailed logging for operational visibility:
- Request/response logging for external APIs
- Database operation tracking
- Job execution status
- Error and exception details
- Performance metrics
- Environment-based configuration
- Secure credential management
- Rate limiting protection
- SQL injection prevention
- Input validation and sanitization
-
Running in Production
- Use appropriate environment variables
- Configure proper logging
- Set up monitoring
- Use a process manager
- Implement backup strategy
-
Maintenance
- Regular database cleanup
- Log rotation
- Performance monitoring
- Security updates
-
Scaling
- Configure appropriate job intervals
- Monitor resource usage
- Adjust batch sizes as needed
- Optimize database queries
Common issues and solutions:
-
Database Connectivity
- Check DATABASE_URL setting
- Verify permissions
- Check disk space
-
API Rate Limits
- Adjust batch sizes
- Configure appropriate intervals
- Check API quotas
-
Email Delivery
- Verify SMTP settings
- Check API keys
- Monitor spam filters
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.