# GoHighLevel (GHL) (Custom Webhook)

Integrating an AI Agent with your client's GHL account is one of the most powerful ways to get up and running really quickly.&#x20;

This is useful because you can utilize the existing communication channels that the client has already setup and use GHL's automation builder to create unique scenarios where an A.I. Agent can take over the conversation.&#x20;

{% embed url="<https://youtu.be/sYf8nEdCPwQ>" %}

{% embed url="<https://www.youtube.com/watch?v=BEo-eTYZ2Cw>" %}

Here are the steps to integrating A.I. with GHL:

## 1. Create a new workflow in GHL

<figure><img src="/files/D1589wSpwK0851oj2Ruz" alt=""><figcaption></figcaption></figure>

After naming and saving this new workflow, go into the Settings tab.&#x20;

Turn on the option for "Allow re-entry" and click Save.

<figure><img src="/files/ptkHFwUyIxXsdyXaYbOz" alt=""><figcaption></figcaption></figure>

## 2. Add a New Trigger

Customer Replied - Select the reply channel you want the A.I. Agent to be on. In this example we are using Facebook Messenger.

<figure><img src="/files/EnAXZfchgn5b29GvEc4g" alt=""><figcaption></figcaption></figure>

## 3. Add First Action Step - Custom Webhook

Select the option "Custom Webhook"

<figure><img src="/files/43x6UZJ2LlNhZZbL1uPZ" alt=""><figcaption></figcaption></figure>

## 4. Change Event Type to POST

Under the option "EVENT", click the dropdown menu and select "POST". The structure of the window should change to look like the image below.

<figure><img src="/files/knuFW78PiSR9R1xVHyql" alt=""><figcaption></figcaption></figure>

## 5. Copy/Paste Your URL (API Endpoint)

Inside your white labeled version of the Stammer dashboard, navigate to your white label API documentation.

Dashboard > Account > API > Explore API Documentation > Message Chatbot

(It will say your agency's name instead of "SR Chatbot")

Copy your URL (under API Endpoint) into your clipboard.

<figure><img src="/files/SB459ixRdizj2z5JsVs4" alt=""><figcaption></figcaption></figure>

## 6. Paste URL in GHL

Paste your url into GHL - it should look like this but instead of saying app.srchatbot.com, it will say your custom domain.

<figure><img src="/files/uYoHjGgITd0ml0WAHDFb" alt=""><figcaption></figcaption></figure>

## 7. Add Item to Headers

Click the "Add Item" button under Headers.&#x20;

Two new boxes will appear, Key and Value.

Key = Type in the word "Authorization"

Value = Type in the word "Token"

<figure><img src="/files/vwLVhStNX29kRDPpsMfM" alt=""><figcaption></figcaption></figure>

## 8. Copy API Token

Dashboard > Account > API > API Token > Copy Button

This will copy your private API Token to your clipboard.

Keep this value private. You can always re-generate this token, but if you do you must update any automations using the token.

<figure><img src="/files/u8SXJo2iTMtj4RwH9Ntl" alt=""><figcaption></figcaption></figure>

## 9. Paste in API Token

Inside GHL after the word "Token", paste in your API Token.&#x20;

Be sure there is a single space between the word "Token" and your API Token.&#x20;

Example: Token 2345wgj3894v3g49g8

<figure><img src="/files/lBlEIyF64DcnBo3PwNHG" alt=""><figcaption></figcaption></figure>

## 10. Add 3 Items to Body

Under the header "Body (Key and Value)" click "Add Item" 3 times.

This will add 3 new rows. In each row there will be two new boxes, Key and Value.

* In the first row under Key type in "chatbot\_uuid"
  * This is the unique identifier for the A.I. Agent you want to connect to.
* In the second row under Key type in "query"
  * This is the message sent from the user that the A.I. Agent will respond to.
* In the third row under Key type in "user\_key"
  * This is the unique identifier for each user so the A.I Agent knows who it's talking to.

<figure><img src="/files/g5F8so6t4oaMQKzQHzvo" alt=""><figcaption></figcaption></figure>

## 11. Adding chatbot\_uuid

This is the unique identifier for the A.I. Agent you want to connect to.

Inside your white labeled version of Stammer go to the dashboard of the chatbot and in the right hand side dropdown menus there is an option called "Chatbot UUID".

Open ChatBot UUID and copy the value.

<figure><img src="/files/8wODyda178e9i44rVT19" alt=""><figcaption></figcaption></figure>

Paste the Chatbot UUID into the corresponding Value box.&#x20;

It should now look similar to the image below.

<figure><img src="/files/VnEW0HpenQF3Ybm6YPAj" alt=""><figcaption></figcaption></figure>

## 12. Adding Query

This will be a custom value from GHL that pulls in the user's message dynamically.&#x20;

{{message.body}}

<figure><img src="/files/O2AON8dsjW5vZIaD600Y" alt=""><figcaption></figcaption></figure>

For establishing the connection with the A.I. Agent we need to add in a test message/ query.&#x20;

\*For this first establishing replace {{message.body}} with a sample message like "Hey there". We will be utilizing this further in Step 15.&#x20;

<figure><img src="/files/XHZDx8QM7Lj6mNcsJcEP" alt=""><figcaption></figcaption></figure>

## 13. Adding User Key

This is the unique identifier for each user so the A.I Agent knows who it's talking to.

This is also a custom value from GHL that will show a unique value for each contact (even if you don't have their email or phone number).&#x20;

{{contact.id}}

<figure><img src="/files/AzJVvS3XS9p1QzSKY7Sx" alt=""><figcaption></figcaption></figure>

## 14. Establishing Connection with A.I.

After adding in all of the information we need to establish a connection with this GHL workflow and your A.I. agent inside your white labeled version of Stammer.

1. Click the checkbox next to "Save response from this Webhook"
2. Search for any contact (I like to add myself as a contact and then search for myself)
3. Select a contact by clicking the checkbox next to a name
4. Click "Send Test Request"

<figure><img src="/files/4NPBE3Ha9u0RzKyAHAnG" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/uXt4JKBDiB4Ue4SxCqpP" alt=""><figcaption></figcaption></figure>

## 15. Saving the Connection

If everything works correctly you should see a "Green Status 200" Banner.

This means you have a successful connection with your A.I. Agent.&#x20;

In this example, the test message we sent to the A.I. Agent was "Hey there".

In the image below you can see the A.I. agent's response under Answer which reads "Hello! How can I assist you today?"

You can now click the blue button "Save Action".

Now click the blue button "Save" to save your work on this entire workflow in GHL.

<figure><img src="/files/kRwUl3oYMXoL6Gj1sxz1" alt=""><figcaption></figcaption></figure>

&#x20;After saving, click back into the custom webhook action.&#x20;

We need to change the value of Query to go form "Hey there" to {{message.body}}.

Then click Save Action.

<figure><img src="/files/t7OVHr4e3MCDldlYYh1j" alt=""><figcaption></figcaption></figure>

## 16. Adding the Final Step

Now that we've established the connection between GHL and the A.I. Agent in your white labeled version of Stammer, we need GHL to send the response to the user.&#x20;

Click the plus button in the workflow builder.

<figure><img src="/files/9OFm5R5rxHnf3spPWuDJ" alt=""><figcaption></figcaption></figure>

Seach for the channel you want to respond back to. In this tutorial we are using Facebook Messenger so I am selecting Messenger.&#x20;

You can select whichever channel you want to respond to, just make sure it matches with the channel you setup the trigger with at the start of this workflow.

<figure><img src="/files/L3NCv8vz1DsigsoHYFgk" alt=""><figcaption></figcaption></figure>

The message from the A.I. agent will be different every time.&#x20;

So we need to select the value from the dropdown in custom values which should look similar to the image below.&#x20;

Custom Values > Custom Webhook > (Name of your First Action Step) > Response > Data > Answer

<figure><img src="/files/lZmmhOIefXbfifKO7YVv" alt=""><figcaption></figcaption></figure>

Click Save Action.

Save the workflow.

Publish the workflow so it's live.&#x20;

## 17. Testing Live

That's it! You're done. You can now test the A.I. Agent live on the channel you setup.&#x20;

***

Want to know how to send collected information to GHL?

{% content-ref url="/pages/f0k8Qfa8GYwTwdjbjs9o" %}
[Sending Lead Data to GHL](/stammer.ai-docs/chat-ai-agents/leads-legacy/sending-lead-data-to-ghl.md)
{% endcontent-ref %}


---

# 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.stammer.ai/stammer.ai-docs/chat-ai-agents/integrations/gohighlevel-ghl-custom-webhook.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.
