# Sending Lead Data to GHL

### ✅ Goal:

Send lead data (e.g., name, email, phone) from **Agent Supply** (via an Agent or Form) to **GoHighLevel (GHL)**, so it appears as a Contact or triggers a Workflow in GHL.

***

### 🔧 Step-by-Step: Send Lead Data from **Agent Supply** to **GoHighLevel**

***

#### **Step 1: Prepare Your GoHighLevel Webhook URL**

1. **Log in to your GoHighLevel account**.
2. Navigate to:
   * **Settings** > **Company Settings** > **API Keys** → *Copy your API key*.
3. To trigger a workflow via webhook:
   * Go to **Workflows**.
   * Click **+ Create Workflow** → choose **Start from Scratch**.
   * Add a **Webhook Trigger**.
   * Copy the **Webhook URL** generated — you'll need this in Agent Supply.

***

#### **Step 2: Go to Your Agent in Agent Supply**

1. In **Agent Supply**, open the **Agent** (bot) where you’re capturing leads.
2. Insert a **"Send Webhook"** action after the data is collected (e.g., after a form or dialogue).
3. Paste the **GoHighLevel Webhook URL** into the webhook step.

***

#### **Step 3: Format the Payload Correctly for GHL**

Use this JSON structure in the webhook action:

```json
jsonCopiarEditar{
  "firstName": "{{lead.firstName}}",
  "lastName": "{{lead.lastName}}",
  "email": "{{lead.email}}",
  "phone": "{{lead.phone}}",
  "source": "AgentSupplyBot",
  "customField": "value"
}
```

> Replace variables with the fields your **Agent Supply agent** collects.

***

#### **Step 4: Test the Webhook from Agent Supply**

1. In Agent Supply, use the **“Test Webhook”** feature with sample data.
2. Go to GoHighLevel:
   * Check **Contacts** to confirm receipt of the lead.
   * If you’re triggering a workflow, go to **Workflow → History** to see if the trigger fired.

***

#### **Step 5: Optional – Use the GHL API for Direct Integration**

If you want to **skip the GHL webhook trigger** and directly create a contact, use an **API call** in Agent Supply:

**Endpoint**:

```
bashCopiarEditarhttps://rest.gohighlevel.com/v1/contacts/
```

**Headers**:

```json
jsonCopiarEditar{
  "Authorization": "Bearer YOUR_API_KEY",
  "Content-Type": "application/json"
}
```

**Body**:

```json
jsonCopiarEditar{
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@example.com",
  "phone": "+1234567890",
  "locationId": "YOUR_LOCATION_ID",
  "customField": "value"
}
```

In Agent Supply:

* Use the **API Call** block.
* Set method to **POST**, enter the URL, headers, and body.
* Make sure your data variables (e.g., `{{lead.email}}`) are correctly mapped.

***

### 🧠 Pro Tips

* Use **Test Mode** in GoHighLevel to verify the trigger and payload.
* Validate emails and phone numbers in Agent Supply before sending.
* Use **custom fields** in GHL to capture additional info like UTM tags, lead source, etc.
* You can chain multiple actions in Agent Supply: e.g., save to Airtable + send to GHL.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentsupply.ai/ai-features/leads-legacy/sending-lead-data-to-ghl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
