# HubSpot (Legacy)

## Overview

The **HubSpot Book** integrates with HubSpot, enabling you to manage contacts, deals, and other CRM data within your automations seamlessly.

## Prerequisites

1. **HubSpot Account**: You need to have an active HubSpot account. If you do not have one, you can sign up for a HubSpot trial account to get started.
2. **Access Token**: Obtain your HubSpot access token, which is used to securely access HubSpot via the API. You can generate this token in your HubSpot account settings under "Integrations" > "API Key". You may need to contact your company’s IT support for access tokens.

### Learning the HubSpot Book

1. Navigate to **Books → All Books.**
2. Search for **HubSpot** (Legacy) and click on it.
3. Click on **Add Connection.**
4. Add in the credentials when you are prompted:
   1. **HubSpot Access Token**: The access token for your HubSpot account. This token is used to authenticate API requests and can be generated in your HubSpot account settings.

## Fetching Data from Hubspot

### **Retrieving HubSpot's Contacts**

To fetch contacts from HubSpot:

```
connect to hubspot where
    the hubspot token is "example-token-123"
get hubspot's contacts
```

### **Retrieving HubSpot's Deals**

To fetch deals from HubSpot:

```
connect to hubspot where
    the hubspot token is "example-token-123"
get hubspot's deals as a csv
```

### **Retrieving HubSpot's Companies**

To fetch companies from HubSpot:

```
connect to hubspot where
    the hubspot token is "example-token-123"
get hubspot's companies as a csv
```

### **Retrieving HubSpot's Line Items**

To fetch line items from HubSpot:

```
connect to hubspot where
    the hubspot token is "example-token-123"
get hubspot's line items as a csv
```
