@eugeneboondock/hubspot-mcp-server 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +22 -0
- package/LICENSE +21 -0
- package/NOTES_TASKS_FIX_SUMMARY.md +0 -0
- package/README.md +217 -0
- package/dist/auth-client.d.ts +29 -0
- package/dist/auth-client.js +76 -0
- package/dist/auth-client.js.map +1 -0
- package/dist/hubspot-client.d.ts +88 -0
- package/dist/hubspot-client.js +1730 -0
- package/dist/hubspot-client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1249 -0
- package/dist/index.js.map +1 -0
- package/dist/token-manager.d.ts +54 -0
- package/dist/token-manager.js +163 -0
- package/dist/token-manager.js.map +1 -0
- package/package.json +42 -0
- package/src/auth-client.ts +105 -0
- package/src/hubspot-client.ts +2120 -0
- package/src/index.ts +1378 -0
- package/src/token-manager.ts +207 -0
- package/tsconfig.json +16 -0
package/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
FROM node:22.12-alpine AS builder
|
|
2
|
+
|
|
3
|
+
COPY . /app
|
|
4
|
+
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
RUN npm install
|
|
8
|
+
|
|
9
|
+
FROM node:22-alpine AS release
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
|
|
13
|
+
COPY --from=builder /app/build /app/build
|
|
14
|
+
COPY --from=builder /app/package.json /app/package.json
|
|
15
|
+
COPY --from=builder /app/package-lock.json /app/package-lock.json
|
|
16
|
+
|
|
17
|
+
ENV NODE_ENV=production
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
RUN npm ci --ignore-scripts --omit-dev
|
|
21
|
+
EXPOSE 8080
|
|
22
|
+
ENTRYPOINT ["npx", "mcp-proxy", "node", "/app/dist/index.js"]
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 peakmojo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|
package/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# HubSpot MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.typescriptlang.org/)
|
|
4
|
+
[](https://developers.hubspot.com/docs/api/overview)
|
|
5
|
+
[](https://github.com/modelcontextprotocol/sdk)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
A powerful Model Context Protocol (MCP) server implementation for seamless HubSpot CRM integration, enabling AI assistants to interact with your HubSpot data.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
This MCP server provides a comprehensive set of tools for interacting with the HubSpot CRM API, allowing AI assistants to:
|
|
13
|
+
|
|
14
|
+
- Create and manage contacts and companies in your HubSpot CRM
|
|
15
|
+
- Retrieve detailed company activity history and engagement timelines
|
|
16
|
+
- Access recent engagement data across your entire HubSpot instance
|
|
17
|
+
- Get lists of recently active companies and contacts
|
|
18
|
+
- Search for tasks and notes with advanced filtering
|
|
19
|
+
- Perform CRM operations without leaving your AI assistant interface
|
|
20
|
+
|
|
21
|
+
## Why Use This MCP Server?
|
|
22
|
+
|
|
23
|
+
- **Seamless AI Integration**: Connect your AI assistants directly to your HubSpot CRM data
|
|
24
|
+
- **Simplified CRM Operations**: Perform common HubSpot tasks through natural language commands
|
|
25
|
+
- **Real-time Data Access**: Get up-to-date information from your HubSpot instance
|
|
26
|
+
- **Secure Authentication**: Uses HubSpot's OAuth token authentication
|
|
27
|
+
- **Extensible Design**: Easily add more HubSpot API capabilities as needed
|
|
28
|
+
- **Magic Card Integration**: Supports Morphed Magic Card detection and processing
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Clone the repository
|
|
34
|
+
git clone https://github.com/lkm1developer/hubspot-mcp-server.git
|
|
35
|
+
cd hubspot-mcp-server
|
|
36
|
+
|
|
37
|
+
# Install dependencies
|
|
38
|
+
npm install
|
|
39
|
+
|
|
40
|
+
# Build the project
|
|
41
|
+
npm run build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
The server requires a HubSpot API access token. You can obtain one by:
|
|
47
|
+
|
|
48
|
+
1. Going to your [HubSpot Developer Account](https://developers.hubspot.com/)
|
|
49
|
+
2. Creating a private app with the necessary scopes (contacts, companies, engagements, tasks, notes)
|
|
50
|
+
3. Copying the generated access token
|
|
51
|
+
|
|
52
|
+
You can provide the token in two ways:
|
|
53
|
+
|
|
54
|
+
1. As an environment variable:
|
|
55
|
+
```
|
|
56
|
+
HUBSPOT_ACCESS_TOKEN=your-access-token
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
2. As a command-line argument:
|
|
60
|
+
```
|
|
61
|
+
npm start -- --access-token=your-access-token
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For development, create a `.env` file in the project root to store your environment variables:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
HUBSPOT_ACCESS_TOKEN=your-access-token
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Starting the Server
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Start the server
|
|
76
|
+
npm start
|
|
77
|
+
|
|
78
|
+
# Or with a specific access token
|
|
79
|
+
npm start -- --access-token=your-access-token
|
|
80
|
+
|
|
81
|
+
# Run the SSE server with authentication
|
|
82
|
+
npx mcp-proxy-auth node dist/index.js
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Implementing Authentication in SSE Server
|
|
86
|
+
|
|
87
|
+
The SSE server uses the [mcp-proxy-auth](https://www.npmjs.com/package/mcp-proxy-auth) package for authentication. To implement authentication:
|
|
88
|
+
|
|
89
|
+
1. Install the package:
|
|
90
|
+
```bash
|
|
91
|
+
npm install mcp-proxy-auth
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
2. Set the `AUTH_SERVER_URL` environment variable to point to your API key verification endpoint:
|
|
95
|
+
```bash
|
|
96
|
+
export AUTH_SERVER_URL=https://your-auth-server.com/verify
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. Run the SSE server with authentication:
|
|
100
|
+
```bash
|
|
101
|
+
npx mcp-proxy-auth node dist/index.js
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. The SSE URL will be available at:
|
|
105
|
+
```
|
|
106
|
+
localhost:8080/sse?apiKey=apikey
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Replace `apikey` with your actual API key for authentication.
|
|
110
|
+
|
|
111
|
+
The `mcp-proxy-auth` package acts as a proxy that:
|
|
112
|
+
- Intercepts requests to your SSE server
|
|
113
|
+
- Verifies API keys against your authentication server
|
|
114
|
+
- Only allows authenticated requests to reach your SSE endpoint
|
|
115
|
+
|
|
116
|
+
### Integrating with AI Assistants
|
|
117
|
+
|
|
118
|
+
This MCP server is designed to work with AI assistants that support the Model Context Protocol. Once running, the server exposes a set of tools that can be used by compatible AI assistants to interact with your HubSpot CRM data.
|
|
119
|
+
|
|
120
|
+
### Available Tools
|
|
121
|
+
|
|
122
|
+
The server exposes the following powerful HubSpot integration tools:
|
|
123
|
+
|
|
124
|
+
1. **hubspot_create_contact**
|
|
125
|
+
- Create a new contact in HubSpot with duplicate checking
|
|
126
|
+
- Parameters:
|
|
127
|
+
- `firstname` (string, required): Contact's first name
|
|
128
|
+
- `lastname` (string, required): Contact's last name
|
|
129
|
+
- `email` (string, optional): Contact's email address
|
|
130
|
+
- `properties` (object, optional): Additional contact properties like company, phone, etc.
|
|
131
|
+
|
|
132
|
+
2. **hubspot_create_company**
|
|
133
|
+
- Create a new company in HubSpot with duplicate checking
|
|
134
|
+
- Parameters:
|
|
135
|
+
- `name` (string, required): Company name
|
|
136
|
+
- `properties` (object, optional): Additional company properties
|
|
137
|
+
|
|
138
|
+
3. **hubspot_get_company_activity**
|
|
139
|
+
- Get comprehensive activity history for a specific company
|
|
140
|
+
- Parameters:
|
|
141
|
+
- `companyId` (string, required): HubSpot company ID
|
|
142
|
+
- Returns detailed engagement data including emails, calls, meetings, notes, and tasks
|
|
143
|
+
|
|
144
|
+
4. **hubspot_get_recent_engagements**
|
|
145
|
+
- Get recent engagement activities across all contacts and companies
|
|
146
|
+
- Parameters:
|
|
147
|
+
- `days` (number, optional, default: 7): Number of days to look back
|
|
148
|
+
- `limit` (number, optional, default: 50): Maximum number of engagements to return
|
|
149
|
+
|
|
150
|
+
5. **hubspot_get_active_companies**
|
|
151
|
+
- Get most recently active companies from HubSpot
|
|
152
|
+
- Parameters:
|
|
153
|
+
- `limit` (number, optional, default: 10): Maximum number of companies to return
|
|
154
|
+
|
|
155
|
+
6. **hubspot_get_active_contacts**
|
|
156
|
+
- Get most recently active contacts from HubSpot
|
|
157
|
+
- Parameters:
|
|
158
|
+
- `limit` (number, optional, default: 10): Maximum number of contacts to return
|
|
159
|
+
|
|
160
|
+
7. **hubspot_get_deals**
|
|
161
|
+
- Get deals from HubSpot with comprehensive properties
|
|
162
|
+
- Parameters:
|
|
163
|
+
- `limit` (number, optional, default: 10): Maximum number of deals to return
|
|
164
|
+
|
|
165
|
+
8. **hubspot_get_tickets**
|
|
166
|
+
- Get support tickets from HubSpot
|
|
167
|
+
- Parameters:
|
|
168
|
+
- `limit` (number, optional, default: 10): Maximum number of tickets to return
|
|
169
|
+
|
|
170
|
+
9. **hubspot_get_orders**
|
|
171
|
+
- Get ecommerce orders from HubSpot
|
|
172
|
+
- Parameters:
|
|
173
|
+
- `limit` (number, optional, default: 10): Maximum number of orders to return
|
|
174
|
+
|
|
175
|
+
10. **hubspot_get_current_user**
|
|
176
|
+
- Get authenticated user info and portal details
|
|
177
|
+
- No parameters required
|
|
178
|
+
|
|
179
|
+
11. **hubspot_search_tasks**
|
|
180
|
+
- Search for tasks with advanced filtering
|
|
181
|
+
- Parameters:
|
|
182
|
+
- `searchTerm` (string, optional): Text to search for in task content
|
|
183
|
+
- `modifiedAfter` (string, optional): ISO date string to filter by modification date
|
|
184
|
+
|
|
185
|
+
12. **hubspot_search_notes**
|
|
186
|
+
- Search for notes with advanced filtering
|
|
187
|
+
- Parameters:
|
|
188
|
+
- `searchTerm` (string, optional): Text to search for in note content
|
|
189
|
+
- `modifiedAfter` (string, optional): ISO date string to filter by modification date
|
|
190
|
+
|
|
191
|
+
13. **hubspot_update_contact**
|
|
192
|
+
- Update an existing contact in HubSpot (ignores if contact does not exist)
|
|
193
|
+
- Parameters:
|
|
194
|
+
- `contact_id` (string, required): HubSpot contact ID to update
|
|
195
|
+
- `properties` (object, required): Contact properties to update
|
|
196
|
+
|
|
197
|
+
14. **hubspot_update_company**
|
|
198
|
+
- Update an existing company in HubSpot (ignores if company does not exist)
|
|
199
|
+
- Parameters:
|
|
200
|
+
- `company_id` (string, required): HubSpot company ID to update
|
|
201
|
+
- `properties` (object, required): Company properties to update
|
|
202
|
+
|
|
203
|
+
## Extending the Server
|
|
204
|
+
|
|
205
|
+
The server is designed to be easily extensible. To add new HubSpot API capabilities:
|
|
206
|
+
|
|
207
|
+
1. Add new methods to the `HubSpotClient` class in `src/hubspot-client.ts`
|
|
208
|
+
2. Register new tools in the `setupToolHandlers` method in `src/index.ts`
|
|
209
|
+
3. Rebuild the project with `npm run build`
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
214
|
+
|
|
215
|
+
## Keywords
|
|
216
|
+
|
|
217
|
+
HubSpot, CRM, Model Context Protocol, MCP, AI Assistant, TypeScript, API Integration, HubSpot API, CRM Integration, Contact Management, Company Management, Engagement Tracking, AI Tools, Magic Cards
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication client for MCP server
|
|
3
|
+
* Handles custom API key validation and OAuth token retrieval
|
|
4
|
+
*/
|
|
5
|
+
interface APIKeyValidationResponse {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
portal_id: string;
|
|
8
|
+
key_name: string;
|
|
9
|
+
scopes: string[];
|
|
10
|
+
authenticated_at: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class AuthClient {
|
|
13
|
+
private apiKey;
|
|
14
|
+
private baseUrl;
|
|
15
|
+
constructor(apiKey: string, baseUrl?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Validate the MCP API key and get portal context
|
|
18
|
+
*/
|
|
19
|
+
validateAPIKey(): Promise<APIKeyValidationResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Get OAuth token for the portal associated with this API key
|
|
22
|
+
*/
|
|
23
|
+
getOAuthToken(): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Get portal ID associated with this API key
|
|
26
|
+
*/
|
|
27
|
+
getPortalId(): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication client for MCP server
|
|
3
|
+
* Handles custom API key validation and OAuth token retrieval
|
|
4
|
+
*/
|
|
5
|
+
export class AuthClient {
|
|
6
|
+
apiKey;
|
|
7
|
+
baseUrl;
|
|
8
|
+
constructor(apiKey, baseUrl) {
|
|
9
|
+
this.apiKey = apiKey;
|
|
10
|
+
this.baseUrl = baseUrl || process.env.MORPHED_API_URL || 'https://morphed.io';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate the MCP API key and get portal context
|
|
14
|
+
*/
|
|
15
|
+
async validateAPIKey() {
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(`${this.baseUrl}/api/mcp/validate`, {
|
|
18
|
+
method: 'GET',
|
|
19
|
+
headers: {
|
|
20
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
21
|
+
'Content-Type': 'application/json'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
throw new Error(`API key validation failed: ${response.status} ${response.statusText}`);
|
|
26
|
+
}
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('API key validation failed:', error);
|
|
32
|
+
throw new Error(`Failed to validate API key: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get OAuth token for the portal associated with this API key
|
|
37
|
+
*/
|
|
38
|
+
async getOAuthToken() {
|
|
39
|
+
try {
|
|
40
|
+
// First validate the API key to get portal context
|
|
41
|
+
const validation = await this.validateAPIKey();
|
|
42
|
+
if (!validation.valid) {
|
|
43
|
+
throw new Error('Invalid API key');
|
|
44
|
+
}
|
|
45
|
+
// Get OAuth token for the portal
|
|
46
|
+
const response = await fetch(`${this.baseUrl}/api/mcp/oauth/token?portalId=${validation.portal_id}`, {
|
|
47
|
+
method: 'GET',
|
|
48
|
+
headers: {
|
|
49
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
50
|
+
'Content-Type': 'application/json'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new Error(`OAuth token fetch failed: ${response.status} ${response.statusText}`);
|
|
55
|
+
}
|
|
56
|
+
const data = await response.json();
|
|
57
|
+
if (!data.success || !data.data.access_token) {
|
|
58
|
+
throw new Error('No OAuth token available for this portal');
|
|
59
|
+
}
|
|
60
|
+
console.log(`Retrieved OAuth token for portal ${validation.portal_id}`);
|
|
61
|
+
return data.data.access_token;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error('OAuth token retrieval failed:', error);
|
|
65
|
+
throw new Error(`Failed to get OAuth token: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get portal ID associated with this API key
|
|
70
|
+
*/
|
|
71
|
+
async getPortalId() {
|
|
72
|
+
const validation = await this.validateAPIKey();
|
|
73
|
+
return validation.portal_id;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=auth-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-client.js","sourceRoot":"","sources":["../src/auth-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,MAAM,OAAO,UAAU;IACb,MAAM,CAAS;IACf,OAAO,CAAS;IAExB,YAAY,MAAc,EAAE,OAAgB;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,oBAAoB,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,mBAAmB,EAAE;gBAC/D,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;oBACxC,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1F,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC7G,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC;YACH,mDAAmD;YACnD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAE/C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACrC,CAAC;YAED,iCAAiC;YACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,iCAAiC,UAAU,CAAC,SAAS,EAAE,EAAE;gBACnG,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;oBACxC,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,GAAuB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEvD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC7C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5G,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC/C,OAAO,UAAU,CAAC,SAAS,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare function convertDatetimeFields(obj: any): any;
|
|
2
|
+
export declare class HubSpotScopeError extends Error {
|
|
3
|
+
scope: string;
|
|
4
|
+
code: string;
|
|
5
|
+
constructor(scopeName: string, cause?: any);
|
|
6
|
+
}
|
|
7
|
+
export declare class HubSpotClient {
|
|
8
|
+
private client;
|
|
9
|
+
private accessToken;
|
|
10
|
+
private lastRequestTime;
|
|
11
|
+
private requestCount;
|
|
12
|
+
private rateLimitWindow;
|
|
13
|
+
constructor(accessToken?: string);
|
|
14
|
+
/**
|
|
15
|
+
* Update the access token and reinitialize the client
|
|
16
|
+
*/
|
|
17
|
+
updateAccessToken(newToken: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Wrapper for API calls with automatic token refresh on 401 errors
|
|
20
|
+
*/
|
|
21
|
+
private callWithRetry;
|
|
22
|
+
/**
|
|
23
|
+
* Rate limiting to prevent 429 errors
|
|
24
|
+
*/
|
|
25
|
+
private rateLimitDelay;
|
|
26
|
+
/**
|
|
27
|
+
* Helper method to paginate through all results using HubSpot's after cursor
|
|
28
|
+
*/
|
|
29
|
+
private paginateSearch;
|
|
30
|
+
private normalizeDateInput;
|
|
31
|
+
private applyUpdatedAfterFilter;
|
|
32
|
+
/**
|
|
33
|
+
* Helper method to paginate through all results using HubSpot's after cursor (for List/GET APIs)
|
|
34
|
+
*/
|
|
35
|
+
private paginateList;
|
|
36
|
+
getRecentCompanies(limit?: number, updatedAfter?: string): Promise<any>;
|
|
37
|
+
getRecentContacts(limit?: number, updatedAfter?: string): Promise<any>;
|
|
38
|
+
getAssociations(fromObjectType: string, fromObjectId: string, toObjectType: string): Promise<any[]>;
|
|
39
|
+
searchTasks(minutes?: number, limit?: number): Promise<any>;
|
|
40
|
+
searchNotes(minutes?: number, limit?: number): Promise<any>;
|
|
41
|
+
searchCalls(minutes?: number, limit?: number): Promise<any>;
|
|
42
|
+
searchEmails(minutes?: number, limit?: number): Promise<any>;
|
|
43
|
+
searchMeetings(minutes?: number, limit?: number): Promise<any>;
|
|
44
|
+
getRecentEngagements(limit?: number): Promise<any>;
|
|
45
|
+
createContact(firstname: string, lastname: string, email?: string, properties?: Record<string, any>): Promise<any>;
|
|
46
|
+
createCompany(name: string, properties?: Record<string, any>): Promise<any>;
|
|
47
|
+
createNote(body: string, associations?: any[]): Promise<any>;
|
|
48
|
+
updateContact(contactId: string, properties: Record<string, any>): Promise<any>;
|
|
49
|
+
updateCompany(companyId: string, properties: Record<string, any>): Promise<any>;
|
|
50
|
+
getRecentDeals(limit?: number, updatedAfter?: string): Promise<any>;
|
|
51
|
+
getCurrentUser(): Promise<any>;
|
|
52
|
+
getRecentTickets(limit?: number): Promise<any>;
|
|
53
|
+
getRecentOrders(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
54
|
+
getOrders(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
55
|
+
getContactById(contactId: string): Promise<any>;
|
|
56
|
+
getCompanyById(companyId: string): Promise<any>;
|
|
57
|
+
getDealById(dealId: string): Promise<any>;
|
|
58
|
+
getTicketById(ticketId: string): Promise<any>;
|
|
59
|
+
private handleOptionalScopeError;
|
|
60
|
+
getForms(limit?: number): Promise<any[]>;
|
|
61
|
+
getFormSubmissions(formId: string, limit?: number): Promise<any[]>;
|
|
62
|
+
getMarketingEmails(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
63
|
+
getEmailEvents(limit?: number): Promise<any[]>;
|
|
64
|
+
getCampaigns(limit?: number): Promise<any[]>;
|
|
65
|
+
getAnalytics(startDate: string, endDate: string): Promise<any>;
|
|
66
|
+
getBlogPosts(limit?: number): Promise<any[]>;
|
|
67
|
+
getLandingPages(limit?: number): Promise<any[]>;
|
|
68
|
+
getKnowledgeBase(limit?: number): Promise<any[]>;
|
|
69
|
+
getPipelines(objectType?: string): Promise<any[]>;
|
|
70
|
+
getProperties(objectType: string): Promise<any[]>;
|
|
71
|
+
getQuotes(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
72
|
+
getUsers(limit?: number): Promise<any[]>;
|
|
73
|
+
getOwners(limit?: number): Promise<any[]>;
|
|
74
|
+
getConversations(limit?: number): Promise<any[]>;
|
|
75
|
+
getCalls(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
76
|
+
getMeetings(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
77
|
+
getCustomObjects(objectType?: string, limit?: number): Promise<any[]>;
|
|
78
|
+
getSitePages(limit?: number): Promise<any[]>;
|
|
79
|
+
getFiles(limit?: number): Promise<any[]>;
|
|
80
|
+
private fetchFilesSegment;
|
|
81
|
+
getHubDbTables(limit?: number): Promise<any[]>;
|
|
82
|
+
getProducts(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
83
|
+
getLineItems(limit?: number, updatedAfter?: string): Promise<any[]>;
|
|
84
|
+
searchObjects(objectType: string, query: string, limit?: number): Promise<any[]>;
|
|
85
|
+
getLists(limit?: number): Promise<any[]>;
|
|
86
|
+
getWorkflows(limit?: number): Promise<any[]>;
|
|
87
|
+
getDomains(limit?: number): Promise<any[]>;
|
|
88
|
+
}
|