GoHighLevel Custom Code AI Guide

GoHighLevel Custom Code AI Workflow Action Guide

ClickUp users who also manage automation in GoHighLevel can unlock powerful data transformations using the Custom Code AI action. This guide walks you step by step through enabling, configuring, and using Custom Code AI inside workflows so you can safely process JSON, format text, and enrich your automations with OpenAI.

What Is the GoHighLevel Custom Code AI Action?

The Custom Code AI workflow action in GoHighLevel lets you write small JavaScript snippets that run on a secure server. You can combine your own logic with OpenAI to transform data, clean text, and prepare information for later workflow steps.

This action is designed for technical and non-technical users who need more flexibility than standard workflow actions provide. By passing inputs and reading outputs, you can create smart, reusable automation blocks.

Requirements Before Using GoHighLevel Custom Code AI

Before adding the Custom Code AI action to a workflow, confirm the following:

  • You have access to Workflows in GoHighLevel.
  • You are on a plan that includes AI features and OpenAI usage.
  • You understand basic JavaScript syntax (variables, arrays, objects).
  • You know which contact, opportunity, or custom fields you want to use as inputs.

Once these are in place, you can begin configuring the action safely.

How to Add the Custom Code AI Action in GoHighLevel

Follow these steps to place the action inside a workflow:

  1. Open your GoHighLevel account and navigate to Automations > Workflows.
  2. Either create a new workflow or edit an existing one.
  3. Click the plus icon (+) to add a new action where you want the code to run.
  4. Search for and select Custom Code AI.
  5. Name the action clearly so you recognize its purpose later (for example, “Parse JSON from Webhook”).

After you add the action, you will see sections for inputs, code, and outputs.

Configuring Inputs for GoHighLevel Custom Code AI

Inputs define which values your JavaScript code can use. You can pass in fields, variables, or static text from the workflow.

Types of Inputs You Can Use in GoHighLevel

Within the Custom Code AI action, you can reference:

  • Contact fields (name, email, phone, etc.).
  • Opportunity and pipeline data.
  • Form or survey submissions.
  • Webhook payloads and other workflow variables.
  • Static strings you type directly into the action.

Each input is accessible via a JavaScript object provided by the platform (commonly called inputs). The exact property names are based on how you map your data in the configuration panel.

Best Practices for Defining Inputs in GoHighLevel

  • Use descriptive keys like fullName, jsonPayload, or rawMessage.
  • Test with sample data before running the workflow on real contacts.
  • Validate assumptions (for example, ensure a field is not empty before parsing).

Writing JavaScript in the GoHighLevel Custom Code AI Block

The core of this feature is a JavaScript editor that runs server-side. The code you write receives your defined inputs and must return an object containing outputs you plan to use in later workflow steps.

Basic Structure of Custom Code in GoHighLevel

A typical script in the Custom Code AI action looks like this:

  • Read values from the inputs object.
  • Optionally call OpenAI (through the predefined helpers provided in the editor).
  • Transform or format the data.
  • Return an object that exposes the final values.

For example, you might:

  • Parse JSON: const data = JSON.parse(inputs.jsonPayload);
  • Split text: const parts = inputs.rawMessage.split("|");
  • Format dates or numbers using core JavaScript methods.

The platform will capture whatever you return and make it available as outputs.

Using OpenAI Inside GoHighLevel Custom Code AI

The Custom Code AI action also lets you leverage OpenAI for text-related tasks, such as:

  • Summarizing long form submissions.
  • Classifying messages (lead type, intent, sentiment).
  • Extracting entities (names, locations, budget values) from free text.
  • Rewriting messages into a specific tone or format.

To use OpenAI, you typically call a provided helper function from within your JavaScript block, pass a prompt and relevant context, then process the returned text. The exact syntax may vary, so refer to the official documentation at this GoHighLevel Custom Code AI article for the most current examples.

Defining Outputs in GoHighLevel Custom Code AI

Outputs are the values produced by your script and used later in the workflow. These might become contact fields, notes, task descriptions, or conditions for branching logic.

How Outputs Work in GoHighLevel

At the end of your code, you must return an object. Each property in that object becomes an output variable. For example:

return {
  firstName: data.first_name,
  isQualified: score >= 70,
  summary: aiSummary
};

After this, you can reference firstName, isQualified, and summary in downstream workflow actions such as:

  • Conditional splits.
  • Setting custom fields.
  • Sending emails or SMS with personalized text.
  • Creating internal notifications for your team.

Common Output Use Cases in GoHighLevel

  • Parsed JSON values: Turn raw webhook data into clean fields.
  • AI-generated summaries: Store concise notes on a contact record.
  • Score or flags: Mark leads as qualified, unqualified, or needing review.
  • Formatted values: Output standardized dates, phone numbers, or tags.

Example Use Cases for GoHighLevel Custom Code AI

Here are sample scenarios where the Custom Code AI action shines:

  • Webhook Parsing: Receive a JSON payload from an external tool, parse it in JavaScript, and map specific fields to contact records.
  • Message Cleanup: Take a long message, remove special characters, and create a clean version for storage or display.
  • AI Lead Qualification: Send the lead’s message and form responses to OpenAI and return a qualification score plus a short summary.
  • Tagging Based on Keywords: Inspect text for certain phrases and return a list of tags to apply in subsequent actions.

Testing and Troubleshooting GoHighLevel Custom Code AI

Testing is essential for reliable automation. Use these steps to validate your configuration:

  1. Run the workflow on a test contact with known data.
  2. Check any debug or log output provided by the Custom Code AI action.
  3. Confirm that outputs appear as expected in later workflow steps.
  4. Handle potential errors in your code using simple checks and try/catch blocks when appropriate.

If you encounter issues, review the official GoHighLevel Custom Code AI documentation to verify syntax and limitations.

Best Practices for Managing GoHighLevel Custom Code AI

To keep your automations maintainable and safe, follow these recommendations:

  • Keep scripts small: Focus each Custom Code AI action on a single responsibility.
  • Document logic: Add comments in your script explaining inputs, outputs, and any OpenAI prompts.
  • Version your workflows: Clone workflows before making major code changes so you can roll back if needed.
  • Monitor AI usage: Track OpenAI calls to avoid unexpected consumption.

Scaling Your Automation Strategy Beyond GoHighLevel

As your automation needs expand, you may want help designing advanced workflows that connect multiple systems. Agencies and consultants experienced with GoHighLevel can help you architect scalable solutions, integrate external apps, and standardize your JavaScript patterns.

For strategic consulting, workflow audits, and implementation services, you can explore partners such as Consultevo, which focuses on operations, automation, and data-driven optimization.

Conclusion: Mastering Custom Code AI in GoHighLevel

The Custom Code AI action in GoHighLevel gives you the flexibility to parse JSON, shape data, and integrate OpenAI directly into your workflows. By defining clear inputs and outputs, writing focused JavaScript, and testing thoroughly, you can build powerful automations that go far beyond standard actions.

Use this guide as a foundation, refer back to the official documentation when needed, and iterate on your scripts as your business and automation strategy evolve.

Need Help With ClickUp?

If you want expert help building, automating, or scaling your GHL , work with ConsultEvo — trusted GoHighLevel Partners.

Scale GoHighLevel

“`