Build an n8n AI Agent That Works Your GoHighLevel CRM (Free Workflow)
Most “n8n AI agent” tutorials build a toy that answers trivia. This one builds something with a job: an agent that can search your GoHighLevel contacts and act on them — “find jane@example.com and tag her hot-lead” — with the safety rails that make it deployable, and the workflow file to import so you’re running in ten minutes.
The architecture
Five nodes:
- Chat trigger — n8n’s built-in chat panel for testing (swap it for a webhook later to run inside WhatsApp, SMS or your app).
- AI Agent node — the brain: receives the message, decides which tools to call, composes the answer.
- Chat model — start with a fast, cheap model (gpt-4o-mini class). Tool-calling CRM chores don’t need a frontier model; upgrade only if the execution logs show reasoning failures.
- Window memory — so “tag her” knows who “her” is from two messages ago.
- Two HTTP tools — this is where GHL comes in:
- Search contacts — GET
https://services.leadconnectorhq.com/contacts/with the query text, returning id, name, email, phone, tags. - Add tag — POST
…/contacts/{contactId}/tags.
Both authenticate with a Private Integration Token and the
Version: 2021-07-28header (the setup is covered in the n8n + GHL guide). - Search contacts — GET
The system prompt that keeps it honest
You are the CRM assistant for a small business using GoHighLevel.
Rules:
1) Always look up the contact before answering questions about them.
2) Never invent contact data — if the lookup returns nothing, say so.
3) You may add tags when asked, but never delete or modify anything else.
4) Keep answers short and factual.
Rule 2 matters most. An agent without it will cheerfully describe contacts that don’t exist — hallucination is the default, retrieval is the discipline.
Safety: scope the token, not just the prompt
The real guardrail isn’t in the prompt — it’s in the Private Integration Token. Create it with read scopes plus only the writes the agent needs (tags, maybe notes). A clever user can talk a model around its instructions; nobody can talk an API into honouring a scope the token doesn’t have. Also set the agent’s max iterations (10–15) so a confused run burns pennies, not dollars.
Import and run
- n8n → Workflow menu → Import from file.
- Open the model node, attach your OpenAI credential.
- Replace
YOUR_PRIVATE_INTEGRATION_TOKENandYOUR_LOCATION_IDin both tool nodes. - Open the chat panel and try: “find jane@example.com” → then “tag her hot-lead”.
Watch the execution log the first few runs — you’ll see the agent choose tools, and that log is where you catch it doing anything silly before a customer does.
Where to take it next
Swap the chat trigger for your inbound-message webhook and this same agent answers customers instead of you; add a calendar-slots tool and it books appointments; connect it through GHL’s MCP server and it discovers operations without hand-wired tools. Those production versions — error handling, identity checks, escalation to humans — are the difference between a demo and a deployment, and they’re the part I get hired for.
Frequently asked questions
Which model should the agent use?
Start with a fast, cheap model (gpt-4o-mini or claude-haiku class) — for tool-calling CRM tasks the expensive models rarely justify their cost. Upgrade only if you see reasoning failures in the execution logs.
How do I stop the agent doing something destructive in my CRM?
Scope the token, not the prompt. Give the Private Integration Token read scopes plus only the specific write operations the agent needs (e.g. add a tag, create a note). A prompt can be talked around; a missing scope cannot.
Can the agent run inside WhatsApp or SMS conversations?
Yes — swap the chat trigger for a webhook fed by your channel (GHL inbound message webhook, WhatsApp provider, etc.) and post the agent's reply back through the conversations API. The agent logic stays identical.