{
  "name": "EN — Client Onboarding → GHL",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "en-onboard",
        "responseMode": "responseNode",
        "options": { "allowedOrigins": "*" }
      },
      "id": "a1b2c3d4-0001-0001-0001-000000000001",
      "name": "Onboarding Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300],
      "webhookId": "en-onboard"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/contacts/upsert",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer pit-0947beb9-c594-4e74-865e-6b3ad8b562ef" },
            { "name": "Version", "value": "2021-07-28" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ locationId: '0e0axgfXYSsM0J690HlY', firstName: $json.body.first_name || '', lastName: $json.body.last_name || '', email: $json.body.email || undefined, phone: $json.body.phone || undefined, companyName: $json.body.biz_name || '', website: $json.body.website || '', source: 'Onboarding Form', tags: ['onboarded', 'new-client', ...($json.body.services ? $json.body.services.split(', ').filter(Boolean).map(s => 'service:' + s.toLowerCase().replace(/[^a-z0-9]+/g, '-')) : []), ...($json.body.platforms ? $json.body.platforms.split(', ').filter(Boolean).map(p => 'platform:' + p.toLowerCase().replace(/[^a-z0-9]+/g, '-')) : [])] }) }}",
        "options": {}
      },
      "id": "a1b2c3d4-0002-0002-0002-000000000002",
      "name": "GHL — Upsert Contact",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [500, 160]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://services.leadconnectorhq.com/contacts/{{ $json.contact.id }}/notes",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer pit-0947beb9-c594-4e74-865e-6b3ad8b562ef" },
            { "name": "Version", "value": "2021-07-28" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ body: ['📋 ONBOARDING FORM — ' + new Date($('Onboarding Webhook').item.json.body.submitted_at).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }), '', 'BUSINESS', 'Company: ' + ($('Onboarding Webhook').item.json.body.biz_name || '—'), 'Niche: ' + ($('Onboarding Webhook').item.json.body.niche || '—'), 'Website: ' + ($('Onboarding Webhook').item.json.body.website || '—'), '', 'SERVICES REQUESTED', $('Onboarding Webhook').item.json.body.services || '—', '', 'PLATFORMS', $('Onboarding Webhook').item.json.body.platforms || '—', '', 'SOCIAL HANDLES', ...[$('Onboarding Webhook').item.json.body.ig ? 'Instagram: ' + $('Onboarding Webhook').item.json.body.ig : null, $('Onboarding Webhook').item.json.body.fb ? 'Facebook: ' + $('Onboarding Webhook').item.json.body.fb : null, $('Onboarding Webhook').item.json.body.tt ? 'TikTok: ' + $('Onboarding Webhook').item.json.body.tt : null, $('Onboarding Webhook').item.json.body.yt ? 'YouTube: ' + $('Onboarding Webhook').item.json.body.yt : null, $('Onboarding Webhook').item.json.body.li ? 'LinkedIn: ' + $('Onboarding Webhook').item.json.body.li : null, $('Onboarding Webhook').item.json.body.th ? 'Threads: ' + $('Onboarding Webhook').item.json.body.th : null, $('Onboarding Webhook').item.json.body.pi ? 'Pinterest: ' + $('Onboarding Webhook').item.json.body.pi : null, $('Onboarding Webhook').item.json.body.gb ? 'Google Business: ' + $('Onboarding Webhook').item.json.body.gb : null].filter(Boolean), '', 'GOALS & TRACKING', 'Primary Goal: ' + ($('Onboarding Webhook').item.json.body.primary_goal || '—'), 'Revenue Tracking: ' + ($('Onboarding Webhook').item.json.body.revenue_tracking || '—'), '', 'ADDITIONAL NOTES', $('Onboarding Webhook').item.json.body.notes || '—', '', 'CREDENTIALS', $('Onboarding Webhook').item.json.body.credentials_provided === 'yes' ? 'Client provided credentials — stored in EN Client Credentials sheet' : 'No credentials provided'].join('\\n') }) }}",
        "options": {}
      },
      "id": "a1b2c3d4-0003-0003-0003-000000000003",
      "name": "GHL — Create Note",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [760, 160]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ ok: true, contactId: $('GHL — Upsert Contact').item.json.contact.id }) }}",
        "options": {}
      },
      "id": "a1b2c3d4-0004-0004-0004-000000000004",
      "name": "Respond 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [1020, 160]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [{ "id": "cred-check", "leftValue": "={{ $json.body.credentials_provided }}", "rightValue": "yes", "operator": { "type": "string", "operation": "equals" } }],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-0005-0005-0005-000000000005",
      "name": "Has Credentials?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [500, 460]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "value": "1RNQssJwYfCZyc6ZdQsftqy4UqsdhLb2v5svqVikEXoI", "mode": "id" },
        "sheetName": { "__rl": true, "value": "gid=0", "mode": "id" },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Date Submitted": "={{ $('Onboarding Webhook').item.json.body.submitted_at }}",
            "Business Name": "={{ $('Onboarding Webhook').item.json.body.biz_name }}",
            "First Name": "={{ $('Onboarding Webhook').item.json.body.first_name }}",
            "Last Name": "={{ $('Onboarding Webhook').item.json.body.last_name }}",
            "Email": "={{ $('Onboarding Webhook').item.json.body.email }}",
            "Platforms": "={{ $('Onboarding Webhook').item.json.body.platforms }}",
            "Credentials (JSON)": "={{ $('Onboarding Webhook').item.json.body.credentials }}"
          }
        },
        "options": {}
      },
      "credentials": {
        "googleSheetsOAuth2Api": { "id": "OhjizsinSISmx4Gl", "name": "Google Sheets OAuth2 API" }
      },
      "id": "a1b2c3d4-0006-0006-0006-000000000006",
      "name": "Sheets — Log Credentials",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [760, 460]
    },
    {
      "parameters": {
        "resume": "timeInterval",
        "unit": "hours",
        "amount": 24
      },
      "id": "a1b2c3d4-0007-0007-0007-000000000007",
      "name": "Wait 24h",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [500, 660]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://services.leadconnectorhq.com/contacts/",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer pit-0947beb9-c594-4e74-865e-6b3ad8b562ef" },
            { "name": "Version", "value": "2021-07-28" }
          ]
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            { "name": "locationId", "value": "0e0axgfXYSsM0J690HlY" },
            { "name": "query", "value": "={{ $('Onboarding Webhook').item.json.body.email }}" }
          ]
        },
        "options": {}
      },
      "id": "a1b2c3d4-0008-0008-0008-000000000008",
      "name": "Get Contact",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [760, 660]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": false, "leftValue": "", "typeValidation": "loose" },
          "conditions": [
            {
              "id": "tag-check",
              "leftValue": "={{ ($json.contacts?.[0]?.tags ?? []).join(',') }}",
              "rightValue": "kickoff-scheduled",
              "operator": { "type": "string", "operation": "notContains" }
            },
            {
              "id": "exists-check",
              "leftValue": "={{ ($json.contacts ?? []).length }}",
              "rightValue": 0,
              "operator": { "type": "number", "operation": "gt" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-0009-0009-0009-000000000009",
      "name": "Not Scheduled?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [1020, 660]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/conversations/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer pit-0947beb9-c594-4e74-865e-6b3ad8b562ef" },
            { "name": "Version", "value": "2021-07-28" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ type: 'SMS', contactId: $('Get Contact').item.json.contacts[0].id, message: 'Hey ' + $('Get Contact').item.json.contacts[0].firstName + '! Just a quick reminder — your Emerson North dashboard is ready to go. The last step is booking your kickoff call so we can walk through everything together: https://api.leadconnectorhq.com/widget/booking/ZsqMrxrFf2QEkUmlB0TA' }) }}",
        "options": {}
      },
      "id": "a1b2c3d4-0010-0010-0010-000000000010",
      "name": "Send SMS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1280, 580]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/conversations/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer pit-0947beb9-c594-4e74-865e-6b3ad8b562ef" },
            { "name": "Version", "value": "2021-07-28" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ type: 'Email', contactId: $('Get Contact').item.json.contacts[0].id, subject: 'Schedule your Emerson North kickoff call', emailFrom: 'hello@emersonnorth.com', emailFromName: 'Emerson North', html: '<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head><body style=\"margin:0;padding:0;background:#f0ede8;font-family:Arial,sans-serif;\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f0ede8;padding:40px 20px;\"><tr><td><table width=\"600\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;max-width:600px;margin:0 auto;\"><tr><td style=\"background:#1A1A1A;padding:32px 40px;border-top:4px solid #8B0000;\"><p style=\"margin:0;font-size:9px;font-weight:700;letter-spacing:4px;text-transform:uppercase;color:rgba(255,255,255,0.4);\">EMERSON NORTH</p><p style=\"margin:6px 0 0;font-size:22px;font-weight:900;color:#F0EDE8;letter-spacing:-0.5px;\">EMERSON <span style=\"color:#F05454;\">NORTH</span></p></td></tr><tr><td style=\"padding:40px;\"><h1 style=\"margin:0 0 20px;font-size:22px;font-weight:700;color:#1A1A1A;\">Don&#39;t forget — schedule your kickoff call</h1><p style=\"margin:0 0 16px;font-size:15px;color:#444;line-height:1.7;\">Hey ' + $('Get Contact').item.json.contacts[0].firstName + ',</p><p style=\"margin:0 0 28px;font-size:15px;color:#444;line-height:1.7;\">Your dashboard is set up and ready. The last step is booking your kickoff call — that&#39;s where we walk you through everything, confirm your goals, and launch your first month of work.</p><table cellpadding=\"0\" cellspacing=\"0\"><tr><td style=\"background:#8B0000;border-radius:6px;\"><a href=\"https://api.leadconnectorhq.com/widget/booking/ZsqMrxrFf2QEkUmlB0TA\" style=\"display:inline-block;padding:14px 32px;color:#ffffff;font-size:14px;font-weight:700;text-decoration:none;letter-spacing:0.5px;\">Schedule Your Kickoff Call &rarr;</a></td></tr></table><p style=\"margin:28px 0 0;font-size:13px;color:#999;\">30 minutes &nbsp;·&nbsp; Video call &nbsp;·&nbsp; We&#39;ll walk through your dashboard together</p></td></tr><tr><td style=\"background:#1A1A1A;padding:20px 40px;\"><p style=\"margin:0;font-size:11px;color:rgba(255,255,255,0.3);\">© 2026 Emerson North &nbsp;·&nbsp; All rights reserved</p></td></tr></table></td></tr></table></body></html>' }) }}",
        "options": {}
      },
      "id": "a1b2c3d4-0011-0011-0011-000000000011",
      "name": "Send Email",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1280, 760]
    }
  ],
  "connections": {
    "Onboarding Webhook": {
      "main": [[
        { "node": "GHL — Upsert Contact", "type": "main", "index": 0 },
        { "node": "Has Credentials?", "type": "main", "index": 0 },
        { "node": "Wait 24h", "type": "main", "index": 0 }
      ]]
    },
    "GHL — Upsert Contact": {
      "main": [[{ "node": "GHL — Create Note", "type": "main", "index": 0 }]]
    },
    "GHL — Create Note": {
      "main": [[{ "node": "Respond 200", "type": "main", "index": 0 }]]
    },
    "Has Credentials?": {
      "main": [
        [{ "node": "Sheets — Log Credentials", "type": "main", "index": 0 }],
        []
      ]
    },
    "Wait 24h": {
      "main": [[{ "node": "Get Contact", "type": "main", "index": 0 }]]
    },
    "Get Contact": {
      "main": [[{ "node": "Not Scheduled?", "type": "main", "index": 0 }]]
    },
    "Not Scheduled?": {
      "main": [
        [
          { "node": "Send SMS", "type": "main", "index": 0 },
          { "node": "Send Email", "type": "main", "index": 0 }
        ],
        []
      ]
    }
  },
  "settings": { "executionOrder": "v1" }
}
