---
name: url-to-lead
description: Research pipeline - drop a company URL, get a fully enriched lead in Growth Engine with intel pre-loaded. Use when Michael drops a URL and wants it researched/added as a lead.
triggers:
  - "research this company"
  - "add this as a lead"
  - "look up this company"
  - dropping a company/contractor URL
---

# URL to Lead Pipeline

Drop a company URL → get a fully enriched lead in Growth Engine.

## Flow

1. **Scrape** - Fetch the URL, extract company info (name, trade, location, contact details)
2. **Search** - Brave search for additional context (reviews, news, projects)
3. **Enrich** - Apollo lookup for decision-maker contacts
4. **Create** - POST to Growth Engine /api/leads
5. **Intel** - PATCH intel with research findings
6. **Confirm** - Send summary to Michael

## Step 1: Scrape the URL

```bash
# Use web_fetch to get page content
web_fetch url="https://example-contractor.com.au" extractMode="markdown"
```

Extract:
- Company name
- Trade/services offered
- Location (suburb, city)
- Phone number
- Email
- ABN if visible

## Step 2: Brave Search

```bash
# Search for more context
web_search query="\"Company Name\" Sydney reviews OR projects OR news"
```

Look for:
- Recent projects
- Reviews/reputation
- News mentions
- Size indicators

## Step 3: Apollo Enrichment

```bash
# Find decision makers
~/clawd/scripts/apollo-enrich.sh "Company Name" "Domain"
```

Or use Apollo API directly:
```bash
curl -X POST "https://api.apollo.io/v1/mixed_companies/search" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -d '{
    "api_key": "'$APOLLO_API_KEY'",
    "q_organization_domains": "example.com.au",
    "per_page": 5
  }'
```

## Step 4: Create Lead

```bash
curl -X POST -H "X-API-Key: $CLAWDBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Contact Name",
    "last_name": "Company Name",
    "phone": "+61...",
    "email": "...",
    "source": "research_pipeline",
    "metadata": {
      "trade": "...",
      "lead_type": "contractor",
      "research_url": "https://original-url.com"
    }
  }' \
  https://rateright-growth-production.up.railway.app/api/leads
```

## Step 5: Add Intel

```bash
curl -X PATCH -H "X-API-Key: $CLAWDBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "company_research": "Summary of company...",
    "person_research": "Decision maker info...",
    "call_prep": "Key points for call...",
    "talking_points": ["Point 1", "Point 2"],
    "objections": ["Potential objection"]
  }' \
  https://rateright-growth-production.up.railway.app/api/leads/LEAD_ID/intel
```

## Step 6: Confirm

Message Michael:
```
✅ Lead created: [Company Name]
📞 [Phone]
🔧 [Trade]
📍 [Location]

Intel loaded:
- [Key finding 1]
- [Key finding 2]
- Decision maker: [Name, Role]

Ready for call list.
```

## Example Usage

Michael drops: `https://smithconcreting.com.au`

Rivet:
1. Scrapes → Smith Concreting, concrete contractor, Parramatta
2. Searches → Found 5-star Google reviews, recent $2M hospital project
3. Enriches → John Smith, Director, +61 4XX XXX XXX
4. Creates lead in Growth Engine
5. Loads intel with research
6. Confirms to Michael

## Notes

- Use Opus for scraping dirty data (prompt injection protection)
- Always verify phone numbers are Australian format (+61)
- Skip if company already exists in Growth Engine (search first)
- For worker leads vs contractor leads, adjust lead_type accordingly
