# GoHighLevel

## Prerequisites

Before using GoHighLevel components in Appmixer, you need:

1. A GoHighLevel account with at least one **Sub-Account** (location)
2. A **Private Integration Token** created from within that Sub-Account
3. A **Pipeline** (required for Opportunity components)
4. A **Calendar** (required for Appointment components)

***

### 1. Create a GoHighLevel account

Sign up at <https://www.gohighlevel.com> or <https://app.gohighlevel.com>.

After signing up, you will land in the **Agency View**. This is the top-level account — it does not hold contacts, opportunities, or calendars directly. All data lives inside **Sub-Accounts** (formerly called Locations).

### 2. Create a Sub-Account

From the Agency View, go to **Sub-Accounts** in the left menu and click **+ New Sub-Account**. Fill in the basic info (name, etc.) and save.

Once created, click into the Sub-Account. The URL will look like:

```
https://app.gohighlevel.com/location/<LOCATION_ID>/dashboard
```

Copy the `<LOCATION_ID>` — you will need it when connecting GoHighLevel in Appmixer.

> **Important:** The Location ID is the Sub-Account identifier. All API calls require it to know which Sub-Account to operate on.

### 3. Create a Private Integration Token

Navigate to your Sub-Account (not Agency) settings:

**Settings → Private Integrations → + Create New**

1. Give it a name (e.g. "Appmixer Integration")
2. Enable **all required scopes** — at minimum:
   * Contacts (read/write)
   * Opportunities (read/write)
   * Calendars (read/write)
   * Locations (read)
3. Click **Create** and copy the generated token (starts with `pit-...`)

> **Important:** The token must be created from **within the Sub-Account**, not from the Agency level. Agency-level tokens will not work for Sub-Account data.

### 4. Connect in Appmixer

When adding a GoHighLevel component in Appmixer, you will be prompted to authenticate. Provide:

| Field                         | Value                           |
| ----------------------------- | ------------------------------- |
| **Private Integration Token** | The `pit-...` token from Step 3 |
| **Location ID**               | The Sub-Account ID from Step 2  |

### 5. Create a Pipeline (for Opportunity components)

GoHighLevel Opportunity components (`CreateOpportunity`, `FindOpportunities`, `UpdateOpportunity`) require at least one Pipeline to exist in your Sub-Account.

To create a Pipeline:

1. Go to your Sub-Account in GoHighLevel
2. Navigate to **CRM → Pipelines** (or **Opportunities → Pipelines**)
3. Click **+ Add Pipeline**
4. Add at least one stage (e.g. "New Lead", "Contacted", "Closed")
5. Save

Once created, the Pipeline will appear in the **Pipeline** dropdown when configuring Opportunity components in Appmixer.

### 6. Create a Calendar (for Appointment components)

The `CreateAppointment` component requires a Calendar. To create one:

1. Go to your Sub-Account in GoHighLevel
2. Navigate to **Calendars**
3. Click **+ New Calendar** and select the calendar type (e.g. "Event")
4. Configure basic settings and save

The Calendar will appear in the **Calendar** dropdown when configuring Appointment components in Appmixer.

***

## Available Components

| Component             | Description                                    |
| --------------------- | ---------------------------------------------- |
| **CreateContact**     | Create a new contact in GoHighLevel            |
| **GetContact**        | Retrieve a contact by ID                       |
| **FindContacts**      | Search contacts by query, email, phone, etc.   |
| **UpdateContact**     | Update an existing contact                     |
| **DeleteContact**     | Delete a contact by ID                         |
| **CreateOpportunity** | Create a new opportunity in a pipeline         |
| **FindOpportunities** | Search opportunities by pipeline, status, etc. |
| **UpdateOpportunity** | Update an existing opportunity                 |
| **CreateAppointment** | Create a new appointment/event                 |
| **ListPipelines**     | List all pipelines (used as dropdown source)   |
| **ListCalendars**     | List all calendars (used as dropdown source)   |

## Troubleshooting

### "The token is not authorized for this scope"

The Private Integration Token does not have the required permissions. Go to **Settings → Private Integrations**, edit your integration, and enable the necessary scopes.

### "Auth source is not valid"

You are using an Agency-level token instead of a Sub-Account token. Delete the token and create a new one from **within the Sub-Account** settings.

### Empty Pipeline / Calendar dropdowns

You need to create at least one Pipeline or Calendar in GoHighLevel before they appear in the Appmixer component dropdowns. See Steps 5 and 6 above.

### "locationId can't be undefined"

The Location ID is missing or incorrect. Make sure you copied it from the Sub-Account URL and provided it during authentication.
