An end-to-end automated client onboarding pipeline built with n8n, JavaScript, Supabase, Google Drive, and SendGrid. The system handles webhook intake, data validation, company enrichment, legacy ERP data import, welcome document generation, structured storage, tier-based email notifications, and a live pipeline dashboard.
- Webhook Intake & Validation — Accepts new client submissions via HTTP POST, validates all required fields server-side with structured error responses
- Company Data Enrichment — Automatically enriches company profiles with industry, size, and location data via the Clearbit Autocomplete API
- Legacy ERP CSV Import — Parses ISO-8859-1 semicolon-delimited CSV exports with German headers, detects duplicates, merges secondary contacts, and imports valid records
- Welcome Document Generation — Generates a tier-specific branded HTML welcome document per client and uploads it to a dedicated Google Drive folder
- Structured Database Storage — Stores all client data in Supabase PostgreSQL with ENUMs, constraints, and aggregation views
- Tier-Based Notification Routing — Sends detailed emails for Enterprise clients, summary emails for Professional clients, and skips notifications for Basic tier
- Pipeline Status Tracking — Updates client status at each pipeline stage:
received → validated → enriched → stored → notified → completed - Live Dashboard — A webhook-served HTML dashboard showing client pipeline by tier and status with search and filtering
┌─────────────────────────────────────────────────────────────┐
│ Two Entry Points │
├────────────────────────┬────────────────────────────────────┤
│ Webhook Form │ Manual ERP Import Trigger │
│ (Live submissions) │ (Legacy CSV batch import) │
└────────────┬───────────┴──────────────┬─────────────────────┘
│ │
▼ ▼
Validate Input Fetch & Parse CSV
│ (Google Sheets export)
▼ │
Enrich via Clearbit Map ERP Records
│ │
▼ Check Duplicates /
Generate Client Ref Merge Secondary Contacts
│ │
└──────────┬───────────────┘
▼
Generate Welcome Document
│
▼
Upload to Google Drive
│
▼
Store in Supabase
│
┌─────┴──────┐
▼ ▼
Switch by Tier Basic Tier
┌──────┴──────┐ (no email)
▼ ▼ │
Enterprise Professional │
Full Email Summary Email │
│ │ │
└──────┬──────┘ │
▼ ▼
Update Final Status (notified / completed)
| Component | Technology |
|---|---|
| Workflow Automation | n8n (self-hosted) |
| Database | Supabase (PostgreSQL) |
| Document Storage | Google Drive |
| Email Delivery | SendGrid |
| Company Enrichment | Clearbit Autocomplete API |
| Frontend Dashboard | Vanilla HTML/JS served via n8n webhook |
- n8n instance (local or cloud)
- Supabase project
- Google Drive OAuth credentials configured in n8n
- SendGrid account with verified sender
- Import workflows — Import both JSON files from
/workflowsinto your n8n instance - Create credentials in n8n:
Supabase Service Role→ HTTP Header Auth (apikey+ service role JWT)Supabase Anon→ HTTP Header Auth (apikey+ anon JWT)SendGrid→ HTTP Header Auth (Authorization: Bearer YOUR_KEY)Google Drive→ OAuth2 (use n8n built-in Google Drive credential)
- Run Supabase schema — Execute
supabase/schema.sqlin the Supabase SQL Editor - Update webhook URLs — Set your n8n base URL in the dashboard Code node's
apiUrlvariable - Activate workflows — Toggle both workflows to Active in n8n
- Test — Submit a test payload via curl or the intake form
- All API keys and tokens are stored in n8n Credentials — never hardcoded in workflow nodes
- Webhook endpoints can be secured with Header Auth in n8n webhook node settings
- Supabase service role key is only used server-side in n8n — never exposed to the frontend
- The dashboard uses the anon key with read-only Supabase queries