# AIGHT RE - Lead Generation Pipeline PRD

## Overview
Automated lead generation and cold outreach pipeline targeting Real Estate professionals in Germany (starting with Leipzig). Off-market deal flow acquisition for RE developer and broker partnerships.

## Team
- **Hafiz** - Outreach, manual reply handling
- **Vansh** - Email finder evaluation
- **Robert** - Decision maker for tooling

---

## Architecture

```
ImmoScout24 Emails (Gmail alerts)
  ├── WF-1: Scrape companies from emails + expose pages
  │     ├── LLM extract from email text (when Anbieter visible)
  │     └── Crawl expose pages (always gets Anbieter)
  │         ├── SearXNG → find company website
  │         ├── Crawl4AI → scrape /impressum for email + phone
  │         ├── Hunter.io (fallback if no email on website)
  │         ├── LLM → classify Developer vs Broker
  │         ├── NocoDB (master leads table)
  │         └── Pipedrive (CRM: Org + Person + Deal)
  │
  ├── WF-3: Developer outreach (daily, max 30/day)
  ├── WF-4: Broker outreach (daily, max 30/day)
  └── WF-5: Reply handling (always-on webhook)
```

**Note:** Original plan had Apify scrapers (WF-1/WF-2). Replaced with ImmoScout24 email extraction — free and more reliable. Single WF-1 catches both developers and brokers.

---

## WF-1: ImmoScout Lead Scraper (BUILT)

**Status:** Built, iterating

**Trigger:** Schedule every 4 hours

**Flow:**
1. Gmail → get ImmoScout24 saved search emails
2. **Branch A (Email):** LLM extract company names from email text → split combined entries → dedup against Pipedrive → SearXNG → Crawl4AI Impressum → Hunter fallback → Classify Developer/Broker → NocoDB + Pipedrive
3. **Branch B (Expose):** Extract listing links → Crawl each expose page → LLM extract Anbieter → Save to NocoDB (pending enrichment)

**Data sources:**
- ImmoScout24 saved search emails (Mietwohnung, Eigentumswohnung, Neubau, Gewerbe Leipzig)
- Expose page scraping for Anbieter company names

**Classification (after website crawl):**
- Developer: Projektentwicklung, Bauträger, Neubau signals
- Broker: Makler, Vermittlung, Courtage signals
- Unknown: insufficient data

---

## WF-2: Broker Scraper (SKIPPED)

Not needed. WF-1 catches both developers and brokers from ImmoScout24. Additional sources (IVD directory, Google Maps) can be added later as separate workflows if volume is insufficient.

---

## WF-3: RE Developer Email Outreach (TODO)

**Trigger:** Daily 09:00
**Batch limit:** Max 30 emails/day (SMTP warm-up)
**Source:** Pipedrive deals with Campaign_PE_Leipzig + next stage due

### Email Sequence (4 stages, 14 days):

**Stage 1 (Day 0):** Initial cold email
- Subject: "Projekte in Leipzig – kurzer Austausch?"
- Body: Are you currently looking for projects/land in Leipzig? We work with developers and have off-market opportunities.
- CTA: Cal.com booking link

**Stage 2 (Day 3):** Follow-up with value add
- Concrete market insight or deal teaser
- Reference initial email

**Stage 3 (Day 7):** Direct tone
- "Letzte Nachricht" approach
- Specific value proposition

**Stage 4 (Day 14):** Breakup email
- Respectful, leave door open
- "Falls sich Ihre Situation ändert..."

### Technical flow:
1. Pipedrive: Get deals where Campaign=Campaign_PE_Leipzig AND next stage is due
2. IF: Which stage? Has wait time expired?
3. Send email (SMTP)
4. Pipedrive: Update stage + Last_Email_Date
5. Rate limit: max 30/day

### GDPR:
- Opt-out link in every email footer
- AIGHT RE Impressum in footer
- Unsubscribe → immediately stop all emails, mark as Rejected

---

## WF-4: Broker Email Outreach (TODO)

**Trigger:** Daily 09:00 (after WF-3)
**Batch limit:** Shares 30/day limit with WF-3

### Email Sequence (4 stages, same timing as WF-3):

**Stage 1 (Day 0):**
- Subject: "Kunden suchen Projekte in Leipzig – kurzer Austausch?"
- Body: Do you have clients/investors looking for projects/land in Leipzig? We work with developers and owners, off-market deals available.
- CTA: Cal.com booking link

**Stages 2-4:** Same follow-up structure, different messaging for broker audience.

### Technical:
- Copy of WF-3 architecture
- Filter on Campaign_Broker_Leipzig instead of Campaign_PE_Leipzig

---

## WF-5: Reply Handling (TODO)

**Trigger:** Pipedrive webhook — new email activity on deal
**Runs:** Always-on

### Flow:
1. Pipedrive Trigger: New email activity on deal
2. LLM: Classify reply → positive / negative / neutral
3. **IF positive:** Auto-reply with Cal.com booking link, move to "Reply Received"
4. **IF negative / unsubscribe:** Set status "Rejected", stop all future emails
5. **IF neutral / question:** Notify Hafiz (Slack/email) for manual handling
6. Pipedrive: Update deal stage
7. Cal.com Webhook: On booking → create Pipedrive activity + calendar entry

---

## CRM Setup (Pipedrive)

### Pipelines:
- **Pipeline 1:** "Leipzig - RE Developers"
- **Pipeline 2:** "Leipzig - Brokers"

### Stages (both pipelines):
New → Stage 1 → Stage 2 → Stage 3 → Stage 4 → Reply Received → Meeting Booked → Qualified → Rejected

### Custom Fields (on Deal):
| Field | Type | Values |
|-------|------|--------|
| Type | Single option | Developer / Broker / Owner / Fund |
| Source | Single option | ImmoScout24 / ImmoScout24_Expose / IVD / Google Maps |
| Asset Class | Single option | Residential / Office / Logistics / Retail / Hotel |
| Campaign | Text | Campaign_PE_Leipzig / Campaign_Broker_Leipzig |
| Current_Stage | Single option | 1 / 2 / 3 / 4 |
| Last_Email_Date | Date | — |

---

## NocoDB Master Leads Table

Single table for all leads across all workflows. Fields:

### Scraping data:
- company_name, contact_person, type, source, region, campaign
- website, domain, email, email_secondary, phone, phone_secondary
- email_source, expose_url, extracted_at, impressum_content

### Enrichment data (future):
- linkedin_company_url, linkedin_person_url
- company_description, founding_year, employee_count, revenue_range
- hrb_number, address_full, city, postal_code
- geschaeftsfuehrer, asset_classes, portfolio_size, active_projects

### Pipeline tracking:
- enrichment_status (pending / scraped / enriched / failed)
- enrichment_date
- pipedrive_org_id, pipedrive_person_id, pipedrive_deal_id
- outreach_stage, last_email_date, reply_status, reply_date
- meeting_booked, meeting_date, notes, workflow_source

---

## SMTP Warm-up Plan

| Day | Emails/day |
|-----|-----------|
| 1-2 | 5 |
| 3-4 | 10 |
| 5-6 | 15 |
| 7-8 | 20 |
| 9-10 | 25 |
| 11+ | 30 (max) |

---

## Email Enrichment (Decided)

Using **Hunter.io** as fallback when website/Impressum doesn't have email.
- Free tier: 25 searches/month
- API integrated in n8n via Hunter node
- Credential: va@saits.ai

Future evaluation still pending for scaling:
- Apollo.io (contact data + email finder)
- Snov.io (email finder + verification)

---

## Cal.com Integration

- Booking page: 15-min slot
- AIGHT RE team availability
- Webhook on booking → Pipedrive activity + calendar entry
- Booking link included in Stage 1 emails and positive reply auto-responses

---

## Build Order

1. ~~WF-1: Lead Scraper~~ (BUILT)
2. **WF-3: Developer Outreach** ← NEXT
3. WF-4: Broker Outreach (copy of WF-3 with different filter + messaging)
4. WF-5: Reply Handling
5. Cal.com setup + webhook integration
