{"slug":"close-won-onboarding-workflow","title":"Close Won to Onboarding: GHL Trigger + N8N Heavy Lifting Architecture","tags":["ghl","n8n","onboarding","workflow","supabase"],"agent_summary":"Architecture for the close-won to onboarding workflow where GHL handles the trigger and removes from other workflows, then N8N does the heavy lifting: creating SaaS client, generating magic link, sending welcome SMS/email, and managing Supabase records.","trigger_phrases":["close won onboarding workflow","ghl to n8n onboarding flow","magic link onboarding setup","new client onboarding automation","close won pipeline trigger n8n","saas client creation workflow"],"runnable":true,"markdown":"## Close Won → Onboarding Workflow Architecture\n\n### Design Principle\nGHL handles the trigger and simple native actions. N8N handles all complex logic.\n\n### GHL Side (Minimal)\n1. **Trigger**: Pipeline stage changed to \"Close Won\" in Sales Pipeline\n2. **Action**: Remove from all other workflows (native GHL action)\n3. **Action**: Send webhook to N8N\n\n### N8N Side (Heavy Lifting)\n1. **Log webhook** — Extract contact data from GHL webhook payload\n2. **Create SaaS client** — Insert into Supabase `clients` table\n3. **Generate magic link** — Create unique onboarding URL for the client\n4. **Save token** — Store authentication token in Supabase\n5. **Cancel sales enrollments** — Disenroll from all sales-related N8N workflows\n6. **Create onboarding opportunity** — Move to onboarding pipeline stage\n7. **Send welcome SMS**: \"Hey {first_name}, welcome to Iron Automations! We're getting everything set up for you. Here's your onboarding form — takes about 5 minutes. {magic_link}\"\n8. **Send welcome email** — Same content with more detail\n9. **Post notification** — Send to Mattermost notifications channel (NOT SMS replies channel)\n\n### Key Decisions\n- **No inbound webhooks to GHL** — Premium feature, never use it. Always send data OUT of GHL to N8N.\n- **No custom webhook actions** — Also premium. Off the table.\n- **Tags**: Only use if absolutely necessary for triggering other automations. Pipeline stage changes are preferred.\n- **Onboarding form reminders**: Should be a SEPARATE workflow, not bundled into this one.\n\n### Magic Link Onboarding Form Flow\nThe magic link leads to a mobile-optimized multi-step form:\n1. Loom video walkthrough explaining each question\n2. Services offered (creates individual pages on website)\n3. Service area / cities served (creates location pages)\n4. Google Business Profile link\n5. Facebook page link\n6. Logo upload (or request generation)\n7. Brand colors\n8. Photos (5-10 of job sites, team, equipment)\n9. Business details (legal name, address, phone, email)\n10. Domain name (existing or request new)\n\nForm submissions feed into Iron Funnels for automated site/funnel generation.\n","html":"<h2>Close Won → Onboarding Workflow Architecture</h2>\n<h3>Design Principle</h3>\n<p>GHL handles the trigger and simple native actions. N8N handles all complex logic.</p>\n<h3>GHL Side (Minimal)</h3>\n<ol>\n<li><strong>Trigger</strong>: Pipeline stage changed to \"Close Won\" in Sales Pipeline</li>\n<li><strong>Action</strong>: Remove from all other workflows (native GHL action)</li>\n<li><strong>Action</strong>: Send webhook to N8N</li>\n</ol>\n<h3>N8N Side (Heavy Lifting)</h3>\n<ol>\n<li><strong>Log webhook</strong> — Extract contact data from GHL webhook payload</li>\n<li><strong>Create SaaS client</strong> — Insert into Supabase <code>clients</code> table</li>\n<li><strong>Generate magic link</strong> — Create unique onboarding URL for the client</li>\n<li><strong>Save token</strong> — Store authentication token in Supabase</li>\n<li><strong>Cancel sales enrollments</strong> — Disenroll from all sales-related N8N workflows</li>\n<li><strong>Create onboarding opportunity</strong> — Move to onboarding pipeline stage</li>\n<li><strong>Send welcome SMS</strong>: \"Hey {first_name}, welcome to Iron Automations! We're getting everything set up for you. Here's your onboarding form — takes about 5 minutes. {magic_link}\"</li>\n<li><strong>Send welcome email</strong> — Same content with more detail</li>\n<li><strong>Post notification</strong> — Send to Mattermost notifications channel (NOT SMS replies channel)</li>\n</ol>\n<h3>Key Decisions</h3>\n<ul>\n<li><strong>No inbound webhooks to GHL</strong> — Premium feature, never use it. Always send data OUT of GHL to N8N.</li>\n<li><strong>No custom webhook actions</strong> — Also premium. Off the table.</li>\n<li><strong>Tags</strong>: Only use if absolutely necessary for triggering other automations. Pipeline stage changes are preferred.</li>\n<li><strong>Onboarding form reminders</strong>: Should be a SEPARATE workflow, not bundled into this one.</li>\n</ul>\n<h3>Magic Link Onboarding Form Flow</h3>\n<p>The magic link leads to a mobile-optimized multi-step form:</p>\n<ol>\n<li>Loom video walkthrough explaining each question</li>\n<li>Services offered (creates individual pages on website)</li>\n<li>Service area / cities served (creates location pages)</li>\n<li>Google Business Profile link</li>\n<li>Facebook page link</li>\n<li>Logo upload (or request generation)</li>\n<li>Brand colors</li>\n<li>Photos (5-10 of job sites, team, equipment)</li>\n<li>Business details (legal name, address, phone, email)</li>\n<li>Domain name (existing or request new)</li>\n</ol>\n<p>Form submissions feed into Iron Funnels for automated site/funnel generation.</p>\n"}