Managing AI agents in GoHighLevel without variables is like driving with the parking brake on—you'll get somewhere, but you're wasting energy and time.
Variables are the secret weapon that separates agencies handling 5 clients from those scaling to 50. When you leverage custom variables and merge fields in Agent Studio, you unlock personalization at scale, eliminate manual data entry, and build workflows that actually work without constant tweaking.
In this guide, I'll show you exactly how to set up and use variables in GoHighLevel Agent Studio so your AI agents pull real CRM data, personalize every interaction, and save your team hours each week. If you're serious about scaling with automation, the GoHighLevel bootcamp is where agency owners and managers learn the advanced strategies that make this all work together.
What Are Variables and Merge Fields in GoHighLevel?
Variables and merge fields are placeholders that pull dynamic data from your CRM into your AI agent's responses, emails, SMS messages, and workflows. Instead of hardcoding the same message for every contact, you use syntax like {{contact.firstName}} or {{customField}} to automatically insert the right information at the right time.
This is the foundation of personalization at scale. Your agent doesn't just say "Hi there"—it says "Hi John" because it's pulling John's name from your CRM. That small difference increases engagement, builds trust, and makes automation feel human.
GoHighLevel supports several types of merge fields:
- Contact Fields: First name, last name, email, phone, company, custom fields you've created
- Custom Values: Variables you define within workflows and Agent Studio for dynamic calculations or logic
- Custom Objects: Related data from linked records in your CRM
- Trigger Links: Payment or action links that change based on contact data
Understanding Custom Fields vs. Custom Values
This is where most people get confused, so let's clarify.
Custom Fields are properties you add to your contact record in the CRM. They live in the database and store contact-specific information. Examples: "Preferred Service," "Contract End Date," "Industry," "Budget." When you merge {{contact.customField}}, you're pulling stored data about that specific contact.
Custom Values are variables you create within a workflow or Agent Studio prompt to store temporary data, perform calculations, or manage logic. They might hold the result of a webhook call, a calculation, or a branching decision. Custom values don't live permanently in the CRM—they exist for the duration of that workflow execution.
In Agent Studio specifically, custom values become powerful because they let your AI agent store information it discovers during a conversation and use it later in the same session. An agent might ask, "What's your biggest challenge right now?" and store the answer as a custom value, then reference it in follow-up messages to sound more contextual.
💡 Pro Tip
Start by using contact merge fields ({{contact.firstName}}, {{contact.email}}) before diving into custom values. Get comfortable with the syntax first, then layer in custom values to handle dynamic logic and multi-step workflows.
How to Set Up Custom Variables in Agent Studio
Setting up variables in Agent Studio is straightforward, but the placement matters.
Step 1: Access Your Agent Studio
Navigate to Agent Studio in your GoHighLevel dashboard. Open the agent you want to configure (or create a new one). Click into the main agent settings or the specific step where you want to use variables.
Step 2: Identify Where You'll Use Variables
Variables work in agent prompts, system instructions, response text, and triggered actions. Decide which part of your agent's flow needs personalization. For example: greeting message, response to a question, email sent by the agent, or condition logic.
Step 3: Insert Merge Field Syntax
Use double curly braces with the correct path:
- {{contact.firstName}} — pulls contact's first name
- {{contact.email}} — pulls contact's email address
- {{contact.customFieldName}} — pulls a custom field value
- {{customValue}} — references a custom value you've created in the workflow
Step 4: Test Your Variables
Before going live, test the agent with a test contact. GoHighLevel should resolve the variables and show you the actual values. If they appear blank or show the raw syntax, double-check the field names and that the test contact has data in those fields.
Step 5: Create Custom Values Within the Workflow (Optional)
If you need variables beyond contact fields, use a "Set Custom Value" action in your workflow. Name the custom value (e.g., "recommendedService") and set it to a specific value or a formula. Then reference it later as {{customValue}} in your Agent Studio.
This is built into GoHighLevel. Try it free for 30 days →
Using Merge Fields to Personalize AI Agent Responses
The real magic happens when you use merge fields to make your AI agent sound like it actually knows your contacts.
Instead of a generic prompt like:
"Hi there. Thanks for reaching out. How can I help?"
Use a personalized prompt like:
"Hi {{contact.firstName}}! I see you work at {{contact.companyName}} in the {{contact.industry}} space. What's your biggest challenge this quarter?"
The second version feels human. It shows you've done your homework. Your agent isn't just a chatbot—it's a knowledgeable representative who's reviewed the contact's profile.
You can also use variables in system instructions to shape how the agent behaves:
"You are speaking to {{contact.firstName}}, a {{contact.jobTitle}} at {{contact.companyName}}. They are interested in {{contact.productInterest}}. Tailor all responses to their specific needs and industry."
This guides the AI to stay contextual and relevant, reducing off-topic responses and improving the quality of conversations.
Building Reusable Workflows with Variables
Variables unlock the true power of reusable workflows. Instead of building a unique workflow for each campaign, service, or client scenario, you build one workflow and use variables to adapt it to different contexts.
Example: Lead Qualification Workflow
Create a single Agent Studio agent that qualifies leads. Use merge fields to reference custom fields like "Budget," "Timeline," and "Decision Maker" from each contact's profile. The same agent asks smarter follow-up questions because it's pulling real data about each lead's situation.
When you duplicate this workflow for a different campaign or client, no changes needed—the merge fields automatically pull the right data for each new contact.
Example: Service Recommendation Workflow
Set a custom value based on contact data (e.g., if {{contact.revenue}} is over $1M, set {{recommendedPackage}} to "Enterprise"). Then in your Agent Studio prompt, reference this custom value: "Based on your company size, I'd recommend our {{recommendedPackage}} plan."
Again—one workflow, infinite variations based on contact data.
💡 Pro Tip
Document your custom fields and what data they contain. Create a reference sheet for your team so everyone knows which merge fields are available and what they pull. This prevents broken workflows and speeds up new agent creation.
Real-World Examples: Variables in Action
E-Commerce: Cart Recovery Agent
Agent pulls {{contact.firstName}}, {{lastAbandonedProductName}}, and {{abandonedCartValue}}. Message: "Hey {{contact.firstName}}, I noticed you left {{lastAbandonedProductName}} (${{abandonedCartValue}}) in your cart. Still interested?" This drives higher recovery rates because it's specific and urgent.
B2B SaaS: Demo Booking Agent
Agent asks qualifying questions and stores answers as custom values. Uses {{contact.companyName}}, {{contact.painPoint}}, and {{demoTimePreference}} (custom value from conversation) to send a follow-up: "Perfect, {{contact.firstName}}. I've scheduled your demo for {{demoTimePreference}} to walk you through how we solve {{contact.painPoint}} for companies like {{contact.companyName}}."
Agency: Multi-Client Lead Handoff
Agent uses {{contact.assignedAgentName}} (custom field) and {{contact.agencyName}} (custom field) to route leads correctly and send personalized handoff messages. No manual reassignment—variables handle it automatically based on stored data.
Frequently Asked Questions
What happens if a contact doesn't have data in a field I'm trying to merge?
The merge field will appear blank or show an empty space. To handle this gracefully, use conditional logic in your workflow. Set up branches that check if a field exists before using it, or provide a default value using custom values as a fallback.
Can I use variables in SMS messages and emails sent by the agent?
Yes. Any text field in GoHighLevel that supports merge fields works the same way. SMS body, email subject, email body—all support {{contact.field}} syntax. Just ensure you're not exceeding SMS character limits when adding personalization.
How do I create a custom value that references data from a webhook response?
Use a "Set Custom Value" action after your webhook step. Map the custom value to the webhook response JSON path. For example, if your webhook returns {"score": 85}, set a custom value to {{webhookData.score}}. Then reference it later as {{customValue}}.
Can variables be used in agent decision logic (branching)?
Absolutely. Use merge fields in condition blocks. Example: "If {{contact.industry}} equals 'Technology,' branch to Tech-Specific Agent." This lets your workflow adapt based on CRM data without manual setup.
What's the best practice for naming custom fields to keep merge field syntax clean?
Use camelCase (no spaces). Instead of "Preferred Service," use "preferredService." This makes merge field syntax easier to remember and reduces errors. {{contact.preferredService}} is cleaner than trying to handle spaces.
Variables in GoHighLevel Agent Studio aren't just a feature—they're the foundation of scalable automation. They turn static, one-size-fits-all agents into dynamic, context-aware systems that feel personal to every contact. Whether you're qualifying leads, booking demos, or delivering customer support, merge fields and custom values are how you save time while improving results.
Start simple: use contact.firstName and contact.email in your next agent. Once that feels natural, layer in custom fields and custom values. Within a week, you'll have workflows that handle dozens of scenarios with zero manual intervention.