Skip to content
Black Friday: up to 30% off fixed-price automation, ends November 30New: a free website for your business, live in 48 to 72 hoursWorkflow automation on n8n and Claude, built for your businessFixed price, agreed before we start · Live in 5 to 10 business days30-day money-back guarantee on every planProfessional firms · Agencies · E-commerceYou own every workflow, in your own n8nClaude API: your data is not used for trainingHuman approval on every sensitive stepFree automation audit, no obligation
PURIST
30 days
Money-back window
14 h/wk
Modeled time saved
99.97%
Uptime SLA
< 7 days
Deploy time
PURIST AI
Claude Opus 4.7 · n8n v1.71 · <80ms
What type of business are you running? I'll show you exactly which processes we'd automate first and your estimated ROI.
Powered by n8n + Claude Opus 4.7 Get my free automation plan →
GoHighLevel + n8n + Claude: Build an AI Lead Pipeline (Full Workflow and Code)
Guides 10 min read · 2,127 words

GoHighLevel + n8n + Claude: Build an AI Lead Pipeline (Full Workflow and Code)

How to connect GoHighLevel, n8n and Claude: Claude scores each lead, n8n upserts the contact and creates the opportunity through HighLevel API v2. Every endpoint checked, importable workflow, and how Claude Code maintains it.

Steve, founder of PURIST

November 14, 2026

This guide shows how to connect GoHighLevel, n8n and Claude into one lead pipeline: a lead fills in a form, Claude reads the message and scores it, n8n creates or updates the contact in HighLevel, and only the leads worth a call become opportunities in your pipeline. You get the full importable workflow, the exact API calls, and the rules we follow at Purist when Claude Code builds and maintains workflows like this one.

Every HighLevel endpoint, header and field in this guide was checked on November 14, 2026 against HighLevel's official API specification (the GoHighLevel/highlevel-api-docs repository) and n8n's documentation. The workflow passed n8n's own workflow validator the same day. It is a template: plug in your IDs and credentials, then test it with the request at the end before you send real traffic.

Who Does What in the Stack

ToolIts job in this pipelineWhy it is there
GoHighLevelStores contacts and opportunities, then runs your SMS, email and calendar follow-upIt is where your sales team already works
n8nReceives the form, calls Claude, applies your rules, writes to HighLevelCustom logic, versioned and testable, billed per execution
Claude (API)Reads the free-text message and returns a score, an intent and tagsForms say a lot in the message box, and rules alone miss it
Claude CodeBuilds, validates and maintains the n8n workflow from plain instructionsChanges take minutes and every change is checked before it goes live

The point of the split: HighLevel's own workflows are excellent for messaging and pipeline moves, but scoring with your own model and prompt, version control and complex branching are easier in n8n. HighLevel stays the single place your team looks at.

Before You Start: Four Things From HighLevel

  1. 1 An access token. HighLevel's API documentation accepts an access token generated for a sub-account, or a Private Integration token of the sub-account. Give it the contacts.write and opportunities.write scopes.
  2. 2 Your location ID, which is the sub-account ID.
  3. 3 Your pipeline ID and the ID of the stage where hot leads should land.
  4. 4 The version header. Every API v2 call needs Version: 2021-07-28.

Get the pipeline and stage IDs with one call. The locationId query parameter is required:

bash
curl -s "https://services.leadconnectorhq.com/opportunities/pipelines?locationId=YOUR_LOCATION_ID" \
  -H "Authorization: Bearer $GHL_TOKEN" \
  -H "Version: 2021-07-28" \
  -H "Accept: application/json"

The response lists each pipeline with its stages. Copy the pipeline id and the id of your "hot lead" stage.

If you prefer n8n's built-in HighLevel node, it supports contacts (create or update, get, update, delete), opportunities, tasks and calendar bookings. n8n's credential documentation notes that HighLevel deprecated API v1.0, so new connections use OAuth2 with API v2. We use plain HTTP Request nodes in this guide because they show exactly what is sent, and they work with a Private Integration token.

The Workflow, Node by Node

The flow has nine nodes: Webhook, Normalize and validate, Claude, Parse the score, HighLevel upsert, an IF on the score, HighLevel opportunity, and two webhook replies.

1. Webhook: receive the lead

A POST webhook on the path ghl-lead-intake, set to reply through a Respond to Webhook node, so your form gets a clean JSON answer.

2. Normalize and validate

Bad data is cheaper to stop here than to clean in the CRM. This Code node rejects a missing or malformed email, keeps only digits and the plus sign in the phone number, and holds your HighLevel IDs in one place:

javascript
// Replace the three IDs with your own (see "Before you start").
const CONFIG = { locationId: 'YOUR_LOCATION_ID', pipelineId: 'YOUR_PIPELINE_ID', hotStageId: 'YOUR_HOT_STAGE_ID', minScore: 70 };
const b = $json.body || {};
const email = String(b.email || '').trim().toLowerCase();
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) throw new Error('Invalid or missing email');
return { json: {
  ...CONFIG,
  firstName: String(b.firstName || b.name || '').trim().split(' ')[0],
  lastName: String(b.lastName || '').trim(),
  email,
  phone: String(b.phone || '').replace(/[^+\d]/g, ''),
  company: String(b.company || '').trim(),
  message: String(b.message || '').slice(0, 2000),
  source: String(b.source || 'website form')
} };

3. Claude: qualify the lead

An HTTP Request to the Anthropic Messages API (POST https://api.anthropic.com/v1/messages) with the header anthropic-version: 2023-06-01 and your API key in an x-api-key header credential. A small, fast model is enough for scoring. The prompt asks for JSON only, and tells the model to score high only when the message states a concrete need, a timeline or a budget:

json
{
  "model": "claude-haiku-5-5",
  "max_tokens": 300,
  "system": "You qualify inbound B2B leads for a service business. Reply with JSON only: {\"score\": 0-100, \"intent\": \"buy|research|support|spam\", \"summary\": \"one sentence\", \"tags\": [\"max 3 short tags\"]}. Score high only when the message states a concrete need, a timeline or a budget.",
  "messages": [{ "role": "user", "content": "Company: ...\nMessage: ..." }]
}

The node retries three times with a two-second wait, so a brief network error does not lose a lead.

4. Parse the score

Models occasionally wrap JSON in text. This node extracts the JSON between the first and last brace, falls back to a score of 0 if parsing fails, clamps the score between 0 and 100, and adds a tag your HighLevel workflows can react to:

javascript
const lead = $('Normalize and validate').item.json;
const text = ($json.content || []).map((c) => c.text || '').join('');
let q = { score: 0, intent: 'research', summary: '', tags: [] };
try { q = { ...q, ...JSON.parse(text.slice(text.indexOf('{'), text.lastIndexOf('}') + 1)) }; } catch (e) { q.summary = 'Model reply was not valid JSON'; }
const score = Math.max(0, Math.min(100, Number(q.score) || 0));
return { json: { ...lead, score, intent: q.intent, summary: q.summary,
  tags: ['ai-score-' + (score >= lead.minScore ? 'hot' : 'nurture')].concat((q.tags || []).slice(0, 3)) } };

The fallback matters: a parsing problem sends the lead to nurture instead of crashing the workflow, so nobody is lost.

5. HighLevel: upsert the contact

POST https://services.leadconnectorhq.com/contacts/upsert with your bearer token and the Version header. Only locationId is required by the API. The body we send:

json
{
  "locationId": "YOUR_LOCATION_ID",
  "firstName": "Ana",
  "lastName": "Silva",
  "email": "ana@example.com",
  "phone": "+15551234567",
  "companyName": "Example Dental",
  "source": "website form",
  "tags": ["ai-score-hot", "booking", "q1-launch"]
}

The response contains new (true when the contact was created), the contact object and a traceId. We use contact.id in the next step.

One behaviour worth knowing, from HighLevel's own specification: upsert follows the "Allow Duplicate Contact" setting of the location. If that setting checks both email and phone, HighLevel looks for an existing contact in the order you configured. If two different contacts already exist, one with the same email and another with the same phone, the API updates the one that matches the first field in your configured order and ignores the second. So decide that order deliberately before you connect any form.

6. IF: is the score above your threshold?

A number comparison of the score against minScore (70 in the template). Hot leads go to the opportunity step; the rest are already tagged ai-score-nurture in HighLevel, where a nurture workflow can pick them up.

7. HighLevel: create the opportunity

POST https://services.leadconnectorhq.com/opportunities/. HighLevel requires pipelineId, locationId, name, status and contactId. Status accepts open, won, lost, abandoned and all; a new lead is open:

json
{
  "locationId": "YOUR_LOCATION_ID",
  "pipelineId": "YOUR_PIPELINE_ID",
  "pipelineStageId": "YOUR_HOT_STAGE_ID",
  "contactId": "CONTACT_ID_FROM_STEP_5",
  "name": "Example Dental (AI score 86)",
  "status": "open"
}

Putting the score in the opportunity name means your sales team sees it on the pipeline board without opening anything.

8 and 9. Reply to the form

The hot branch replies with the opportunity ID, the nurture branch with the contact ID. Your website can use that answer to show a different thank-you message, for example a booking link for hot leads.

Download the Workflow

Once imported:

  1. 1 Create a Header Auth credential named x-api-key with your Anthropic API key, and select it on the Claude node.
  2. 2 Create a Bearer Auth credential with your HighLevel token, and select it on both HighLevel nodes.
  3. 3 Replace YOUR_LOCATION_ID, YOUR_PIPELINE_ID and YOUR_HOT_STAGE_ID in the Normalize and validate node.
  4. 4 Activate the workflow and point your form at the production webhook URL.

Test It Before Real Traffic

bash
curl -X POST "https://YOUR-N8N-HOST/webhook-test/ghl-lead-intake" \
  -H "Content-Type: application/json" \
  -d '{"firstName":"Ana","lastName":"Silva","email":"ana@example.com","company":"Example Dental","message":"We need online booking live before January. Budget is approved."}'

Use the webhook-test path while the workflow is open in the editor, then check three things in HighLevel: the contact exists with the right tags, the opportunity sits in your hot stage with the score in its name, and sending the same request twice updates the contact instead of creating a duplicate.

How Claude Code Builds and Maintains It

At Purist, workflows like this one are built and changed by Claude Code working directly against n8n through n8n's MCP server. The loop is always the same:

  1. 1 Describe the change in plain language, for example "raise the threshold to 75 and add the intent as a HighLevel tag".
  2. 2 Claude Code reads the current workflow, edits it, and runs n8n's validator before saving anything.
  3. 3 Nothing that sends messages is activated without a human go.
  4. 4 The change is tested with a test request, and the result is checked in the CRM, not assumed.

The rules live in a CLAUDE.md file at the root of the project, so every session starts with them. A short version of the ones that matter here:

markdown
## Automation rules
- Validate every workflow with the n8n validator before saving it.
- Never activate a workflow that sends email, SMS or messages without the founder's explicit go.
- Never store a token in a node parameter: use n8n credentials.
- Retries on every external API call; a failed parse must route to nurture, never drop the lead.
- Log every change and every send to the operations journal with its time.

What We Learned Running Automations in Production

These come from running Purist's own operations on n8n, Supabase and Claude Code, not from theory.

  • A watcher must never change what a human sees. One of our early inbox scripts marked replies as read after processing them, and a prospect's answer went unnoticed for hours. Read-only access, and an alert instead.
  • Any endpoint a scheduler can call, the internet can call too. Throttle it: our reply watcher refuses to run more than once every 10 minutes without a secret.
  • Use upsert, not create, on every CRM write. Forms get submitted twice; duplicates cost more to clean than to prevent.
  • Fall back safely when the model returns something unexpected. The parse step above sends the lead to nurture rather than failing.
  • Keep a journal. Every automated step at Purist writes a timestamped line, which is how we find out what happened at 3 am without guessing.

What It Costs to Run

PieceCost
GoHighLevelFrom $97 a month on Starter, $297 on Unlimited, plus usage (full pricing)
n8nFree self-hosted, or an n8n Cloud plan billed per execution (n8n pricing)
Claude APIBilled per token by Anthropic; one scoring call uses a few hundred tokens. Check anthropic.com/pricing for current rates

Frequently Asked Questions

Does n8n have a GoHighLevel node?

Yes. n8n's HighLevel node covers contacts, opportunities, tasks and calendar bookings. New credentials use OAuth2 with HighLevel's API v2, since API v1.0 is deprecated.

Which HighLevel API header is required?

Every API v2 call needs Version: 2021-07-28, plus the Authorization bearer token.

Why use n8n instead of HighLevel's own workflows?

Keep messaging and pipeline moves in HighLevel. Use n8n when you need your own AI model and prompt, versioned logic, complex branching, or tools HighLevel does not connect to.

Can I use GPT or another model instead of Claude?

Yes. Only the request in step 3 and the parsing in step 4 change; the HighLevel side stays the same.

Will this create duplicate contacts?

Not if you keep the upsert call and set the Allow Duplicate Contact order in HighLevel deliberately, as explained in step 5.

Sources

  • HighLevel API specification, contacts and opportunities (github.com/GoHighLevel/highlevel-api-docs), checked November 14, 2026.
  • n8n documentation, HighLevel node and HighLevel credentials (docs.n8n.io), checked November 14, 2026.
  • Anthropic Messages API documentation (docs.anthropic.com).

Want this pipeline built in your own HighLevel and n8n accounts? Book a free automation audit.

Tags

gohighlevel n8ngohighlevel apin8n gohighlevel integrationclaude codeai lead scoringhighlevel api v2
Steve, founder of PURIST

Steve founded PURIST, a workflow automation studio working with n8n, Make and Claude AI, and is the point of contact on every project. Prices and features in our articles come from vendor documentation and public pricing pages. How we research and score tools.

Complete guide

Workflow Automation

Pillar guide Business Process Automation: The Complete Guide for 202… 14 min read Stripe vs Square vs PayPal: Fees Compared for US Small … 14 min read Google Drive vs Dropbox vs OneDrive vs Box: Cloud Stora… 14 min read Asana vs Jira vs Trello vs Wrike: Project Management To… 14 min read Ramp vs Brex vs Expensify: Corporate Cards and Expense … 15 min read ChatGPT vs Claude vs Gemini vs Perplexity: Which AI Ass… 18 min read Claude Code vs Cursor vs GitHub Copilot: The 2026 AI Co… 14 min read 1Password vs Bitwarden vs LastPass: Which Password Mana… 14 min read Best Multi-Entity Accounting Software in 2026: What to … 13 min read Best Financial Close Automation Software in 2026: FloQa… 14 min read Best Usage-Based Billing Software in 2026: Stripe, Metr… 13 min read Best AI Proposal Software for Agencies in 2026: PandaDo… 11 min read WooCommerce vs BigCommerce in 2026: Real Costs, Feature… 11 min read HubSpot vs Pipedrive in 2026: Pricing, Features and the… 11 min read Klaviyo vs Mailchimp in 2026: Pricing, E-commerce Featu… 12 min read 8 Best Airtable Alternatives in 2026: Open Source, Chea… 11 min read Notion vs Confluence in 2026: Pricing, Features and the… 11 min read Intercom vs Freshdesk in 2026: Pricing, AI Agents, Chan… 11 min read Slack vs Microsoft Teams in 2026: Pricing, Features and… 13 min read n8n vs Lindy vs Relevance AI vs Gumloop (2026): Best AI… 12 min read Chargebee vs Recurly in 2026: Pricing, Dunning, B2B vs … 11 min read The Best Typeform Alternatives in 2026: 5 Form Builders… 10 min read Pardot vs Marketo in 2026: Account Engagement vs Market… 11 min read QuickBooks vs Xero in 2026: Pricing, Users, Features an… 9 min read Calendly vs Acuity Scheduling: Which Booking Tool Fits … 9 min read The Best Google Workspace Alternatives in 2026: 5 Suite… 8 min read How to Use Claude Code for QA Automation 8 min read Automation System Upgrade Services: When and How to Mod… 7 min read Power Automate Premium License Cost for Nonprofits (and… 7 min read What Is RPA (Robotic Process Automation), Explained Sim… 8 min read Logic Apps vs Power Automate for Moving SharePoint File… 14 min read B2B Marketing Automation Agency vs Consultant: How to C… 15 min read Act-On vs HubSpot vs Pardot vs Marketo: The Honest B2B … 14 min read B2B Finance Automation: How to Automate Payments, Accou… 14 min read B2B Sales Outbound Automation: Technology, Sequencing a… 17 min read Connect Airtable, Slack and Typeform: The Complete Auto… 16 min read GoHighLevel Workflow Automation for Local Business: Com… 15 min read Workflow Automation Consulting: How to Choose, Hire, an… 16 min read How to Use Shopify Flow and AI to Create Workflows: Com… 15 min read AI Lead Generation Automation for Trade and Local Servi… 16 min read Inbound Marketing Pipeline and SDR Workflow Automation:… 15 min read Digital Workflow Automation: The Complete 2026 Guide to… 15 min read Intelligent Workflow Automation: How AI Decision-Making… 15 min read Workflow Management System for Small Business: The Buye… 16 min read Push Notification Automation: Building Trigger-Based Dr… 12 min read HubSpot vs Salesforce vs Pipedrive vs Zoho CRM: Which W… 10 min read Calendly vs Cal.com vs Acuity Scheduling vs SavvyCal: T… 11 min read Zendesk vs Freshdesk vs Intercom: The Honest Helpdesk C… 12 min read Asana vs Monday vs ClickUp vs Notion: Which Project Too… 10 min read DocuSign vs PandaDoc vs Dropbox Sign: The Honest E-Sign… 12 min read QuickBooks vs Xero vs FreshBooks vs Wave: Which Account… 12 min read Mailchimp vs Klaviyo vs ActiveCampaign vs Brevo: The Ho… 11 min read Intercom Fin vs Zendesk AI vs Ada: Which AI Customer Su… 10 min read Otter vs Fireflies vs Fathom vs Grain: The Honest AI Me… 10 min read RingCentral vs Aircall vs OpenPhone: Which Business Pho… 10 min read Typeform vs Jotform vs Google Forms vs Tally: The Hones… 11 min read Gusto vs Rippling vs ADP vs Paychex: Which Payroll Soft… 15 min read Zoho One vs Freshworks vs Odoo: The All-in-One Business… 14 min read Twilio vs Vonage vs MessageBird vs Plivo: Which Communi… 14 min read Chargebee vs Recurly vs Stripe Billing: Subscription Bi… 14 min read Deel vs Remote vs Papaya Global: Global Payroll and EOR… 15 min read Apollo.io vs ZoomInfo vs Lusha vs Cognism: Sales Intell… 15 min read Instantly vs Smartlead vs Lemlist: Cold Email Outreach … 15 min read Squarespace vs Webflow vs WordPress vs Wix: Which Websi… 15 min read Shopify vs WooCommerce vs BigCommerce: Ecommerce Platfo… 15 min read NetSuite vs Sage Intacct vs QuickBooks Enterprise: ERP … 14 min read Google Workspace vs Microsoft 365 vs Zoho Workplace: Pr… 14 min read Loom vs Vidyard vs Bonjoro: Async Video Messaging for S… 14 min read Canva vs Adobe Express vs Figma: Design Automation for … 14 min read n8n Alternatives: The Honest 2026 Guide to Make, Zapier… 14 min read n8n API: The Complete Guide to Automating n8n Itself (2… 14 min read n8n and MCP: The Complete Guide to Model Context Protoc… 13 min read n8n vs Manus AI: Workflow Automation vs Autonomous Agen… 13 min read n8n Pricing: The Complete 2026 Guide to Cloud vs Self-H… 13 min read n8n Self-Hosted PostgreSQL: Setup and Schema Guide (202… 12 min read n8n Templates: Where to Find Them and How to Use Them S… 13 min read n8n Docker: The Production Deployment Guide (2026) 13 min read n8n Community Nodes: Installing and Building Custom Nod… 12 min read n8n Cloud Pricing vs Self-Hosted: The Real Decision Fra… 5 min read GoHighLevel Pricing 2026: Starter $97, Unlimited $297, … 11 min read Vapi vs Retell AI vs Bland AI vs Synthflow (2026): Real… 10 min read Chatbase Alternatives (2026): Chatbase vs SiteGPT vs Cu… 10 min read Clay Alternatives (2026): Persana vs Databar vs Freckle…

Keep reading

More from the blog.

All articles

From audit to deployment

Experience the automation
these articles are about.

Get my free automation plan →