You found the good link. 30 days free, not the usual 14.Claim it here
โ† Blog
Tutorialthestackinsiders.com

Run Python in GoHighLevel Workflows: Custom Code Guide

A

Ashley Kemp

12 min read ยท Updated July 2026

app.gohighlevel.com
GoHighLevel workflow builder open to the Custom Code action with Python selected as the runtime language
GoHighLevel workflow builder open to the Custom Code action with Python selected as the runtime language

Does GoHighLevel support Python in workflows?

GoHighLevel's Custom Code workflow action supports both Python and JavaScript as of June 25, 2026. Inputs from earlier workflow steps are passed via an inputData object and scripts return results by assigning a dictionary to the output variable. The Custom Code action is classified as a Premium Action.

GoHighLevel's Custom Code workflow action added Python runtime support on June 25, 2026, giving developer-focused agencies a familiar, expressive language for data manipulation, API calls, and custom scoring logic inside the automation builder. Before this update, the action was JavaScript-only. This guide explains how the action works, how inputs and outputs are structured, and provides three production-ready Python examples for common agency tasks.

EXTENDED FREE TRIAL

Start with 30 days free, not 14.

Use our partner link to get double the standard 14-day trial.

Start Your Free 30-Day Trial โ†’

What Is the GoHighLevel Custom Code Workflow Action?

The Custom Code action is a workflow step inside GoHighLevel's visual automation builder. It runs executable code at a specific point in the workflow, with read access to data from earlier steps and the ability to pass computed results to later ones.

GoHighLevel's standard workflow builder handles most automation logic through its built-in action library - contact field updates, conditionals, HTTP requests, and branching paths. The Custom Code action extends that with arbitrary logic the standard action set cannot express: field transformations, scoring computations, multi-step calculations, and calls to external APIs not covered by native integrations.

The action supports HTTP methods including GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS, according to the GoHighLevel Custom Code help documentation. GoHighLevel classifies it as a Premium Action, meaning plan-level access applies.

Until June 25, 2026, the action was JavaScript-only. The June 25 update added Python as a selectable runtime alongside JavaScript. The runtime is chosen per-action via a language dropdown in the action settings, with JavaScript remaining the default.

Does GoHighLevel Support Python in Workflow Custom Code?

GoHighLevel added Python as a supported runtime for the Custom Code workflow action on June 25, 2026. The updated help article documents both languages. When configuring the action, users select the runtime from a dropdown that now lists Python and JavaScript as options.

The addition matters for agencies whose internal tooling, data pipelines, or developer teams already work in Python. Previously, Python logic had to be rewritten in JavaScript or handled through a separate webhook handler outside GoHighLevel before it could feed into a workflow. With the native runtime, that logic runs directly inside the workflow step and its outputs are immediately available to subsequent actions.

How Do You Add Python Custom Code to a GoHighLevel Workflow?

These steps apply to any GoHighLevel account with access to the Custom Code Premium Action.

  1. Open Workflows in GoHighLevel and open or create the workflow where the custom logic belongs.
  2. Click the + button to add a new action at the correct point in the sequence.
  3. Search for Custom Code in the action library and select it.
  4. In the action settings, set the Language dropdown to Python.
  5. In the Property to Include in Code section, add each input as a key-value pair. The key becomes the variable name; the value maps from a contact field, a prior step output, a custom value, or a static string.
  6. Write the Python script in the code editor. Access inputs via inputData.keyName and assign results to the output variable as a Python dictionary.
  7. Click Test Code and run against a contact record. Testing is mandatory - outputs from the Custom Code action are only available to later steps after at least one successful test run.
  8. Save the action and continue building the workflow.

The GoHighLevel documentation marks all four configuration fields - Action Name, Language, Property to Include in Code, and Code - as mandatory.

One constraint to account for when testing: custom values are not passed during test runs, only contact information. Logic that depends on custom values should be verified in a controlled live run after the test passes.

How Do Inputs and Outputs Work in the Custom Code Action?

Inputs are configured as key-value pairs in the action settings under Property to Include in Code. Each key becomes a named attribute on the inputData object inside the script, accessible as inputData.keyName. The values can come from contact fields, prior workflow step outputs, custom values, or static strings typed directly into the input field.

Outputs work by assigning a Python dictionary to the variable output at the end of the script. Each key in that dictionary becomes an output variable available to downstream workflow steps. The GoHighLevel documentation specifies the return format as "a Python object or array of objects." A minimal example:

output = {"result": inputData.number1 + inputData.number2}

This is the pattern all three examples below follow. Map the input keys in the action settings to the relevant workflow data, write the Python logic, and reference the output keys in the next workflow action.

Three Python Custom Code Examples for GoHighLevel Agencies

These examples use the inputData and output pattern from the official GoHighLevel Custom Code documentation. Each includes the input keys to configure in the action settings and notes on how to use the outputs in subsequent steps.

Example 1: Normalize a Phone Number to E.164 Format

Inconsistent phone number formats cause failures in SMS actions, calling workflows, and third-party integrations. This script strips non-numeric characters and converts 10-digit US numbers to E.164 format before they reach any communication step.

Input keys to configure: phone mapped to the contact's phone field.

raw = inputData.phone or ""
digits = "".join(c for c in str(raw) if c.isdigit())

if len(digits) == 10:
    normalized = "+1" + digits
elif len(digits) == 11 and digits.startswith("1"):
    normalized = "+" + digits
else:
    normalized = raw  # return as-is for non-US or unrecognised formats

output = {
    "normalized_phone": normalized,
    "digit_count": len(digits),
    "is_valid": len(digits) in (10, 11)
}

How to use the outputs: map output.normalized_phone to the contact's phone field in a following Update Contact action. Use output.is_valid in an If/Else branch to route numbers that did not normalise cleanly to a manual review step.

Example 2: Call an External Enrichment API

The Custom Code action supports external HTTP requests. This example calls a third-party enrichment endpoint with the contact's email, captures company and title data from the response, and returns it as workflow variables that can populate contact fields.

Input keys to configure: email mapped to the contact email field; api_key mapped to a custom value holding the service's API key.

def enrich_contact(email, api_key):
    import urllib.request
    import json

    url = "https://api.yourservice.com/v1/enrich"
    payload = json.dumps({"email": email}).encode("utf-8")
    req = urllib.request.Request(
        url,
        data=payload,
        headers={
            "Authorization": "Bearer " + api_key,
            "Content-Type": "application/json"
        },
        method="POST"
    )
    try:
        with urllib.request.urlopen(req) as response:
            data = json.loads(response.read())
            return {
                "company_name": data.get("company", ""),
                "job_title": data.get("title", ""),
                "enrichment_status": "success"
            }
    except Exception:
        return {"company_name": "", "job_title": "", "enrichment_status": "failed"}

output = enrich_contact(
    inputData.email or "",
    inputData.api_key or ""
)

Replace api.yourservice.com/v1/enrich and the response field names with the endpoint and schema from the enrichment provider. This example uses urllib.request from the Python standard library rather than third-party packages. Map output.company_name and output.job_title to contact fields in a subsequent Update Contact step.

Example 3: Compute a Multi-Factor Lead Score

When a scoring service is not available or the qualification logic is proprietary, a rule-based score computed inside the workflow covers most qualification needs. This script takes three qualifying inputs and returns a numeric score and a boolean qualifier that the workflow can act on immediately, without any external call.

Input keys to configure: industry from a contact field or form response; team_size from a numeric contact field; monthly_budget from a form answer or custom field.

industry = (inputData.industry or "").lower()
team_size = int(inputData.team_size or 0)
budget = int(inputData.monthly_budget or 0)

score = 0

high_fit_terms = ["agency", "marketing", "consulting", "saas", "media"]
if any(term in industry for term in high_fit_terms):
    score += 40  # industry fit: +40

if team_size >= 10:
    score += 30  # large team: +30
elif team_size >= 3:
    score += 15  # small team: +15

if budget >= 1000:
    score += 30  # high budget: +30
elif budget >= 500:
    score += 15  # mid budget: +15

output = {
    "lead_score": score,
    "qualified": score >= 70,
    "score_tier": "hot" if score >= 70 else "warm" if score >= 40 else "cold"
}

How to use the outputs: add an If/Else branch after this action using output.qualified. When True, route to a high-touch immediate follow-up sequence. When False, route to a nurture track. Map output.lead_score and output.score_tier to contact custom fields so the score is visible on the contact record and available for filtering in the CRM.

Adjust the score thresholds and weight values to match the actual qualification model. The exact point totals here are illustrative; set them against real pipeline data.

What Are the Best Use Cases for Python Custom Code in GoHighLevel?

The Custom Code action is the right choice when the standard action library cannot express the logic. Four use case categories cover the majority of real agency applications.

Data transformation. Normalising field formats before they flow into communication steps - cleaning phone numbers, splitting full names into first and last fields, reformatting dates between systems, stripping special characters from form submissions. These are quick scripts that eliminate downstream failures caused by inconsistent input.

API enrichment mid-workflow. Calling a third-party data provider at a specific point in the automation and storing the enriched data directly on the contact record. This removes the need for a separate Zapier or Make step between the GHL workflow and an external service, keeping the automation in one place.

Custom scoring and routing. Building a qualification model from form answers, CRM field values, or webhook payloads and using the computed score to split the contact into the right sequence immediately. The GoHighLevel workflow recipes guide covers pre-built workflow patterns that do not require code; Custom Code becomes the choice when those patterns do not fit the scoring criteria.

Text extraction and conditional formatting. Pulling a specific substring from a free-form text response, constructing personalised message variables by combining fields with custom logic, or cleaning AI-generated content before it flows into another action.

FREE TRIAL

Get 30 Days Free With Our Partner Link

  • โœ“Full access for 30 days
  • โœ“No charge during the trial
  • โœ“Cancel any time
Start Your Free 30-Day Trial โ†’
No charge for 30 days

Join 2.2 million businesses already running on GoHighLevel

What Plan Is Required for the Custom Code Action?

The GoHighLevel documentation classifies the Custom Code action as a Premium Action. GoHighLevel's current plan structure runs from $97 Starter through $297 Unlimited to $497 Agency Pro (previously SaaS Pro). The exact plan tier that unlocks Premium Actions should be confirmed against the workflow builder directly - actions outside the current plan appear greyed out or marked in the action library.

How Does the AI Code Generation Feature Work With Custom Code?

GoHighLevel includes a Code with AI tool inside the Custom Code action, currently available as a Beta feature. Users describe the desired logic in plain English and the system generates a code block for the selected runtime. According to the AI code generation help article, the generator automatically maps input properties from previous workflow steps into the generated code.

Documented use cases for the AI generator include data formatting, API call scaffolding, mathematical calculations, string manipulation, and conditional routing. The generated code should be reviewed and tested against a real contact before deploying it in a live workflow, as the documentation advises.

The AI generator and the manual editor serve different purposes. For one-off tasks and unfamiliar API patterns the generator accelerates the first draft; for proprietary scoring logic and business-specific rules, writing directly in the editor gives full control over the output.

Frequently Asked Questions

Does GoHighLevel support Python in workflow actions?
Yes. GoHighLevel added Python as a supported runtime for the Custom Code workflow action on June 25, 2026. Users select Python or JavaScript from a language dropdown in the action settings. JavaScript remains the default selection.
How do you pass data into a GoHighLevel Custom Code action?
Inputs are configured as key-value pairs in the Property to Include in Code field. Each key becomes an attribute on the inputData object accessible in the script as inputData.keyName. Values can come from contact fields, custom values, or outputs from earlier workflow steps.
How does the Custom Code action return data to the rest of the workflow?
The script assigns a dictionary to the output variable - for example, output = {'result': value}. Each key in that dictionary is then available as an output variable in downstream workflow steps. At least one successful test run is required before those outputs can be referenced.
Can GoHighLevel Custom Code make external API calls?
Yes. The Custom Code action supports external HTTP requests including GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS methods, per the GoHighLevel documentation. This supports mid-workflow enrichment calls, scoring API requests, and external webhook triggers.
What plan is required to use the Custom Code action in GoHighLevel?
GoHighLevel classifies Custom Code as a Premium Action. The exact plan tier that includes Premium Actions should be confirmed against the workflow action library in the account, as plan inclusions can change. GoHighLevel's current plans run from $97 Starter to $297 Unlimited to $497 Agency Pro.

GoHighLevel's Custom Code action with Python support removes a meaningful constraint for developer-led agencies: the ability to run real scripting logic at any point in an automation, with direct access to workflow data in and verified outputs out. For teams building on GoHighLevel's automation engine, Python custom code covers the gap between what the standard action library handles and what the business actually needs.

The 30-day extended free trial through the link below gives full access to the workflow builder, including Premium Actions, to test whether Custom Code fits the current automation stack.

EXTENDED FREE TRIAL

Start with 30 days free, not 14.

Use our partner link to get double the standard 14-day trial.

Start Your Free 30-Day Trial โ†’
A

Ashley Kemp

Ashley Kemp is a digital entrepreneur and perpetual traveller. Switched from ClickFunnels to GoHighLevel years ago and never looked back. Writing about what actually works.

Was this article helpful?

Share this post:
Claim 30-Day Free Trial