# PHT 24/7 Outreach Bot - Architecture

```
┌─────────────────────────────────────────────────────────────────┐
│                     DATA SOURCES (Stage 1: FIND)                │
└─────────────────────────────────────────────────────────────────┘
                                   │
                    ┌──────────────┼──────────────┐
                    │              │              │
              ┌─────▼─────┐  ┌────▼────┐  ┌─────▼──────┐
              │  Apify    │  │ Apollo  │  │ Web Scrape │
              │ Google    │  │ Search  │  │ Industry   │
              │ Maps      │  │ (Org)   │  │ Lists      │
              └─────┬─────┘  └────┬────┘  └─────┬──────┘
                    │              │              │
                    └──────────────┼──────────────┘
                                   │
                         Companies with:
                         - 10+ cold rooms
                         - Apples/citrus
                         - Location verified
                                   │
┌─────────────────────────────────▼─────────────────────────────┐
│              ENRICHMENT LAYER (Stage 2: VERIFY)               │
└───────────────────────────────────────────────────────────────┘
                                   │
                    ┌──────────────┼──────────────┐
                    │              │              │
              ┌─────▼─────┐  ┌────▼────┐  ┌─────▼──────┐
              │  Apollo   │  │  Clay   │  │ AnyMail    │
              │  People   │  │ Enrich  │  │ Finder     │
              │  Search   │  │         │  │            │
              └─────┬─────┘  └────┬────┘  └─────┬──────┘
                    │              │              │
                    └──────────────┼──────────────┘
                                   │
                         Contact Records:
                         - Name, title, email
                         - LinkedIn profile
                         - Company website
                         - Verified deliverability
                                   │
┌─────────────────────────────────▼─────────────────────────────┐
│           PERSONALIZATION ENGINE (Stage 2.5: AI)              │
└───────────────────────────────────────────────────────────────┘
                                   │
                         ┌─────────▼─────────┐
                         │   Claude API      │
                         │   Analyzes:       │
                         │   - Website copy  │
                         │   - LinkedIn bio  │
                         │   - Industry pain │
                         │   Generates:      │
                         │   - Custom intro  │
                         │   - Relevant hook │
                         │   - CTA (video)   │
                         └─────────┬─────────┘
                                   │
                         Personalized Email:
                         - Subject line (A/B)
                         - 3-4 sentence body
                         - Video offer CTA
                                   │
┌─────────────────────────────────▼─────────────────────────────┐
│              OUTREACH LAYER (Stage 3: SEND)                   │
└───────────────────────────────────────────────────────────────┘
                                   │
                         ┌─────────▼─────────┐
                         │  Instantly.ai     │
                         │  Queue Manager    │
                         │                   │
                         │  Daily Limit:     │
                         │  10 emails/day    │
                         │  (2 per account)  │
                         └─────────┬─────────┘
                                   │
                    ┌──────────────┼──────────────┐
                    │              │              │
         ┌──────────▼─┐    ┌──────▼─┐    ┌──────▼──────┐
         │ Account 1  │    │ Acct 2 │... │ Account 5   │
         │ 2 sends/day│    │        │    │             │
         └──────────┬─┘    └──────┬─┘    └──────┬──────┘
                    │              │              │
                    └──────────────┼──────────────┘
                                   │
                              Sent Emails
                                   │
┌─────────────────────────────────▼─────────────────────────────┐
│           MONITORING LAYER (Stage 4: TRACK)                   │
└───────────────────────────────────────────────────────────────┘
                                   │
                    ┌──────────────┼──────────────┐
                    │              │              │
              ┌─────▼─────┐  ┌────▼────┐  ┌─────▼──────┐
              │ Instantly │  │  Gmail  │  │  Telegram  │
              │ Webhooks  │  │ Webhook │  │   Alert    │
              │           │  │         │  │            │
              └─────┬─────┘  └────┬────┘  └─────┬──────┘
                    │              │              │
                    └──────────────┼──────────────┘
                                   │
                         ┌─────────▼─────────┐
                         │   n8n Handler     │
                         │   Detects:        │
                         │   - Opens         │
                         │   - Replies       │
                         │   - Bounces       │
                         │   Actions:        │
                         │   - Flag Jonny    │
                         │   - Update CRM    │
                         │   - Trigger video │
                         └───────────────────┘
```

---

## Orchestration Hub: n8n Workflow

```
┌────────────────────────────────────────────────────────┐
│                   n8n CRON (Daily 6AM)                 │
└────────────────────────────────────────────────────────┘
                            │
        ┌───────────────────┼───────────────────┐
        │                   │                   │
   ┌────▼────┐         ┌───▼────┐         ┌───▼────┐
   │ Scrape  │         │ Enrich │         │ Send   │
   │ 50 new  │────────▶│ Top 10 │────────▶│ Queue  │
   │ targets │         │ best   │         │ to     │
   │         │         │ fits   │         │Instantly│
   └─────────┘         └────────┘         └───┬────┘
                                              │
                                     Updates sent log
                                              │
                                    ┌─────────▼────────┐
                                    │  Google Sheet    │
                                    │  Master Tracker  │
                                    │  - Status        │
                                    │  - Sent date     │
                                    │  - Reply?        │
                                    └──────────────────┘
```

---

## Data Flow Example

**Input:** "Cold storage apples New Zealand"
**↓**
**Apify finds:** Turners & Growers (50 rooms, NZ)
**↓**
**Apollo enriches:** John Smith, Quality Manager, john@turners.co.nz
**↓**
**Claude analyzes:** Website mentions "export quality control" → pain = consistency
**↓**
**Email generated:**
```
Subject: Quick question about export quality control

Hi John,

Saw Turners & Growers exports to 60+ countries — maintaining 
consistent quality across that many rooms must be a challenge.

We help packhouses like Stemilt and Zespri catch ripening 
issues before they become export rejections.

I recorded a 2-minute video showing how it works. Want me 
to send it over?

Jonny
PostHarvest Technologies
```
**↓**
**Instantly sends:** 10am Tuesday from Account 3
**↓**
**John replies:** "Yes, send video"
**↓**
**Telegram pings Jonny:** 🔔 REPLY from Turners & Growers - wants video
