# GoHighLevel (GHL)

Already using GoHighLevel (GHL) to manage your business? This integration lets you add DM Champ's AI-powered messaging on top of your existing GHL setup. Messages that come into GHL are forwarded to DM Champ for AI-powered handling, and replies from DM Champ are sent back through GHL to the customer on the original channel.

This means you can keep using GHL as your main hub while letting DM Champ handle the AI-driven conversations.

> **Note:** This is a more technical integration that involves setting up automated workflows and connecting systems using webhooks (automatic notifications between apps) and API calls (automated data requests). If you are not comfortable with this, you may want to hand this page to a developer or tech-savvy team member.

***

## Prerequisites

* An active **DM Champ account** with your API key (found in **Settings > Account**). An API key is a unique code that lets GHL securely communicate with your DM Champ account.
* A **GoHighLevel account** with permission to create workflows and manage webhooks (automated notifications between systems).

***

## How It Works

| Direction           | What Happens                                                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **GHL to DM Champ** | A customer messages you on SMS, email, Messenger, Instagram, or live chat in GHL. A workflow automatically forwards that message to DM Champ. DM Champ processes it (AI response, tagging, etc.). |
| **DM Champ to GHL** | When DM Champ sends a reply (manually or via AI), it automatically notifies GHL. A workflow in GHL finds the contact and sends the reply through the correct channel.                             |

***

## Workflow 1: GHL to DM Champ

This workflow forwards incoming messages from GHL to DM Champ.

### Step 1: Create the Workflow

1. In GHL, go to **Automation > Workflows**.
2. Click **Create New Workflow**.
3. Name it something descriptive, such as "Send Message to DM Champ."

### Step 2: Add Triggers

Add a trigger for each channel you want to forward:

* Customer Replied - SMS
* Customer Replied - Email
* Customer Replied - Facebook Message
* Customer Replied - Instagram DM
* Customer Replied - Live Chat

You can add all of them or only the channels relevant to your setup.

### Step 3: Add Tag Filter (Optional)

If you only want to forward messages from specific contacts:

1. Click **Add Filter** on the trigger.
2. Set the condition to "Contact has tag."
3. Choose your tag(s).
4. Select whether the contact should have **any** or **all** of the selected tags.

### Step 4: Create a Channel Split

Add a **Condition** action to route each channel to its own webhook:

| Branch   | Condition                         |
| -------- | --------------------------------- |
| Branch 1 | Message source equals `Email`     |
| Branch 2 | Message source equals `SMS`       |
| Branch 3 | Message source equals `Messenger` |
| Branch 4 | Message source equals `Instagram` |
| Branch 5 | Message source equals `Live Chat` |

### Step 5: Configure Webhooks

For each branch, add a **Webhook / HTTP Request** action:

* **Method:** `POST`
* **URL:**

  ```
  https://api.dmchamp.com/v1/incoming_custom_channel_message?apiKey=YOUR_API_KEY
  ```
* **Custom Data fields:**

| Field         | Value                                | Notes                     |
| ------------- | ------------------------------------ | ------------------------- |
| `messageSid`  | `{{right_now.second}}{{contact.id}}` | Unique message identifier |
| `fromId`      | `{{contact.id}}`                     | GHL contact ID            |
| `toId`        | `{{user.id}}`                        | Your GHL user ID          |
| `body`        | `{{message.body}}`                   | The message content       |
| `channel`     | See table below                      | Must match the branch     |
| `status`      | `created`                            | Always set to `created`   |
| `messageType` | `text`                               | Message type              |

**Channel values per branch:**

| Branch    | `channel` value |
| --------- | --------------- |
| Email     | `email`         |
| SMS       | `sms`           |
| Messenger | `messenger`     |
| Instagram | `ig`            |
| Live Chat | `livechat`      |

> **Important:** Make sure the `channel` value matches exactly - these are case-sensitive.

### Step 6: Enable Re-Entry

In the workflow settings, make sure **Allow Re-entry** is enabled. Without this, only the first message from each contact will be forwarded.

***

## Workflow 2: DM Champ to GHL

This workflow receives replies from DM Champ and sends them to the customer through the correct GHL channel.

### Step 1: Create an Inbound Webhook in GHL

1. In GHL, go to **Settings > Developers / API**.
2. Click **Create New Webhook** (or "Inbound Webhook").
3. Name it "DM Champ Messages."
4. Save and **copy the webhook URL** - you will need it in the next step.

### Step 2: Configure DM Champ

1. In DM Champ, go to **Settings > Account**.
2. Find the **Webhook URL** field.
3. Paste the GHL inbound webhook URL you just copied.
4. Click **Save**.

DM Champ will now automatically send a notification to GHL every time a message is sent to a contact. The data sent looks like this:

```json
{
  "contactId": "NtL97bwnhITrfIq8lWFi",
  "messageId": "s28dtg13qNuhXLoKpcLs",
  "userId": "wpDZRvaw4Hgh4whUBpwlKPRftOi2",
  "body": "Message content here",
  "toId": "qtpBsc6fiqkXTnSOeze3",
  "channel": "email"
}
```

### Step 3: Create the Response Workflow

1. In GHL, go to **Automation > Workflows**.
2. Create a new workflow named "Send DM Champ Message to Contact."
3. Set the trigger to **Inbound Webhook** and select the webhook you created in Step 1.

### Step 4: Add a Find Contact Action

1. Add a **Find Contact** action.
2. Set the search field to **Contact ID**.
3. Use the value: `{{inboundWebhookRequest.toId}}`

### Step 5: Add an Optional Tag Check

If you want to limit which contacts receive messages from DM Champ:

1. Add a **Condition** action.
2. Check if the contact has a specific tag.
3. If the tag is missing, end the workflow (add a "Stop" action on the false branch).

### Step 6: Add a Channel Split

Add a **Condition** action that routes the message based on `{{inboundWebhookRequest.channel}}`:

| Branch   | Condition          | Action                 |
| -------- | ------------------ | ---------------------- |
| Branch 1 | equals `email`     | Send Email             |
| Branch 2 | equals `sms`       | Send SMS               |
| Branch 3 | equals `messenger` | Send Facebook Message  |
| Branch 4 | equals `ig`        | Send Instagram Message |
| Branch 5 | equals `livechat`  | Send Chat Message      |

### Step 7: Configure Each Send Action

In each send action, set the message body to:

```
{{inboundWebhookRequest.body}}
```

### Step 8: Enable Re-Entry

As with Workflow 1, make sure **Allow Re-entry** is enabled in the workflow settings.

***

## Testing the Integration

### Test GHL to DM Champ (Workflow 1)

1. Send a message to your GHL number or connected channel (for example, send yourself an SMS).
2. Open DM Champ and verify the message appears in your inbox.
3. Check that the channel label is correct (SMS, email, etc.).
4. Repeat for each channel you configured.

### Test DM Champ to GHL (Workflow 2)

1. In DM Champ, send a reply to a contact (manually or let the AI respond).
2. Open GHL and verify the contact received the message.
3. Confirm it was sent through the correct channel.
4. Check that the message content matches.

***

## Troubleshooting

| Problem                         | What to Check                                                                                                                                          |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Messages not reaching DM Champ  | Verify your API key is correct in the webhook URL. Check that the workflow triggers are firing (GHL workflow logs). Confirm Allow Re-entry is enabled. |
| Messages not reaching GHL       | Verify the webhook URL is correctly pasted in DM Champ settings. Check the GHL inbound webhook is active. Review the GHL workflow execution logs.      |
| Contact not found in GHL        | The `toId` in the webhook data must match an existing GHL contact ID. Make sure contacts exist in both systems with matching IDs.                      |
| Wrong channel used for reply    | Double-check the channel values in your condition branches. They must match exactly: `email`, `sms`, `messenger`, `ig`, `livechat`.                    |
| Only first message is forwarded | Enable **Allow Re-entry** in both workflow settings.                                                                                                   |

***

## Next Steps

* [Webhooks](https://help.dmchamp.com/integrations/webhooks) - Set up webhooks for other DM Champ events.
* [API Access](https://help.dmchamp.com/integrations/api-access) - Use the DM Champ API for custom integrations beyond GHL.
* [Custom Channels](https://help.dmchamp.com/messaging-channels/custom-channels) - Learn more about custom channel messaging.
