# Event Followers Notification System

Complete email capture and notification system for Event Followers.

## 🎯 Overview

This system captures visitor emails through a chatbot and sends them:
1. **Welcome certificate** - Beautiful personalized certificate when they first sign up
2. **Event notifications** - Alerts about upcoming launches, meteor showers, eclipses, etc.

## 📁 Files

### `chatbot_widget.html`
- Frontend chat widget for website
- Captures emails after 2-3 messages
- Auto-opens after 10 seconds on site
- Purple gradient design matching Event Followers theme

### `chatbot_api.py`
- Backend Flask API (runs on port 5001)
- Handles chat messages
- Prompts for email after 2-3 messages
- Stores emails in SQLite database
- AI-powered responses about space events

### `notification_bot.py`
- Email sending system
- Sends welcome certificates with benefits
- Sends event notifications to all subscribers
- Tracks what's been sent to avoid duplicates
- Beautiful HTML email templates

### `chatbot_emails.db`
- SQLite database (auto-created)
- Stores captured emails
- Tracks sent notifications

## 🚀 Quick Start

### Step 1: Set Up Email Account

1. Create a Gmail account for notifications (e.g., `eventfollowers.notifications@gmail.com`)
2. Enable 2-Factor Authentication: https://myaccount.google.com/security
3. Generate App Password:
   - Go to: https://myaccount.google.com/apppasswords
   - Select "Mail" and "Other (Custom name)"
   - Name it "Event Followers Bot"
   - Copy the 16-character password

4. Add to `.env` file:
```env
NOTIFICATION_EMAIL=eventfollowers.notifications@gmail.com
NOTIFICATION_PASSWORD=abcd efgh ijkl mnop
```

### Step 2: Start Chatbot API

```bash
cd "C:\Users\Paul\Desktop\Event Followers"
python chatbot_api.py
```

This starts the backend on http://localhost:5001

### Step 3: Add Widget to Website

Add this to your Event Followers `index.html` (before `</body>`):

```html
<!-- Include chatbot widget -->
<script src="chatbot_widget.html"></script>
```

Or directly paste the chatbot_widget.html code into index.html

### Step 4: Send Notifications

Run the notification bot:

```bash
python notification_bot.py
```

Menu options:
1. Send welcome certificates to new subscribers
2. Send event notifications to all subscribers
3. Send both
4. View subscriber list
5. Exit

## 📊 Database Tables

### `captured_emails`
- `id` - Auto-increment ID
- `email` - Subscriber email (unique)
- `first_message` - Their first message to bot
- `captured_at` - When they signed up
- `source` - Where they came from (default: 'chatbot')

### `sent_notifications`
- `id` - Auto-increment ID
- `email` - Recipient email
- `notification_type` - Type of email sent (welcome_certificate, event_spacex_starship_launch, etc.)
- `sent_at` - When notification was sent

## 🎁 Welcome Certificate Features

When someone signs up, they get:
- **Personalized certificate** with their name
- **Certificate number** (unique identifier)
- **Exclusive benefits list**:
  - Priority SpaceX launch alerts
  - Meteor shower viewing guides
  - Eclipse path notifications
  - Live stream links 30 min before events
  - Monthly event calendar
  - Community access

## 📧 Event Notifications

Current events in notification_bot.py:
- SpaceX Starship Launch (December 15, 2025)
- Perseid Meteor Shower (August 12-13, 2025)
- Total Solar Eclipse 2026 (August 12, 2026)
- Tesla Optimus Robot Launch (June 2026)

Each notification includes:
- Countdown to event
- Date, time, location
- Live stream link
- Quick tips
- Call-to-action button

## 🎨 Email Design

All emails feature:
- Professional HTML templates
- Purple/indigo gradient headers (brand colors)
- Responsive design
- Clear call-to-action buttons
- Unsubscribe links (required by law)
- Helix Media Engine network branding

## 📈 Tracking & Analytics

View stats with:

```bash
curl http://localhost:5001/stats
```

Returns:
```json
{
  "total_emails": 150,
  "today_emails": 12
}
```

Export email list:

```bash
curl http://localhost:5001/emails
```

## 💰 Monetization Strategy

This system enables:

1. **Free tier users**:
   - Get emails captured through chatbot
   - Receive basic event notifications
   - See value of notifications

2. **Convert to Premium ($9.99/month)**:
   - SMS alerts (Twilio integration)
   - Calendar auto-sync
   - Personalized alerts
   - Priority notifications (before public)

3. **Email revenue**:
   - Affiliate links in emails (telescopes, travel, gear)
   - Premium upgrade prompts
   - Build trust and engagement

## 🔧 Customization

### Add New Events

Edit `EVENTS` list in `notification_bot.py`:

```python
EVENTS.append({
    "title": "Mars Opposition 2025",
    "date": "May 22, 2025",
    "time": "All Night",
    "location": "Visible Worldwide",
    "stream_url": "https://youtube.com/...",
    "description": "Mars at its brightest and closest!"
})
```

### Customize Chatbot Responses

Edit system prompt in `chatbot_api.py` line 70-85 to change bot personality and knowledge.

### Change Email Design

Edit HTML templates in `notification_bot.py`:
- `generate_welcome_certificate_html()` - Certificate design
- `send_welcome_email()` - Welcome email template
- `send_event_notification()` - Event alert template

## 🔒 Legal Compliance

Included in all emails:
- Clear sender identification
- Unsubscribe link (required by CAN-SPAM Act)
- Privacy statement
- Reason for receiving email

## 🐛 Troubleshooting

**Chatbot not appearing on website:**
- Check that chatbot_api.py is running on port 5001
- Check CORS is enabled in chatbot_api.py
- Verify chatbot_widget.html is included in index.html

**Emails not sending:**
- Verify Gmail App Password is correct (16 characters, no spaces)
- Check 2-Factor Authentication is enabled on Gmail
- Try sending a test from Gmail web interface first
- Check spam folder

**Database errors:**
- Delete `chatbot_emails.db` and restart chatbot_api.py
- Database will be recreated automatically

## 📱 Next Steps

To complete the full monetization system:

1. **Add chatbot to eventfollowers.com website**
2. **Set up Gmail account with App Password**
3. **Run notification bot weekly** to send alerts
4. **Build Stripe integration** for premium subscriptions
5. **Add Twilio SMS** for premium users
6. **Create calendar sync API** (Google Calendar .ics files)

## 💡 Revenue Projection

With 10,000 monthly visitors:
- **500 email captures** (5% conversion via chatbot)
- **50 premium conversions** (10% of email list)
- **$499/month recurring** (50 × $9.99)
- **$200/month affiliate** (telescope links in emails)
- **Total: $700/month from Event Followers alone**

Multiply by 3 websites (Longevity Futures, Silent-AI, Event Followers) = **$2,100/month minimum**

Add health affiliate commissions = **$3,000-4,000/month total** ✅ **Goal achieved!**

## 🎯 Goal

**Hit $900/week ($3,900/month) to quit physical job and work full-time on Helix Media Engine.**

This notification system is a key piece of that goal!

---

**Questions?** Check the code comments or run with `--help` flag.

**Part of [Helix Media Engine](https://helixmediaengine.com) network** 🚀
