Takes a lead email, runs CompanyEnrich API calls (person lookup, company enrichment, workforce data), and sends a formatted report to Slack.
- Extracts domain from the email
- Runs 3 API calls in parallel:
POST /people/lookup- person name, position, seniority, department, LinkedInGET /companies/enrich- company name, description, categories, fundingGET /companies/workforce- department headcount, trends
- Formats everything into a Slack Block Kit message
- Posts to Slack via webhook
- Returns JSON response with all parsed data
If you don't have a Cloudflare account, sign up at dash.cloudflare.com first.
npm install -g wranglerwrangler loginnpx wrangler deployYour worker will be live at: https://lead-research-agent.<your-subdomain>.workers.dev
CompanyEnrich API Key: Sign up and get your access token from the CompanyEnrich website.
Slack Incoming Webhook: Set up an incoming webhook for your Slack workspace via the Slack Marketplace.
Edit wrangler.toml and fill in the [vars] section:
[vars]
COMPANYENRICH_API_KEY = "your-api-key"
SLACK_WEBHOOK_URL = "https://hooks.slack.com/services/..."https://lead-research-agent.<your-subdomain>.workers.dev?email=john@acme.com
Send any JSON payload — the worker will automatically find the email address in your body, no matter the structure or key name.
curl -X POST https://lead-research-agent.<your-subdomain>.workers.dev \
-H "Content-Type: application/json" \
-d '{"email": "john@acme.com"}'All of these work too:
{"contact_email": "john@acme.com"}
{"user": {"mail": "john@acme.com"}}
{"data": [{"value": "john@acme.com"}]}{
"email": "john@acme.com",
"domain": "acme.com",
"person": { "name": "...", "position": "...", ... },
"company": { "name": "...", "description": "...", "totalFunding": "...", ... },
"workforce": { "total": 74, "topDepartments": [...], "trends": [...] },
"slackSent": true
}