File size: 3,066 Bytes
bd28470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Setup Guide

Complete step-by-step guide to get the system running.

## Prerequisites

- **Node.js** 18+ (recommended: 20 LTS)
- **Python** 3.11+
- **npm** 9+
- **Git**

## Step 1: API Keys

Create accounts and get keys from these services (all FREE):

### 1.1 NVIDIA NIM (LLM β€” MiniMax + LLaMA)
1. Go to https://build.nvidia.com
2. Sign up / login
3. Click any model β†’ "Get API Key"
4. Copy key (starts with `nvapi-`)
5. Free: 1000+ requests/day

### 1.2 Serper.dev (Google Search)
1. Go to https://serper.dev
2. Sign up with Google
3. Dashboard β†’ copy API key
4. Free: 2,500 searches/month

### 1.3 Hunter.io (Email Finding)
1. Go to https://hunter.io
2. Sign up β†’ Dashboard β†’ API
3. Copy API key
4. Free: 25 searches/month

### 1.4 Reoon (Email Verification)
1. Go to https://emailverifier.reoon.com
2. Sign up β†’ Dashboard β†’ API
3. Copy API key
4. Free: 20 verifications/day
5. NOTE: System optimizes usage (SMTP probe first, Reoon fallback)

### 1.5 Supabase (Database)
1. Go to https://supabase.com
2. Create project
3. Project Settings β†’ API
4. Copy **Project URL** and **service_role key** (not anon key!)
5. Free: 500MB database

### 1.6 Slack Bot
1. Go to https://api.slack.com/apps β†’ Create New App
2. Name: "Lead Finder"
3. OAuth & Permissions β†’ Add scopes: `chat:write`, `commands`, `channels:read`
4. Install to Workspace β†’ copy Bot Token (`xoxb-...`)
5. Basic Information β†’ copy Signing Secret
6. Create 2 channels: `#leads` and `#review`
7. Get channel IDs: right-click channel β†’ View details β†’ copy ID

### 1.7 Trigger.dev (Job Orchestration)
1. Go to https://trigger.dev β†’ Sign up
2. Create project
3. Dashboard β†’ API Keys β†’ copy
4. Project ID from URL: `trigger.dev/orgs/.../projects/[PROJECT_ID]`
5. Free: 50,000 runs/month

## Step 2: Environment Setup

```bash
cp .env.example .env
```

Edit `.env` and fill in all keys from Step 1.

## Step 3: Database Migration

Option A β€” Supabase Dashboard:
1. Open Supabase β†’ SQL Editor
2. Paste contents of `supabase/migrations/001_initial_schema.sql` β†’ Run
3. Paste contents of `supabase/migrations/002_phase1_enhancements.sql` β†’ Run

Option B β€” Supabase CLI:
```bash
npx supabase migration up
```

## Step 4: Install & Run

```bash
# Install Node.js dependencies
npm install

# Install Python dependencies
cd src/profiling/python-service
pip install -r requirements.txt
cd ../../..

# Terminal 1: Start Trigger.dev
npm run trigger:dev

# Terminal 2: Start Python AI service
cd src/profiling/python-service
python main.py
```

## Step 5: Verify

The system runs automatically at 9 AM PKT daily. To test manually:
- Use Slack `/discover` command
- Or trigger from Trigger.dev dashboard

## Troubleshooting

| Issue | Solution |
|-------|---------|
| `NVIDIA_API_KEY` error | Check key starts with `nvapi-` |
| MiniMax 429 rate limit | System auto-retries after wait |
| Hunter returns empty | Free tier: 25/month limit reached |
| SMTP verification fails | Some mail servers block port 25 |
| Supabase connection error | Check `SUPABASE_URL` has `https://` |