# HubSpot

## Setup Guide

You can find your HubSpot application credentials by visiting your [HubSpot developer dashboard](https://app.hubspot.com/login?hubs_signup-url=developers.hubspot.com/\&hubs_signup-cta=cta--small).

You'll need the following information to set up your HubSpot App with Konnect:

* Client ID
* Client Secret
* Install URL

### Prerequisites

* HubSpot Developer Account. You can create one [here](https://app.hubspot.com/signup/developers).
* HubSpot application. Learn more about creating a HubSpot application [here](https://developers.hubspot.com/docs/api/creating-an-app).&#x20;

### Add the Redirect URL to your HubSpot app

Kolla provides a redirect URL to send information to your app. To add the redirect URL to your HubSpot app:

1\. Copy the link under "**Redirect URL**" in your connector settings in Kolla. The Redirect URL is:

```
https://connect.getkolla.com/oauth
```

2\. Log in to your [HubSpot developer dashboard](https://developers.hubspot.com/).

3\. Click **Manage apps**, then select the app you'd like to connect to Kolla.

4\. Under **Auth > Auth settings > Redirect URL**, paste-in Konnect redirect URL found in Step 1.

5\. Select any scopes you'd like to use in your application.&#x20;

6\. Press the **Save** button at the bottom of the page.

HubSpot provides your **Client ID** and **Client Secret** needed for the next step.

### Add your HubSpot app to Konnect

1\. Go to **Integrations > Connectors** and click **Add Connector**.

2\. Choose HubSpot from the catalog of connectors

3\. Name your instance of this connector and input the following configuration items:

* **Client ID:** Found under Auth > Auth settings > Client ID on your HubSpot App page.
* **Client Secret:** Found under Auth > Auth settings > Client secret on your HubSpot App page.&#x20;

4\. Next input your **Install URL** (Found under Auth > Auth settings > Install URL (OAuth) and we derive the Scopes/Permissions from the URL for you

Press the save button to finish adding this connector.

## Connecting to HubSpot

Once your users have connected their HubSpot account, you can use the Kolla SDK to access your user's HubSpot access token and use that to connect to HubSpot.

See the Hubspot [REST API documentation](https://developers.hubspot.com/docs/api/overview) for their full API reference.

Any Hubspot API endpoints can be accessed with the HubSpot SDK as shown in this example.

<pre class="language-javascript"><code class="lang-javascript">// Use KollaConnect client to get your user's hubspot access token
kolla.authenticate(consumerToken)

// Get the consumer's auth token to hubspot
<strong>var clientHubspotToken = kolla.getToken("hubspot", customerId)
</strong>
const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({ accessToken: clientHubspotToken })

hubspotClient.crm.contacts.basicApi
    .getPage(limit, after, properties, propertiesWithHistory, associations, archived)
    .then((results) => {
        console.log(results)
    })
    .catch((err) => {
        console.error(err)
    })


</code></pre>


---

# 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.getkolla.com/kolla/connector-guides/hubspot.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.
