@matimo/hubspot 0.1.0-alpha.9
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/LICENSE +21 -0
- package/README.md +389 -0
- package/definition.yaml +73 -0
- package/package.json +17 -0
- package/tools/hubspot-create-company/definition.yaml +57 -0
- package/tools/hubspot-create-contact/definition.yaml +79 -0
- package/tools/hubspot-create-custom-object/definition.yaml +57 -0
- package/tools/hubspot-create-deal/definition.yaml +69 -0
- package/tools/hubspot-create-invoice/definition.yaml +47 -0
- package/tools/hubspot-create-lead/definition.yaml +73 -0
- package/tools/hubspot-create-line-item/definition.yaml +64 -0
- package/tools/hubspot-create-order/definition.yaml +63 -0
- package/tools/hubspot-create-product/definition.yaml +58 -0
- package/tools/hubspot-create-ticket/definition.yaml +64 -0
- package/tools/hubspot-delete-company/definition.yaml +43 -0
- package/tools/hubspot-delete-contact/definition.yaml +43 -0
- package/tools/hubspot-delete-custom-object/definition.yaml +43 -0
- package/tools/hubspot-delete-deal/definition.yaml +43 -0
- package/tools/hubspot-delete-invoice/definition.yaml +38 -0
- package/tools/hubspot-delete-lead/definition.yaml +38 -0
- package/tools/hubspot-delete-line-item/definition.yaml +38 -0
- package/tools/hubspot-delete-order/definition.yaml +38 -0
- package/tools/hubspot-delete-product/definition.yaml +38 -0
- package/tools/hubspot-delete-ticket/definition.yaml +43 -0
- package/tools/hubspot-get-company/definition.yaml +49 -0
- package/tools/hubspot-get-contact/definition.yaml +56 -0
- package/tools/hubspot-get-custom-object/definition.yaml +54 -0
- package/tools/hubspot-get-deal/definition.yaml +42 -0
- package/tools/hubspot-get-invoice/definition.yaml +49 -0
- package/tools/hubspot-get-lead/definition.yaml +55 -0
- package/tools/hubspot-get-line-item/definition.yaml +49 -0
- package/tools/hubspot-get-order/definition.yaml +49 -0
- package/tools/hubspot-get-product/definition.yaml +49 -0
- package/tools/hubspot-get-ticket/definition.yaml +42 -0
- package/tools/hubspot-list-companies/definition.yaml +49 -0
- package/tools/hubspot-list-contacts/definition.yaml +59 -0
- package/tools/hubspot-list-custom-objects/definition.yaml +60 -0
- package/tools/hubspot-list-deals/definition.yaml +49 -0
- package/tools/hubspot-list-invoices/definition.yaml +55 -0
- package/tools/hubspot-list-leads/definition.yaml +61 -0
- package/tools/hubspot-list-line-items/definition.yaml +55 -0
- package/tools/hubspot-list-orders/definition.yaml +55 -0
- package/tools/hubspot-list-products/definition.yaml +55 -0
- package/tools/hubspot-list-tickets/definition.yaml +49 -0
- package/tools/hubspot-update-company/definition.yaml +54 -0
- package/tools/hubspot-update-contact/definition.yaml +62 -0
- package/tools/hubspot-update-custom-object/definition.yaml +57 -0
- package/tools/hubspot-update-deal/definition.yaml +54 -0
- package/tools/hubspot-update-invoice/definition.yaml +52 -0
- package/tools/hubspot-update-lead/definition.yaml +55 -0
- package/tools/hubspot-update-line-item/definition.yaml +52 -0
- package/tools/hubspot-update-order/definition.yaml +52 -0
- package/tools/hubspot-update-product/definition.yaml +52 -0
- package/tools/hubspot-update-ticket/definition.yaml +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tallclub
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# @matimo/hubspot - HubSpot Tools for Matimo
|
|
2
|
+
|
|
3
|
+
HubSpot CRM, marketing, and automation integration tools for Matimo's universal AI tools ecosystem. Manage contacts, companies, deals, tickets, and more through YAML-defined tools that work with any AI framework.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @matimo/hubspot
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @matimo/hubspot
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 🛠️ Available Tools (50 Total)
|
|
14
|
+
|
|
15
|
+
| Category | Count | Description |
|
|
16
|
+
|---------------|-------|------------------------------------|
|
|
17
|
+
| **Contacts** | 5 tools | Create, read, update, delete, list contacts |
|
|
18
|
+
| **Companies** | 5 tools | Create, read, update, delete, list companies |
|
|
19
|
+
| **Deals** | 5 tools | Create, read, update, delete, list deals |
|
|
20
|
+
| **Tickets** | 5 tools | Create, read, update, delete, list tickets |
|
|
21
|
+
| **Leads** | 5 tools | Create, read, update, delete, list leads |
|
|
22
|
+
| **Line Items** | 5 tools | Create, read, update, delete, list line items |
|
|
23
|
+
| **Invoices** | 5 tools | Create, read, update, delete, list invoices |
|
|
24
|
+
| **Orders** | 5 tools | Create, read, update, delete, list orders |
|
|
25
|
+
| **Products** | 5 tools | Create, read, update, delete, list products |
|
|
26
|
+
| **Custom Objects** | 5 tools | Create, read, update, delete, list custom objects |
|
|
27
|
+
|
|
28
|
+
### Complete Tool List
|
|
29
|
+
|
|
30
|
+
**Contacts (5):**
|
|
31
|
+
- `hubspot-create-contact` — Create new contact
|
|
32
|
+
- `hubspot-get-contact` — Get contact by ID
|
|
33
|
+
- `hubspot-update-contact` — Update contact (🔒 requires approval)
|
|
34
|
+
- `hubspot-delete-contact` — Delete contact (🔒 requires approval)
|
|
35
|
+
- `hubspot-list-contacts` — List all contacts with pagination
|
|
36
|
+
|
|
37
|
+
**Companies (5):**
|
|
38
|
+
- `hubspot-create-company` — Create new company
|
|
39
|
+
- `hubspot-get-company` — Get company by ID
|
|
40
|
+
- `hubspot-update-company` — Update company (🔒 requires approval)
|
|
41
|
+
- `hubspot-delete-company` — Delete company (🔒 requires approval)
|
|
42
|
+
- `hubspot-list-companies` — List all companies with pagination
|
|
43
|
+
|
|
44
|
+
**Deals (5):**
|
|
45
|
+
- `hubspot-create-deal` — Create new deal
|
|
46
|
+
- `hubspot-get-deal` — Get deal by ID
|
|
47
|
+
- `hubspot-update-deal` — Update deal (🔒 requires approval)
|
|
48
|
+
- `hubspot-delete-deal` — Delete deal (🔒 requires approval)
|
|
49
|
+
- `hubspot-list-deals` — List all deals with pagination
|
|
50
|
+
|
|
51
|
+
**Tickets (5):**
|
|
52
|
+
- `hubspot-create-ticket` — Create new ticket
|
|
53
|
+
- `hubspot-get-ticket` — Get ticket by ID
|
|
54
|
+
- `hubspot-update-ticket` — Update ticket (🔒 requires approval)
|
|
55
|
+
- `hubspot-delete-ticket` — Delete ticket (🔒 requires approval)
|
|
56
|
+
- `hubspot-list-tickets` — List all tickets with pagination
|
|
57
|
+
|
|
58
|
+
**Leads (5):**
|
|
59
|
+
- `hubspot-create-lead` — Create new lead
|
|
60
|
+
- `hubspot-get-lead` — Get lead by ID
|
|
61
|
+
- `hubspot-update-lead` — Update lead (🔒 requires approval)
|
|
62
|
+
- `hubspot-delete-lead` — Delete lead (🔒 requires approval)
|
|
63
|
+
- `hubspot-list-leads` — List all leads with pagination
|
|
64
|
+
|
|
65
|
+
**Line Items (5):**
|
|
66
|
+
- `hubspot-create-line-item` — Create new line item
|
|
67
|
+
- `hubspot-get-line-item` — Get line item by ID
|
|
68
|
+
- `hubspot-update-line-item` — Update line item (🔒 requires approval)
|
|
69
|
+
- `hubspot-delete-line-item` — Delete line item (🔒 requires approval)
|
|
70
|
+
- `hubspot-list-line-items` — List all line items with pagination
|
|
71
|
+
|
|
72
|
+
**Invoices (5):**
|
|
73
|
+
- `hubspot-create-invoice` — Create new invoice
|
|
74
|
+
- `hubspot-get-invoice` — Get invoice by ID
|
|
75
|
+
- `hubspot-update-invoice` — Update invoice (🔒 requires approval)
|
|
76
|
+
- `hubspot-delete-invoice` — Delete invoice (🔒 requires approval)
|
|
77
|
+
- `hubspot-list-invoices` — List all invoices with pagination
|
|
78
|
+
|
|
79
|
+
**Orders (5):**
|
|
80
|
+
- `hubspot-create-order` — Create new order
|
|
81
|
+
- `hubspot-get-order` — Get order by ID
|
|
82
|
+
- `hubspot-update-order` — Update order (🔒 requires approval)
|
|
83
|
+
- `hubspot-delete-order` — Delete order (🔒 requires approval)
|
|
84
|
+
- `hubspot-list-orders` — List all orders with pagination
|
|
85
|
+
|
|
86
|
+
**Products (5):**
|
|
87
|
+
- `hubspot-create-product` — Create new product
|
|
88
|
+
- `hubspot-get-product` — Get product by ID
|
|
89
|
+
- `hubspot-update-product` — Update product (🔒 requires approval)
|
|
90
|
+
- `hubspot-delete-product` — Delete product (🔒 requires approval)
|
|
91
|
+
- `hubspot-list-products` — List all products with pagination
|
|
92
|
+
|
|
93
|
+
**Custom Objects (5):**
|
|
94
|
+
- `hubspot-create-custom-object` — Create new custom object
|
|
95
|
+
- `hubspot-get-custom-object` — Get custom object by ID
|
|
96
|
+
- `hubspot-update-custom-object` — Update custom object (🔒 requires approval)
|
|
97
|
+
- `hubspot-delete-custom-object` — Delete custom object (🔒 requires approval)
|
|
98
|
+
- `hubspot-list-custom-objects` — List custom objects with pagination
|
|
99
|
+
|
|
100
|
+
## ⚡ Quick Start
|
|
101
|
+
|
|
102
|
+
**Prerequisites:**
|
|
103
|
+
1. Create a HubSpot Service Key (see [Authentication](#-authentication) section)
|
|
104
|
+
2. Set your API key:
|
|
105
|
+
```bash
|
|
106
|
+
export MATIMO_HUBSPOT_API_KEY="your-service-key-here"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Usage:**
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { MatimoInstance } from '@matimo/core';
|
|
113
|
+
|
|
114
|
+
async function main() {
|
|
115
|
+
// Initialize with auto-discovery to load all @matimo/* packages
|
|
116
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
117
|
+
|
|
118
|
+
// Create a contact
|
|
119
|
+
const contact = await matimo.execute('hubspot-create-contact', {
|
|
120
|
+
properties: {
|
|
121
|
+
email: 'john@example.com',
|
|
122
|
+
firstname: 'John',
|
|
123
|
+
lastname: 'Doe'
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
console.log('Contact created:', (contact as any).id);
|
|
127
|
+
|
|
128
|
+
// Get contact
|
|
129
|
+
const retrieved = await matimo.execute('hubspot-get-contact', {
|
|
130
|
+
id: (contact as any).id,
|
|
131
|
+
properties: ['firstname', 'lastname', 'email']
|
|
132
|
+
});
|
|
133
|
+
console.log('Retrieved:', retrieved);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
main();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 🔐 Authentication
|
|
140
|
+
|
|
141
|
+
HubSpot tools support three authentication methods:
|
|
142
|
+
|
|
143
|
+
### Option 1: Service Keys (⭐ Recommended — Modern)
|
|
144
|
+
|
|
145
|
+
**NEW (Feb 2026)** — The modern replacement for legacy private apps. Purpose-built for system-to-system integrations like Matimo.
|
|
146
|
+
|
|
147
|
+
**When to use:**
|
|
148
|
+
- ✅ System-to-system integrations (Matimo, automation, BI tools)
|
|
149
|
+
- ✅ Data warehousing and analytics (Tableau, Power BI, etc.)
|
|
150
|
+
- ✅ Internal automation and reporting workflows
|
|
151
|
+
- ✅ Simplest and most secure approach
|
|
152
|
+
|
|
153
|
+
**Setup Steps:**
|
|
154
|
+
1. Go to your HubSpot account → Settings → Integrations → **Service Keys**
|
|
155
|
+
2. Click **Create service key**
|
|
156
|
+
3. Enter a name (e.g., "Matimo Integration") and description
|
|
157
|
+
4. Select required scopes:
|
|
158
|
+
- `crm.objects.contacts.read`
|
|
159
|
+
- `crm.objects.contacts.write`
|
|
160
|
+
- `crm.objects.companies.read`
|
|
161
|
+
- `crm.objects.companies.write`
|
|
162
|
+
- `crm.objects.deals.read`
|
|
163
|
+
- `crm.objects.deals.write`
|
|
164
|
+
- `crm.objects.tickets.read`
|
|
165
|
+
- `crm.objects.tickets.write`
|
|
166
|
+
- `crm.objects.leads.read`
|
|
167
|
+
- `crm.objects.leads.write`
|
|
168
|
+
- `crm.objects.line_items.read`
|
|
169
|
+
- `crm.objects.line_items.write`
|
|
170
|
+
- `crm.objects.invoices.read`
|
|
171
|
+
- `crm.objects.invoices.write`
|
|
172
|
+
- `crm.objects.orders.read`
|
|
173
|
+
- `crm.objects.orders.write`
|
|
174
|
+
- `crm.objects.products.read`
|
|
175
|
+
- `crm.objects.products.write`
|
|
176
|
+
- `crm.objects.custom.read`
|
|
177
|
+
- `crm.objects.custom.write`
|
|
178
|
+
5. Click **Create** and copy the service key
|
|
179
|
+
6. Set environment variable:
|
|
180
|
+
```bash
|
|
181
|
+
export MATIMO_HUBSPOT_API_KEY="your-service-key-here"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Verify the key:**
|
|
185
|
+
```bash
|
|
186
|
+
# List contacts to verify access
|
|
187
|
+
curl -sS -H "Authorization: Bearer $MATIMO_HUBSPOT_API_KEY" \
|
|
188
|
+
"https://api.hubapi.com/crm/v3/objects/contacts?limit=1&archived=false"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Key rotation:**
|
|
192
|
+
- View last-used timestamp in HubSpot UI
|
|
193
|
+
- Rotate anytime: Settings → Integrations → Service Keys → your key → **Rotate**
|
|
194
|
+
- 7-day grace period during rotation
|
|
195
|
+
- Survives if creator leaves the account (tied to account, not user)
|
|
196
|
+
|
|
197
|
+
**Limitations:**
|
|
198
|
+
- Does not support webhooks (use private apps or project-based apps instead)
|
|
199
|
+
|
|
200
|
+
**Resources:**
|
|
201
|
+
- [Service Keys Documentation](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/account-service-keys)
|
|
202
|
+
- [Service Keys Changelog (Released Feb 10, 2026)](https://developers.hubspot.com/changelog/service-keys)
|
|
203
|
+
|
|
204
|
+
### Option 2: Private App (Legacy Alternative)
|
|
205
|
+
|
|
206
|
+
For users with existing private apps or if webhooks are required.
|
|
207
|
+
|
|
208
|
+
**Setup Steps:**
|
|
209
|
+
1. Go to your HubSpot account → Settings → Development → Legacy apps
|
|
210
|
+
2. Click **Create legacy app** → select **Private**
|
|
211
|
+
3. Name the app (e.g., "Matimo Integration"), add description and logo
|
|
212
|
+
4. Go to **Scopes** tab and add required scopes:
|
|
213
|
+
- `crm.objects.contacts.read`
|
|
214
|
+
- `crm.objects.contacts.write`
|
|
215
|
+
- `crm.objects.companies.read`
|
|
216
|
+
- `crm.objects.companies.write`
|
|
217
|
+
- `crm.objects.deals.read`
|
|
218
|
+
- `crm.objects.deals.write`
|
|
219
|
+
- `crm.objects.tickets.read`
|
|
220
|
+
- `crm.objects.tickets.write`
|
|
221
|
+
- `crm.objects.leads.read`
|
|
222
|
+
- `crm.objects.leads.write`
|
|
223
|
+
- `crm.objects.line_items.read`
|
|
224
|
+
- `crm.objects.line_items.write`
|
|
225
|
+
- `crm.objects.invoices.read`
|
|
226
|
+
- `crm.objects.invoices.write`
|
|
227
|
+
- `crm.objects.orders.read`
|
|
228
|
+
- `crm.objects.orders.write`
|
|
229
|
+
- `crm.objects.products.read`
|
|
230
|
+
- `crm.objects.products.write`
|
|
231
|
+
- `crm.objects.custom.read`
|
|
232
|
+
- `crm.objects.custom.write`
|
|
233
|
+
5. Click **Create app** and copy the access token (visible once)
|
|
234
|
+
6. Set environment variable:
|
|
235
|
+
```bash
|
|
236
|
+
export MATIMO_HUBSPOT_API_KEY="your-access-token-here"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Verify the token:**
|
|
240
|
+
```bash
|
|
241
|
+
# List contacts to verify access
|
|
242
|
+
curl -sS -H "Authorization: Bearer $MATIMO_HUBSPOT_API_KEY" \
|
|
243
|
+
"https://api.hubapi.com/crm/v3/objects/contacts?limit=1&archived=false"
|
|
244
|
+
|
|
245
|
+
# Or check token metadata
|
|
246
|
+
curl -sS -X POST https://api.hubapi.com/oauth/v2/private-apps/get/access-token-info \
|
|
247
|
+
-H "Content-Type: application/json" \
|
|
248
|
+
-d '{"tokenKey":"'$MATIMO_HUBSPOT_API_KEY'"}'
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Token Rotation:**
|
|
252
|
+
- If compromised: HubSpot UI → Legacy apps → Your app → Auth → **Rotate**
|
|
253
|
+
- Recommended every 6 months for security
|
|
254
|
+
|
|
255
|
+
**Resources:**
|
|
256
|
+
- [Private Apps Documentation](https://developers.hubspot.com/docs/api/private-apps)
|
|
257
|
+
- [HubSpot scopes reference](https://developers.hubspot.com/docs/apps/legacy-apps/authentication/scopes)
|
|
258
|
+
|
|
259
|
+
### Option 3: OAuth2 (For Multi-Account or Marketplace Apps)
|
|
260
|
+
|
|
261
|
+
Advanced — use OAuth2 for distributing apps to multiple HubSpot accounts or handling per-account access with refresh tokens.
|
|
262
|
+
|
|
263
|
+
**When to use OAuth:**
|
|
264
|
+
- Distributing app to HubSpot App Marketplace
|
|
265
|
+
- Managing multiple HubSpot accounts with auto refresh
|
|
266
|
+
- Requiring per-user consent flows
|
|
267
|
+
- Building public/white-label integrations
|
|
268
|
+
|
|
269
|
+
**Setup Steps:**
|
|
270
|
+
1. Create a public app in HubSpot (Developer Hub → My apps → Create app)
|
|
271
|
+
2. Go to **Auth** tab and copy **Client ID** and **Client Secret**
|
|
272
|
+
3. Set **Redirect URI** (e.g., `http://localhost:3000/oauth/callback`)
|
|
273
|
+
4. Add same scopes as Private App (see above)
|
|
274
|
+
5. Build authorization URL and redirect users to HubSpot for approval:
|
|
275
|
+
```
|
|
276
|
+
https://app.hubspot.com/oauth/authorize?client_id=YOUR_CLIENT_ID&scope=crm.objects.contacts.read%20crm.objects.contacts.write&redirect_uri=YOUR_REDIRECT_URI
|
|
277
|
+
```
|
|
278
|
+
6. Handle redirect → exchange code for access_token + refresh_token
|
|
279
|
+
7. Persist refresh_token securely and use access_token with Matimo
|
|
280
|
+
|
|
281
|
+
**Example OAuth integration (Node.js):**
|
|
282
|
+
```typescript
|
|
283
|
+
// Exchange code for token
|
|
284
|
+
const response = await fetch('https://api.hubapi.com/oauth/v1/token', {
|
|
285
|
+
method: 'POST',
|
|
286
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
287
|
+
body: new URLSearchParams({
|
|
288
|
+
grant_type: 'authorization_code',
|
|
289
|
+
client_id: process.env.HUBSPOT_CLIENT_ID,
|
|
290
|
+
client_secret: process.env.HUBSPOT_CLIENT_SECRET,
|
|
291
|
+
redirect_uri: process.env.HUBSPOT_REDIRECT_URI,
|
|
292
|
+
code: authorizationCode
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
const { access_token, refresh_token } = await response.json();
|
|
296
|
+
|
|
297
|
+
// Use access_token with Matimo
|
|
298
|
+
process.env.MATIMO_HUBSPOT_API_KEY = access_token;
|
|
299
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Resources:**
|
|
303
|
+
- [OAuth Documentation](https://developers.hubspot.com/docs/api/working-with-oauth)
|
|
304
|
+
- [OAuth Quickstart Guide](https://developers.hubspot.com/docs/apps/legacy-apps/authentication/oauth-quickstart-guide)
|
|
305
|
+
- [Token Management API](https://developers.hubspot.com/docs/api-reference/auth-oauth-v1/guide)
|
|
306
|
+
- [API Rate Limits](https://developers.hubspot.com/docs/developer-tooling/platform/usage-guidelines#rate-limits)
|
|
307
|
+
|
|
308
|
+
**Recommendation:** Start with Private App for testing and single-account use. Switch to OAuth when you need multi-account support.
|
|
309
|
+
|
|
310
|
+
## 🤖 Integration Examples
|
|
311
|
+
|
|
312
|
+
**Three integration patterns:**
|
|
313
|
+
|
|
314
|
+
1. **Factory Pattern** — Direct tool execution (simplest)
|
|
315
|
+
```bash
|
|
316
|
+
npm run hubspot:factory
|
|
317
|
+
```
|
|
318
|
+
See [examples/tools/hubspot/hubspot-factory.ts](../examples/tools/hubspot/hubspot-factory.ts)
|
|
319
|
+
|
|
320
|
+
2. **Decorator Pattern** — Class-based tools
|
|
321
|
+
```bash
|
|
322
|
+
npm run hubspot:decorator
|
|
323
|
+
```
|
|
324
|
+
See [examples/tools/hubspot/hubspot-decorator.ts](../examples/tools/hubspot/hubspot-decorator.ts)
|
|
325
|
+
|
|
326
|
+
3. **LangChain Integration** — AI agent tools
|
|
327
|
+
```bash
|
|
328
|
+
npm run hubspot:langchain
|
|
329
|
+
```
|
|
330
|
+
See [examples/tools/hubspot/hubspot-langchain.ts](../examples/tools/hubspot/hubspot-langchain.ts)
|
|
331
|
+
|
|
332
|
+
## 📖 API Reference
|
|
333
|
+
|
|
334
|
+
For detailed API documentation:
|
|
335
|
+
- [HubSpot CRM API Reference](https://developers.hubspot.com/docs/api-reference/crm-objects)
|
|
336
|
+
- [Contacts API](https://developers.hubspot.com/docs/api-reference/crm-objects-contacts)
|
|
337
|
+
- [Companies API](https://developers.hubspot.com/docs/api-reference/crm-objects-companies)
|
|
338
|
+
- [Deals API](https://developers.hubspot.com/docs/api-reference/crm-objects-deals)
|
|
339
|
+
- [Tickets API](https://developers.hubspot.com/docs/api-reference/crm-objects-tickets)
|
|
340
|
+
|
|
341
|
+
## 🔒 Approval System
|
|
342
|
+
|
|
343
|
+
Destructive operations (update, delete) require approval before execution. Configure approval handling programmatically:
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
import { ApprovalHandler } from '@matimo/core';
|
|
347
|
+
|
|
348
|
+
// Set approval callback
|
|
349
|
+
ApprovalHandler.setApprovalCallback(async (toolName: string, params: Record<string, unknown>) => {
|
|
350
|
+
console.log(`Approval required for: ${toolName}`);
|
|
351
|
+
console.log('Parameters:', params);
|
|
352
|
+
// Return true to approve, false to deny
|
|
353
|
+
return true;
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// Optional: Control auto-approval via environment variables
|
|
357
|
+
// MATIMO_AUTO_APPROVE=true (approve all)
|
|
358
|
+
// MATIMO_APPROVED_PATTERNS=hubspot-update-contact,hubspot-delete-* (approve by pattern)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Tools marked with 🔒 will request approval before executing.
|
|
362
|
+
|
|
363
|
+
## 📊 Tool Status
|
|
364
|
+
|
|
365
|
+
- ✅ Contacts CRUD — Production ready
|
|
366
|
+
- ✅ Companies CRUD — Production ready
|
|
367
|
+
- ✅ Deals CRUD — Production ready
|
|
368
|
+
- ✅ Tickets CRUD — Production ready
|
|
369
|
+
- 🚧 Associations API — Coming soon
|
|
370
|
+
- 🚧 Custom objects — Coming soon
|
|
371
|
+
- 🚧 Workflows & Automation — Coming soon
|
|
372
|
+
|
|
373
|
+
## ⚙️ Configuration
|
|
374
|
+
|
|
375
|
+
All tools support:
|
|
376
|
+
- Bearer token authentication
|
|
377
|
+
- Request timeouts (default 30s)
|
|
378
|
+
- Automatic retry with exponential backoff
|
|
379
|
+
- Approval workflow for destructive operations
|
|
380
|
+
- Comprehensive error logging
|
|
381
|
+
|
|
382
|
+
## 🧑💻 Contributing
|
|
383
|
+
|
|
384
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
**Tag:** CRM
|
|
389
|
+
**Part of the Matimo ecosystem.**
|
package/definition.yaml
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# HubSpot OAuth2 Provider Definition
|
|
2
|
+
#
|
|
3
|
+
# This file defines the OAuth2 configuration for HubSpot.
|
|
4
|
+
# All HubSpot tools reference this provider definition.
|
|
5
|
+
#
|
|
6
|
+
# Users can override these endpoints via:
|
|
7
|
+
# 1. Runtime config (highest priority)
|
|
8
|
+
# 2. Environment variables: OAUTH_HUBSPOT_AUTH_URL, OAUTH_HUBSPOT_TOKEN_URL, etc.
|
|
9
|
+
# 3. This YAML definition (lowest priority)
|
|
10
|
+
#
|
|
11
|
+
# Setup:
|
|
12
|
+
# 1. Create HubSpot app at https://developers.hubspot.com/
|
|
13
|
+
# 2. Set HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET environment variables
|
|
14
|
+
# 3. Set HUBSPOT_REDIRECT_URI to your callback URL (e.g., http://localhost:3000/auth/hubspot/callback)
|
|
15
|
+
|
|
16
|
+
name: hubspot-provider
|
|
17
|
+
type: provider
|
|
18
|
+
version: '1.0.0'
|
|
19
|
+
tags:
|
|
20
|
+
- CRM
|
|
21
|
+
- Marketing
|
|
22
|
+
- Sales
|
|
23
|
+
- Automation
|
|
24
|
+
|
|
25
|
+
description: |
|
|
26
|
+
HubSpot OAuth2 Provider Configuration
|
|
27
|
+
|
|
28
|
+
All HubSpot CRM tools use these endpoints for OAuth2 authentication.
|
|
29
|
+
|
|
30
|
+
Setup:
|
|
31
|
+
1. Create HubSpot app in Developer Console
|
|
32
|
+
2. Enable OAuth2 and configure redirect URIs
|
|
33
|
+
3. Set HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET environment variables
|
|
34
|
+
4. Set HUBSPOT_REDIRECT_URI to your callback URL
|
|
35
|
+
|
|
36
|
+
provider:
|
|
37
|
+
name: hubspot
|
|
38
|
+
displayName: HubSpot
|
|
39
|
+
|
|
40
|
+
# OAuth2 Endpoints
|
|
41
|
+
# Standard HubSpot OAuth2 endpoints - change only if using custom proxy
|
|
42
|
+
endpoints:
|
|
43
|
+
authorizationUrl: https://app.hubspot.com/oauth/authorize
|
|
44
|
+
tokenUrl: https://api.hubapi.com/crm/v3/oauth
|
|
45
|
+
revokeUrl: https://api.hubapi.com/crm/v3/oauth/tokens/revoke
|
|
46
|
+
|
|
47
|
+
# Standard scopes for HubSpot CRM access
|
|
48
|
+
# Tools can override with their own scopes
|
|
49
|
+
defaultScopes:
|
|
50
|
+
- crm.objects.contacts.read
|
|
51
|
+
- crm.objects.contacts.write
|
|
52
|
+
- crm.objects.companies.read
|
|
53
|
+
- crm.objects.companies.write
|
|
54
|
+
- crm.objects.deals.read
|
|
55
|
+
- crm.objects.deals.write
|
|
56
|
+
- crm.objects.tickets.read
|
|
57
|
+
- crm.objects.tickets.write
|
|
58
|
+
- crm.objects.leads.read
|
|
59
|
+
- crm.objects.leads.write
|
|
60
|
+
- crm.objects.line_items.read
|
|
61
|
+
- crm.objects.line_items.write
|
|
62
|
+
- crm.objects.invoices.read
|
|
63
|
+
- crm.objects.invoices.write
|
|
64
|
+
- crm.objects.orders.read
|
|
65
|
+
- crm.objects.orders.write
|
|
66
|
+
- crm.objects.products.read
|
|
67
|
+
- crm.objects.products.write
|
|
68
|
+
- crm.objects.custom.read
|
|
69
|
+
- crm.objects.custom.write
|
|
70
|
+
|
|
71
|
+
# Additional metadata
|
|
72
|
+
documentation: https://developers.hubspot.com/docs/api/crm/contacts
|
|
73
|
+
learnMore: https://developers.hubspot.com/docs/api/oauth-quickstart
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@matimo/hubspot",
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
|
+
"description": "HubSpot tools for Matimo - universal CRM, marketing, and automation integration.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"tools",
|
|
8
|
+
"README.md",
|
|
9
|
+
"definition.yaml"
|
|
10
|
+
],
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"matimo": "0.1.0-alpha.9"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@matimo/core": "0.1.0-alpha.9"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: hubspot-create-company
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: Create a new company in HubSpot CRM.
|
|
4
|
+
|
|
5
|
+
parameters:
|
|
6
|
+
name:
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
description: Company name
|
|
10
|
+
domain:
|
|
11
|
+
type: string
|
|
12
|
+
required: false
|
|
13
|
+
description: Company domain
|
|
14
|
+
|
|
15
|
+
execution:
|
|
16
|
+
type: http
|
|
17
|
+
method: POST
|
|
18
|
+
url: 'https://api.hubapi.com/crm/v3/objects/companies'
|
|
19
|
+
headers:
|
|
20
|
+
Authorization: 'Bearer {MATIMO_HUBSPOT_API_KEY}'
|
|
21
|
+
Content-Type: application/json
|
|
22
|
+
body:
|
|
23
|
+
properties:
|
|
24
|
+
name: '{name}'
|
|
25
|
+
domain: '{domain}'
|
|
26
|
+
timeout: 30000
|
|
27
|
+
|
|
28
|
+
authentication:
|
|
29
|
+
type: bearer
|
|
30
|
+
location: header
|
|
31
|
+
name: Authorization
|
|
32
|
+
notes:
|
|
33
|
+
env: MATIMO_HUBSPOT_API_KEY
|
|
34
|
+
|
|
35
|
+
output_schema:
|
|
36
|
+
type: object
|
|
37
|
+
properties:
|
|
38
|
+
id: { type: string }
|
|
39
|
+
properties: { type: object }
|
|
40
|
+
createdAt: { type: string }
|
|
41
|
+
required: [id, properties]
|
|
42
|
+
|
|
43
|
+
error_handling:
|
|
44
|
+
retry: 2
|
|
45
|
+
backoff_type: exponential
|
|
46
|
+
initial_delay_ms: 500
|
|
47
|
+
|
|
48
|
+
examples:
|
|
49
|
+
- name: 'Create company with name'
|
|
50
|
+
params:
|
|
51
|
+
name: 'Acme Corp'
|
|
52
|
+
expected_result: 'Company created with id and properties.'
|
|
53
|
+
- name: 'Create company with name and domain'
|
|
54
|
+
params:
|
|
55
|
+
name: 'Tech Startup Inc'
|
|
56
|
+
domain: 'techstartup.com'
|
|
57
|
+
expected_result: 'Company created with name and domain.'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: hubspot-create-contact
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: Create a new contact in HubSpot CRM.
|
|
4
|
+
|
|
5
|
+
parameters:
|
|
6
|
+
email:
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
description: Email address of the contact
|
|
10
|
+
firstname:
|
|
11
|
+
type: string
|
|
12
|
+
required: false
|
|
13
|
+
description: First name of the contact
|
|
14
|
+
lastname:
|
|
15
|
+
type: string
|
|
16
|
+
required: false
|
|
17
|
+
description: Last name of the contact
|
|
18
|
+
phone:
|
|
19
|
+
type: string
|
|
20
|
+
required: false
|
|
21
|
+
description: Phone number of the contact
|
|
22
|
+
company:
|
|
23
|
+
type: string
|
|
24
|
+
required: false
|
|
25
|
+
description: Company name of the contact
|
|
26
|
+
|
|
27
|
+
execution:
|
|
28
|
+
type: http
|
|
29
|
+
method: POST
|
|
30
|
+
url: 'https://api.hubapi.com/crm/v3/objects/contacts'
|
|
31
|
+
headers:
|
|
32
|
+
Authorization: 'Bearer {MATIMO_HUBSPOT_API_KEY}'
|
|
33
|
+
Content-Type: application/json
|
|
34
|
+
body:
|
|
35
|
+
properties:
|
|
36
|
+
email: '{email}'
|
|
37
|
+
firstname: '{firstname}'
|
|
38
|
+
lastname: '{lastname}'
|
|
39
|
+
phone: '{phone}'
|
|
40
|
+
company: '{company}'
|
|
41
|
+
timeout: 30000
|
|
42
|
+
|
|
43
|
+
authentication:
|
|
44
|
+
type: bearer
|
|
45
|
+
location: header
|
|
46
|
+
name: Authorization
|
|
47
|
+
notes:
|
|
48
|
+
env: MATIMO_HUBSPOT_API_KEY
|
|
49
|
+
|
|
50
|
+
output_schema:
|
|
51
|
+
type: object
|
|
52
|
+
properties:
|
|
53
|
+
id: { type: string }
|
|
54
|
+
properties: { type: object }
|
|
55
|
+
createdAt: { type: string }
|
|
56
|
+
updatedAt: { type: string }
|
|
57
|
+
archived: { type: boolean }
|
|
58
|
+
required: [id, properties, createdAt, updatedAt, archived]
|
|
59
|
+
|
|
60
|
+
error_handling:
|
|
61
|
+
retry: 2
|
|
62
|
+
backoff_type: exponential
|
|
63
|
+
initial_delay_ms: 500
|
|
64
|
+
|
|
65
|
+
examples:
|
|
66
|
+
- name: 'Create contact with email and name'
|
|
67
|
+
params:
|
|
68
|
+
email: 'test@example.com'
|
|
69
|
+
firstname: 'Test'
|
|
70
|
+
lastname: 'User'
|
|
71
|
+
expected_result: 'Contact created with id and properties.'
|
|
72
|
+
- name: 'Create contact with all fields'
|
|
73
|
+
params:
|
|
74
|
+
email: 'custom@example.com'
|
|
75
|
+
firstname: 'John'
|
|
76
|
+
lastname: 'Doe'
|
|
77
|
+
phone: '+1234567890'
|
|
78
|
+
company: 'Acme Corp'
|
|
79
|
+
expected_result: 'Contact created with all properties.'
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: hubspot-create-custom-object
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: Create a new custom object in HubSpot CRM.
|
|
4
|
+
|
|
5
|
+
parameters:
|
|
6
|
+
object_type:
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
description: The custom object type ID (e.g., 'my_custom_object')
|
|
10
|
+
name:
|
|
11
|
+
type: string
|
|
12
|
+
required: false
|
|
13
|
+
description: Custom object name
|
|
14
|
+
description:
|
|
15
|
+
type: string
|
|
16
|
+
required: false
|
|
17
|
+
description: Custom object description
|
|
18
|
+
|
|
19
|
+
execution:
|
|
20
|
+
type: http
|
|
21
|
+
method: POST
|
|
22
|
+
url: 'https://api.hubapi.com/crm/v3/objects/{object_type}'
|
|
23
|
+
headers:
|
|
24
|
+
Authorization: 'Bearer {MATIMO_HUBSPOT_API_KEY}'
|
|
25
|
+
Content-Type: application/json
|
|
26
|
+
body:
|
|
27
|
+
properties:
|
|
28
|
+
name: '{name}'
|
|
29
|
+
description: '{description}'
|
|
30
|
+
timeout: 30000
|
|
31
|
+
|
|
32
|
+
authentication:
|
|
33
|
+
type: bearer
|
|
34
|
+
location: header
|
|
35
|
+
name: Authorization
|
|
36
|
+
|
|
37
|
+
output_schema:
|
|
38
|
+
type: object
|
|
39
|
+
properties:
|
|
40
|
+
id:
|
|
41
|
+
type: string
|
|
42
|
+
properties:
|
|
43
|
+
type: object
|
|
44
|
+
|
|
45
|
+
error_handling:
|
|
46
|
+
retry: 2
|
|
47
|
+
backoff_type: exponential
|
|
48
|
+
initial_delay_ms: 500
|
|
49
|
+
|
|
50
|
+
requires_approval: false
|
|
51
|
+
|
|
52
|
+
examples:
|
|
53
|
+
- name: Create a custom object
|
|
54
|
+
params:
|
|
55
|
+
object_type: my_custom_object
|
|
56
|
+
name: Custom Object 1
|
|
57
|
+
expected_result: Custom object created with id and properties.
|