@orchesty/connector-hubspot 1.0.1 → 2.0.0
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/README.md +102 -0
- package/dist/HubSpotApplication.d.ts +1 -0
- package/dist/HubSpotApplication.js +5 -5
- package/dist/package.json +2 -3
- package/package.json +3 -4
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# HubSpot Connector
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@orchesty/connector-hubspot)
|
|
4
|
+
[](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE)
|
|
5
|
+
|
|
6
|
+
An [Orchesty](https://orchesty.io) connector for HubSpot, a CRM platform offering tools for marketing, sales, content management, and customer service.
|
|
7
|
+
|
|
8
|
+
## Application Type
|
|
9
|
+
|
|
10
|
+
This package provides two application variants:
|
|
11
|
+
|
|
12
|
+
**OAuth 2.0 (`HubSpotApplication`)** — The primary application using HubSpot's OAuth 2.0 authorization flow. Also implements webhook support for real-time notifications.
|
|
13
|
+
|
|
14
|
+
| Field | Description |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `client_id` | OAuth Client ID from your HubSpot app |
|
|
17
|
+
| `client_secret` | OAuth Client Secret from your HubSpot app |
|
|
18
|
+
| `app_id` | Your HubSpot App ID (required for webhook management) |
|
|
19
|
+
|
|
20
|
+
**Basic (`HubSpotApplicationBasic`)** — An alternative using a static API token (Private App token), suitable for simpler integrations without the OAuth flow.
|
|
21
|
+
|
|
22
|
+
| Field | Description |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `token` | Your HubSpot Private App access token |
|
|
25
|
+
|
|
26
|
+
## Components
|
|
27
|
+
|
|
28
|
+
| Class | Type | Description |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `HubSpotCreateContactConnector` | Connector | Creates a new CRM contact via `POST /crm/v3/objects/contacts` |
|
|
31
|
+
| `HubSpotAddEmailToListConnector` | Connector | Adds contacts to a list by email via `POST /contacts/v1/lists/{listId}/add` |
|
|
32
|
+
| `HubSpotSendTransactionEmailConnector` | Connector | Sends a transactional email via `POST /marketing/v3/transactional/single-email/send` |
|
|
33
|
+
|
|
34
|
+
### Webhook Subscriptions
|
|
35
|
+
|
|
36
|
+
| Event | Description |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `contact.creation` | Triggered when a new contact is created |
|
|
39
|
+
| `contact.deletion` | Triggered when a contact is deleted |
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
### Credentials (OAuth 2.0)
|
|
44
|
+
|
|
45
|
+
1. Log in to your [HubSpot Developer](https://developers.hubspot.com) account.
|
|
46
|
+
2. Navigate to **Apps** and create a new app (or open an existing one).
|
|
47
|
+
3. Under **Auth**, note your **Client ID** and **Client Secret**.
|
|
48
|
+
4. Add the Orchesty OAuth callback URL to the **Redirect URLs** list.
|
|
49
|
+
5. Note your **App ID** from the app overview page.
|
|
50
|
+
6. In Orchesty, open the HubSpot application settings, enter the credentials, and complete the OAuth authorization flow.
|
|
51
|
+
|
|
52
|
+
### Credentials (Basic / Private App)
|
|
53
|
+
|
|
54
|
+
1. In HubSpot, navigate to **Settings → Integrations → Private Apps**.
|
|
55
|
+
2. Create a new Private App and assign the required scopes.
|
|
56
|
+
3. Copy the generated **Access Token** and paste it into the **token** field in Orchesty.
|
|
57
|
+
|
|
58
|
+
### API Documentation
|
|
59
|
+
|
|
60
|
+
HubSpot API Reference: [https://developers.hubspot.com/docs/api/overview](https://developers.hubspot.com/docs/api/overview)
|
|
61
|
+
|
|
62
|
+
## Installation & Usage
|
|
63
|
+
|
|
64
|
+
Install the package:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install @orchesty/connector-hubspot @orchesty/nodejs-sdk
|
|
68
|
+
# or
|
|
69
|
+
pnpm add @orchesty/connector-hubspot @orchesty/nodejs-sdk
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Register the application and nodes in your Orchesty DI container:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { container } from '@orchesty/nodejs-sdk';
|
|
76
|
+
import { OAuth2Provider } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Provider/OAuth2/OAuth2Provider';
|
|
77
|
+
import HubSpotApplication from '@orchesty/connector-hubspot/dist/HubSpotApplication';
|
|
78
|
+
import HubSpotCreateContactConnector from '@orchesty/connector-hubspot/dist/Connector/HubSpotCreateContactConnector';
|
|
79
|
+
import HubSpotAddEmailToListConnector from '@orchesty/connector-hubspot/dist/Connector/HubSpotAddEmailToListConnector';
|
|
80
|
+
import HubSpotSendTransactionEmailConnector from '@orchesty/connector-hubspot/dist/Connector/HubSpotSendTransactionEmailConnector';
|
|
81
|
+
|
|
82
|
+
const app = new HubSpotApplication(container.get(OAuth2Provider));
|
|
83
|
+
container.setApplication(app);
|
|
84
|
+
container.setNode(new HubSpotCreateContactConnector(), app);
|
|
85
|
+
container.setNode(new HubSpotAddEmailToListConnector(), app);
|
|
86
|
+
container.setNode(new HubSpotSendTransactionEmailConnector(), app);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
This connector is released under the **Apache License 2.0**. See the [LICENSE](https://github.com/Orchesty/orchesty-nodejs-connectors/blob/master/LICENSE) file for the full license text.
|
|
92
|
+
|
|
93
|
+
## Contributing
|
|
94
|
+
|
|
95
|
+
Contributions are welcome! This connector is part of the open-source [Orchesty Node.js Connectors](https://github.com/Orchesty/orchesty-nodejs-connectors) monorepo.
|
|
96
|
+
|
|
97
|
+
For guidelines on how to create or update connectors — including project setup, coding conventions, and how to write tests — please refer to the **[Contributing to Connectors](https://orchesty.io/community/contributing-to-connectors)** guide.
|
|
98
|
+
|
|
99
|
+
All contributions should include:
|
|
100
|
+
- Source code in `src/` following the existing connector structure
|
|
101
|
+
- Tests in `src/**/__tests__/` with `input.json`, `mock.json`, and `output.json` fixtures
|
|
102
|
+
- An updated `CHANGELOG.md` entry
|
|
@@ -9,6 +9,7 @@ import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto'
|
|
|
9
9
|
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
|
|
10
10
|
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
11
11
|
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
12
|
+
export declare const NAME = "hub-spot";
|
|
12
13
|
export declare const APP_ID = "app_id";
|
|
13
14
|
export declare const BASE_URL = "https://api.hubapi.com";
|
|
14
15
|
export default class HubSpotApplication extends AOAuth2Application implements IWebhookApplication {
|
|
@@ -36,8 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BASE_URL = exports.APP_ID = void 0;
|
|
40
|
-
const GitHubApplication_1 = require("@orchesty/connector-git-hub/src/GitHubApplication");
|
|
39
|
+
exports.BASE_URL = exports.APP_ID = exports.NAME = void 0;
|
|
41
40
|
const ApplicationTypeEnum_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/ApplicationTypeEnum"));
|
|
42
41
|
const CoreFormsEnum_1 = __importStar(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum"));
|
|
43
42
|
const Field_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field"));
|
|
@@ -53,6 +52,7 @@ const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMetho
|
|
|
53
52
|
const Headers_1 = require("@orchesty/nodejs-sdk/dist/lib/Utils/Headers");
|
|
54
53
|
const ProcessDto_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto"));
|
|
55
54
|
const http_status_codes_1 = require("http-status-codes");
|
|
55
|
+
exports.NAME = 'hub-spot';
|
|
56
56
|
exports.APP_ID = 'app_id';
|
|
57
57
|
exports.BASE_URL = 'https://api.hubapi.com';
|
|
58
58
|
class HubSpotApplication extends AOAuth2Application_1.default {
|
|
@@ -60,7 +60,7 @@ class HubSpotApplication extends AOAuth2Application_1.default {
|
|
|
60
60
|
return ApplicationTypeEnum_1.default.WEBHOOK;
|
|
61
61
|
}
|
|
62
62
|
getName() {
|
|
63
|
-
return
|
|
63
|
+
return exports.NAME;
|
|
64
64
|
}
|
|
65
65
|
getPublicName() {
|
|
66
66
|
return 'HubSpot';
|
|
@@ -117,12 +117,12 @@ class HubSpotApplication extends AOAuth2Application_1.default {
|
|
|
117
117
|
},
|
|
118
118
|
enabled: false,
|
|
119
119
|
});
|
|
120
|
-
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(
|
|
120
|
+
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), applicationInstall.getSdk(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.POST, hubspotUrl, body);
|
|
121
121
|
}
|
|
122
122
|
getWebhookUnsubscribeRequestDto(applicationInstall, webhook) {
|
|
123
123
|
const url = `${exports.BASE_URL}/webhooks/v1/${applicationInstall
|
|
124
124
|
.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.APP_ID]}/subscriptions/${webhook.getWebhookId()}`;
|
|
125
|
-
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(
|
|
125
|
+
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), applicationInstall.getSdk(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.DELETE, url);
|
|
126
126
|
}
|
|
127
127
|
processWebhookSubscribeResponse(dto, applicationInstall) {
|
|
128
128
|
const jsonBody = dto.getJsonBody();
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchesty/connector-hubspot",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
7
7
|
"repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"keywords": [],
|
|
18
18
|
"author": "info@hanaboso.com",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orchesty/
|
|
21
|
-
"@orchesty/nodejs-sdk": "^4.3.6",
|
|
20
|
+
"@orchesty/nodejs-sdk": "^5.0.8",
|
|
22
21
|
"http-status-codes": "^2.3.0"
|
|
23
22
|
},
|
|
24
23
|
"engines": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchesty/connector-hubspot",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
7
7
|
"repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"author": "info@hanaboso.com",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@orchesty/nodejs-sdk": "^
|
|
15
|
-
"http-status-codes": "^2.3.0"
|
|
16
|
-
"@orchesty/connector-git-hub": "1.0.1"
|
|
14
|
+
"@orchesty/nodejs-sdk": "^5.0.8",
|
|
15
|
+
"http-status-codes": "^2.3.0"
|
|
17
16
|
},
|
|
18
17
|
"engines": {
|
|
19
18
|
"node": ">=24"
|