﻿# IMPLEMENTATION PLAN: Lead Capture to Slack
Date: 2025-09-11
Feature: Lead_Capture
Type: NEW FEATURE (No Bug Fix)

## OBJECTIVE
Implement pre-launch lead capture that sends directly to Slack (NO DATABASE)

## IMPLEMENTATION SEQUENCE

### PHASE 1: Dependencies (2 minutes)
1. Add Flask-WTF==1.2.1 to requirements.txt
2. Add WTForms==3.1.1 to requirements.txt
3. Run: pip install Flask-WTF WTForms

### PHASE 2: Create Form Handler (5 minutes)
1. Create app/forms.py with:
   - LeadCaptureForm class
   - Email field with validation
   - Three business questions
   - Beta tester checkbox
   - CSRF token handling

### PHASE 3: Create Slack Integration (5 minutes)
1. Create app/utils/slack.py with:
   - send_lead_to_slack() function
   - Webhook POST using requests
   - Rich Slack message formatting
   - Error handling with fallback logging

### PHASE 4: Add Capture Route (5 minutes)
1. Update app/routes.py:
   - Import form and slack function
   - Add /api/capture-lead POST route
   - Manual CSRF handling if needed
   - Return JSON response

### PHASE 5: Update Landing Page (10 minutes)
1. Insert form section at line 372 (before footer)
2. Add styled form matching existing design
3. Add JavaScript for AJAX submission
4. Add success/error message display

### PHASE 6: Environment Configuration (2 minutes)
1. Add SLACK_WEBHOOK_URL to .env
2. Test webhook URL validity

### PHASE 7: Testing (5 minutes)
1. Test form submission locally
2. Verify Slack message received
3. Test error scenarios
4. Test form validation

## EXACT INSERTION POINTS
- **index.html**: Insert at line 372 (before footer)
- **routes.py**: Add route after line 93 (after search route)
- **requirements.txt**: Append at end

## SUCCESS CRITERIA
1. Form displays on landing page
2. Form validates email and required fields
3. Submission sends to Slack
4. No database tables created
5. JSON response returned
6. No breaking changes to existing features

## ROLLBACK PLAN
If issues occur:
1. Remove route from routes.py
2. Remove form section from index.html
3. Delete forms.py and utils/slack.py
4. Uninstall Flask-WTF and WTForms
