Project Story
The Problem That Started It All
My brother was working with a startup and they were struggling in getting leads. Like many early-stage companies, they had a great product but couldn't afford expensive sales teams or complex CRM systems. They were manually handling customer inquiries through basic contact forms and losing potential clients because of slow response times and inconsistent follow-ups.
Watching them struggle with this fundamental business challenge made me realize that many startups face the same problem: how do you scale personal, effective sales conversations without scaling your team?
The Inspiration
The idea hit me during a late-night conversation with my brother about their latest missed opportunity. A potential enterprise client had reached out through their website, but by the time someone from their small team responded two days later, the prospect had already moved on to a competitor.
I thought: What if we could create an AI agent that could have meaningful sales conversations, qualify leads in real-time, and automatically follow up with personalized emails? Not just a chatbot that gives canned responses, but a sophisticated system that could actually understand business needs and identify qualified prospects.
What I Built
I developed an AI-powered lead generation and qualification system that transforms website conversations into a complete sales pipeline.
Core Features
- Intelligent Conversation Handling: AI agent trained as "Sarah Mitchell," a senior business development manager specializing in strategic consulting
- Real-time Lead Scoring: Advanced algorithm that scores prospects 0–100 based on consulting-specific criteria (job title, company size, budget indicators, timeline, pain points)
- Automatic Email Follow-ups: Personalized emails sent instantly to qualified leads with relevant case studies and meeting scheduling
- Meeting Coordination: Automatic calendar integration and meeting invitation generation
- Lead Management Dashboard: Complete analytics showing conversion rates, lead scores, and conversation history
Technical Architecture
- Frontend: React + TypeScript with Tailwind CSS for a modern, responsive interface
- State Management: Zustand for efficient client-side state handling
- Backend: Supabase with PostgreSQL for data persistence and authentication
- AI Integration: Google Gemini API for natural language processing and lead analysis
- Email Automation: SendGrid integration for reliable email delivery
- Real-time Updates: Live conversation syncing and lead status tracking
The Development Journey
Phase 1: MVP Development
I started by building a basic chat interface and quickly realized that managing conversation state across browser tabs was more complex than expected. Users would type messages, switch tabs, come back, and find their text had disappeared — a frustrating UX issue that took significant debugging to resolve.
Phase 2: AI Integration
Integrating the Gemini API was both exciting and challenging. I had to:
- Design prompts that could extract meaningful business data from casual conversations
- Create a scoring algorithm that could identify high-quality leads
- Handle edge cases like conversation endings and unclear responses
- Ensure the AI maintained a consistent, professional persona
Phase 3: Email Automation
The email system proved trickier than anticipated. Initial emails were going to spam folders, which led me to implement:
- Proper HTML escaping to prevent security vulnerabilities
- Plain text alternatives for better deliverability
- Domain authentication recommendations
- Enhanced error handling with specific SendGrid API responses
Phase 4: Production Polish
The final phase involved removing debugging code, optimizing performance, and ensuring the system could handle real-world usage patterns.
Challenges Faced
1. Browser State Management
The most persistent bug was input text disappearing when users switched browser tabs. This required implementing multiple layers of state synchronization:
- React state tracking
- DOM element references
- Browser visibility event listeners
- Backup interval checking
2. AI Prompt Engineering
Getting the AI to consistently extract the right information from conversations took dozens of iterations. I had to balance:
- Natural conversation flow vs. data extraction needs
- Professional tone vs. approachable personality
- Comprehensive analysis vs. response speed
3. Email Deliverability
Initial emails were flagged as spam due to:
- Missing plain text alternatives
- Unescaped HTML content creating security flags
- Generic sender addresses
- Lack of proper email authentication
4. Real-time Conversation Sync
Ensuring that conversations updated properly across the interface while maintaining performance was complex, especially with the Zustand state management and Supabase real-time subscriptions.
What I Learned
Technical Skills
- Advanced React Patterns: State synchronization, event handling, and performance optimization
- AI Integration: Prompt engineering, response parsing, and handling API limitations
- Email Systems: Deliverability best practices, HTML/text formatting, and security considerations
- Real-time Applications: WebSocket management, state synchronization, and optimistic updates
Product Development
- User Experience: The importance of handling edge cases like tab switching and network failures
- Sales Process Understanding: Learning how lead qualification actually works in B2B environments
- System Integration: Coordinating multiple APIs (AI, email, database) for seamless user experience
Problem-Solving Approach
- Debugging Methodology: Using extensive logging and systematic testing to isolate complex issues
- Security-First Thinking: Implementing proper input validation and HTML escaping from the start
- Scalable Architecture: Designing systems that can handle growth in conversations and users
The Impact
The system successfully addresses the core problem my brother's startup faced:
- Instant Response: Prospects get immediate, intelligent responses 24/7
- Qualified Leads: Automatic scoring identifies the most promising opportunities
- Automated Follow-up: No more missed opportunities due to delayed responses
- Scalable Sales: One system can handle unlimited concurrent conversations
What's Next
I'm planning to add:
- Multi-language Support: Expanding beyond English for global markets
- Industry-Specific Agents: Customized conversation flows for different sectors
- Advanced Analytics: Deeper insights into conversation patterns and conversion optimization
- CRM Integration: Direct connections to Salesforce, HubSpot, and other platforms
This project taught me that the best solutions often come from observing real problems faced by real people. Sometimes the most impactful projects start with a simple question:
"How can we make this better?"
Built With
- google-gemini-api
- react-+-typescript
- sendgrid
- supabase-+-postgresql
- tailwind-css
- zustand
Log in or sign up for Devpost to join the conversation.