> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refold.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Connect to your HighLevel app for OAuth.

To setup your HighLevel app in Refold for OAuth, you will need the following credentials from your [HighLevel Marketplace account](https://marketplace.gohighlevel.com/):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. Highlevel Marketplace account. You can create one [here](https://marketplace.gohighlevel.com/signup).

### Required Settings

* **Mandatory Scopes**

1. oauth.readonly
2. oauth.write

<Info>If you haven't already created an app in HighLevel, you'd need to create one.</Info>

### Creating an app in HighLevel

To create a HighLevel app and acquire the above mentioned credentials, please follow the steps mentioned below:

1. Log in to your [HighLevel Marketplace account](https://marketplace.gohighlevel.com/).
2. Click on the `My Apps` tab in the top nav bar and click on `+ Create App` button.

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_navigation.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=643791951d8641704bf2a04b8d79f893" alt="Navigation for App setup" data-path="images/highlevel/ghl_navigation.png" />

3. Enter the `App Name`, choose `App Type` as **Private**, check **Agency** and **Sub-account** in `Distribution type`, choose **White-label** under `Listing Type` and click on **Create App**.
4. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `High Level` > `Settings` > `Use your credentials` > `Callback Url` > Copy it.
5. Go to `Settings` in the left menu, scroll down to **Redirect URLs** and paste the copied Callback Url, click on `+ Add` and click on the `Save` button.
6. Select the **mandatory scopes** in the **Scopes** section, as provided in your Refold HighLevel settings page and click on the `Save` button.

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_config.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=87ce609b9f2504dec75508f15a2ef289" alt="Setting up High Level Developer app" data-path="images/highlevel/ghl_config.png" />

7. Scroll down to the **Client Keys** section in `Settings`, click on `+ Add` button and give it a **Name**. Copy the **Client ID** and **Client Secret** displayed.
   <Note>Copy the Credentials now as the Client Secret will not be visible again.</Note>

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_credentials.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=c37ebe0fdda69317fb1fe6c28988872b" alt="Getting Credentials" data-path="images/highlevel/ghl_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth 2.0` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_cobalt.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=001b56e73939ae8b51d10b75dec58382" alt="Setting up application client credentials" data-path="images/highlevel/ghl_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets **mandatory scopes** which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_scopes.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=232d4e90fec14641750caef3519c37a1" alt="OAuth Scopes" data-path="images/highlevel/ghl_scopes.png" />

Once the scopes has been added to the application in Refold, go to your [HighLevel Marketplace account](https://marketplace.gohighlevel.com/) and update the scopes as added on Refold.

Select the OAuth App created for Refold > Click on `Settings` in side menu > Add the scopes as added in Refold under **Scopes** section > Click on `Save`.

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform. And, the scopes selected here are
  identical to the ones selected in the platform.
</Warning>

#### HighLevel Single Webhook URL

<Info>
  To get the User Events through Webhooks in High Level, the OAuth app needs to be submitted for review and published.
</Info>

If you wish to create an orchestration where a workflow is being triggered when some operation occurs in High Level, you'd need to subscribe to High Level's Webhook. Refold provides
a single webhook URL to manage such event triggers for all your customers.

**To setup High Level webhook subscription:**

1. Select High Level from the application list in **Refold**, and select `Settings`.
2. Copy the `Single Webhook Url`
3. Go to `My Apps` > Choose your OAuth app > `Settings` > `Webhooks`.
4. Subscribe to the events for which you want to configure the Webhooks.
   <Note>Webhook Events will be disabled in High Level app if the appropriate scopes are not added to the OAuth app.</Note>
5. Scroll down, paste the `Single Webhook Url` inside the **Webhook URL** section and click on `Save`.

<img height="200" src="https://mintcdn.com/cobalt-55/rCTCKBbhiwGPdeWb/images/highlevel/ghl_webhook.png?fit=max&auto=format&n=rCTCKBbhiwGPdeWb&q=85&s=373615392f2276b0daa277af045c636c" alt="Setting up High Level Webhook URL" data-path="images/highlevel/ghl_webhook.png" />

<Tip>
  To learn more about how to listen to Webhook Events in HighLevel, refer [here](https://highlevel.stoplight.io/docs/integrations/6d8a9d06190b0-fa-qs).
</Tip>

#### Actions and triggers

Once the above setup is completed, you can create orchestrations of your use-cases using High Level actions and triggers. Following are the set of High Level actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Contact">
        1. **Create Contact** - Create a contact in High Level.
        2. **Update Contact** - Update a contact in High Level.
        3. **Delete Lead** - Delete a contact in High Level.
        4. **Upsert Contact** - Upsert a contact in High Level.
        5. **List Contacts** - List contacts in High Level.
      </Accordion>

      <Accordion title="Note">
        6. **Create Note** - Create a note in High Level.
        7. **Update Note** - Update a note in High Level.
      </Accordion>

      <Accordion title="Opportunity">
        8. **Create Opportunity** - Create an opportunity in High Level.
        9. **Update Opportunity** - Update an opportunity in High Level.
        10. **Search Opportunity** - Search Opportunities in High Level.
      </Accordion>

      <Accordion title="Task">
        11. **Create Task** - Create a task in High Level.
        12. **Update Task** - Update a tas in High Level.
        13. **List Tasks** - List tasks in High Level.
      </Accordion>

      <Accordion title="Others">
        14. **HTTP Request**- Make HTTP API calls to any High Level documented REST APIs.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Contact Created** - Triggers when a contact is created on HighLevel.
    2. **Task Completed** - Triggers when a task is completed on HighLevel.
    3. **Opportunity Created** - Triggers when an opportunity is created on HighLevel.
  </Tab>
</Tabs>
