@zerodot/hubspot 0.0.0-stage → 1.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/LICENSE +661 -0
- package/README.md +62 -2
- package/dist/index.cjs +4183 -0
- package/hubspot.svg +1 -0
- package/package.json +46 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4183 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
let _zerodot_node_sdk = require("@zerodot/node-sdk");
|
|
4
|
+
let node_crypto = require("node:crypto");
|
|
5
|
+
// src/api.ts
|
|
6
|
+
const HUBSPOT_TOKEN_CREDENTIAL = "hubspot.appToken";
|
|
7
|
+
const HUBSPOT_OAUTH2_CREDENTIAL = "hubspot.oauth2";
|
|
8
|
+
const HUBSPOT_DEVELOPER_CREDENTIAL = "hubspot.developerApi";
|
|
9
|
+
const HUBSPOT_API = "https://api.hubapi.com";
|
|
10
|
+
const text = (value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
11
|
+
/** The access of a service key credential or an OAuth2 credential. */
|
|
12
|
+
function hubspotAccess(credential) {
|
|
13
|
+
if (credential?.type === "hubspot.appToken") {
|
|
14
|
+
const token = text(credential.data.appToken);
|
|
15
|
+
if (!token) throw new Error("The credential has no \"appToken\"");
|
|
16
|
+
return {
|
|
17
|
+
kind: "bearer",
|
|
18
|
+
token
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (credential?.type === "hubspot.oauth2") {
|
|
22
|
+
const token = text(credential.data.accessToken);
|
|
23
|
+
if (!token) throw new Error("The HubSpot credential is not connected to an account yet");
|
|
24
|
+
return {
|
|
25
|
+
kind: "bearer",
|
|
26
|
+
token
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
throw new Error("The node needs a HubSpot service key or a HubSpot OAuth2 credential");
|
|
30
|
+
}
|
|
31
|
+
/** The developer API credential of an app. The trigger uses it. */
|
|
32
|
+
function developerAccess(credential) {
|
|
33
|
+
if (!credential || credential.type !== "hubspot.developerApi") throw new Error("The trigger needs a HubSpot developer API credential");
|
|
34
|
+
const appId = text(credential.data.appId);
|
|
35
|
+
const apiKey = text(credential.data.apiKey);
|
|
36
|
+
const clientSecret = text(credential.data.clientSecret);
|
|
37
|
+
if (!appId) throw new Error("The credential has no \"appId\"");
|
|
38
|
+
if (!apiKey) throw new Error("The credential has no \"apiKey\"");
|
|
39
|
+
if (!clientSecret) throw new Error("The credential has no \"clientSecret\"");
|
|
40
|
+
return {
|
|
41
|
+
appId,
|
|
42
|
+
apiKey,
|
|
43
|
+
clientSecret
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var HubspotError = class extends Error {
|
|
47
|
+
status;
|
|
48
|
+
constructor(message, status) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.name = "HubspotError";
|
|
51
|
+
this.status = status;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/** Short help for the statuses that people see most. */
|
|
55
|
+
const HINTS = {
|
|
56
|
+
401: "HubSpot did not accept the credential",
|
|
57
|
+
403: "The credential has not the scope for this call",
|
|
58
|
+
404: "HubSpot did not find the resource. Check the IDs",
|
|
59
|
+
429: "HubSpot limits the requests. Try again later"
|
|
60
|
+
};
|
|
61
|
+
/** The error for an answer with an error status. The text never has the credential. */
|
|
62
|
+
function hubspotErrorOf(label, status, answer) {
|
|
63
|
+
const parts = [`HubSpot ${label} failed (${status})`];
|
|
64
|
+
if (typeof answer === "object" && answer !== null && !Array.isArray(answer)) {
|
|
65
|
+
const body = answer;
|
|
66
|
+
if (typeof body.message === "string" && body.message) parts.push(body.message);
|
|
67
|
+
}
|
|
68
|
+
const hint = HINTS[status];
|
|
69
|
+
if (hint) parts.push(hint);
|
|
70
|
+
return new HubspotError(parts.join(". "), status);
|
|
71
|
+
}
|
|
72
|
+
/** One call. A 204 answer, and an empty body, give `null`. */
|
|
73
|
+
async function callHubspot(access, call, options) {
|
|
74
|
+
const url = new URL(`${HUBSPOT_API}${call.path}`);
|
|
75
|
+
for (const [key, value] of Object.entries(call.query ?? {})) {
|
|
76
|
+
if (value === void 0 || value === "") continue;
|
|
77
|
+
if (typeof value === "object") for (const item of value) url.searchParams.append(key, item);
|
|
78
|
+
else url.searchParams.set(key, String(value));
|
|
79
|
+
}
|
|
80
|
+
if (access.kind === "hapikey") url.searchParams.set("hapikey", access.key);
|
|
81
|
+
const label = `${call.method} ${call.path.split("?")[0]?.split("/").slice(1, 3).join("/") ?? ""}`;
|
|
82
|
+
const response = await fetch(url, {
|
|
83
|
+
method: call.method,
|
|
84
|
+
headers: {
|
|
85
|
+
accept: "application/json",
|
|
86
|
+
...access.kind === "bearer" ? { authorization: `Bearer ${access.token}` } : {},
|
|
87
|
+
...call.body !== void 0 ? { "content-type": "application/json" } : {}
|
|
88
|
+
},
|
|
89
|
+
body: call.body !== void 0 ? JSON.stringify(call.body) : void 0,
|
|
90
|
+
redirect: "error",
|
|
91
|
+
signal: AbortSignal.any([options.signal, AbortSignal.timeout(options.timeoutMs)])
|
|
92
|
+
});
|
|
93
|
+
const raw = response.status === 204 ? "" : await response.text();
|
|
94
|
+
let answer = null;
|
|
95
|
+
if (raw !== "") try {
|
|
96
|
+
answer = JSON.parse(raw);
|
|
97
|
+
} catch {
|
|
98
|
+
answer = null;
|
|
99
|
+
}
|
|
100
|
+
if (!response.ok) throw hubspotErrorOf(label, response.status, answer);
|
|
101
|
+
return answer;
|
|
102
|
+
}
|
|
103
|
+
const readPath = (value, path) => {
|
|
104
|
+
let node = value;
|
|
105
|
+
for (const key of path.split(".")) {
|
|
106
|
+
if (typeof node !== "object" || node === null) return void 0;
|
|
107
|
+
node = node[key];
|
|
108
|
+
}
|
|
109
|
+
return node;
|
|
110
|
+
};
|
|
111
|
+
const isEmpty = (value) => value === void 0 || value === null || value === "" || value === false;
|
|
112
|
+
/**
|
|
113
|
+
* A list. Reads pages until it has `limit` items, or all items when `limit` is null.
|
|
114
|
+
* The page size is never more than the limit of the endpoint.
|
|
115
|
+
*/
|
|
116
|
+
async function callHubspotList(access, call, spec, limit, options) {
|
|
117
|
+
const hardCap = spec.maxResults ?? 5e3;
|
|
118
|
+
const wanted = Math.min(limit ?? hardCap, hardCap);
|
|
119
|
+
const items = [];
|
|
120
|
+
const cursor = {};
|
|
121
|
+
while (items.length < wanted) {
|
|
122
|
+
const cap = spec.maxResults ?? Number.POSITIVE_INFINITY;
|
|
123
|
+
if (items.length >= cap) break;
|
|
124
|
+
const size = Math.min(spec.pageMax, wanted - items.length, cap - items.length);
|
|
125
|
+
const query = { ...call.query };
|
|
126
|
+
const body = call.body !== void 0 && typeof call.body === "object" && call.body !== null ? { ...call.body } : void 0;
|
|
127
|
+
const put = (key, value) => {
|
|
128
|
+
if (spec.place === "body" && body) body[key] = value;
|
|
129
|
+
else query[key] = typeof value === "number" || typeof value === "string" ? value : JSON.stringify(value);
|
|
130
|
+
};
|
|
131
|
+
put(spec.sizeParam, size);
|
|
132
|
+
for (const { param } of spec.cursors) if (!isEmpty(cursor[param])) put(param, cursor[param]);
|
|
133
|
+
const page = await callHubspot(access, {
|
|
134
|
+
...call,
|
|
135
|
+
query,
|
|
136
|
+
body: body ?? call.body
|
|
137
|
+
}, options);
|
|
138
|
+
const found = readPath(page, spec.itemsKey);
|
|
139
|
+
if (!Array.isArray(found) || found.length === 0) break;
|
|
140
|
+
items.push(...found);
|
|
141
|
+
let more;
|
|
142
|
+
if (spec.more === "paging") more = !isEmpty(readPath(page, "paging.next.after"));
|
|
143
|
+
else more = readPath(page, "hasMore") === true || readPath(page, "has-more") === true;
|
|
144
|
+
if (!more) break;
|
|
145
|
+
let moved = false;
|
|
146
|
+
for (const { param, from } of spec.cursors) {
|
|
147
|
+
const next = readPath(page, from);
|
|
148
|
+
if (!isEmpty(next)) moved = true;
|
|
149
|
+
cursor[param] = next;
|
|
150
|
+
}
|
|
151
|
+
if (!moved) break;
|
|
152
|
+
}
|
|
153
|
+
return items.slice(0, wanted);
|
|
154
|
+
}
|
|
155
|
+
// src/icon.ts
|
|
156
|
+
const HUBSPOT_ICON = (0, _zerodot_node_sdk.fileIcon)(require("url").pathToFileURL(__filename).href, "../hubspot.svg");
|
|
157
|
+
// src/credential.ts
|
|
158
|
+
const TIMEOUT_MS$1 = 1e4;
|
|
159
|
+
const HUBSPOT_OAUTH2 = {
|
|
160
|
+
authUrl: "https://app.hubspot.com/oauth/authorize",
|
|
161
|
+
tokenUrl: "https://api.hubapi.com/oauth/v1/token",
|
|
162
|
+
scopes: [
|
|
163
|
+
"crm.lists.write",
|
|
164
|
+
"crm.objects.contacts.read",
|
|
165
|
+
"crm.objects.contacts.write",
|
|
166
|
+
"crm.objects.companies.read",
|
|
167
|
+
"crm.objects.companies.write",
|
|
168
|
+
"crm.objects.deals.read",
|
|
169
|
+
"crm.objects.deals.write",
|
|
170
|
+
"crm.objects.owners.read",
|
|
171
|
+
"crm.schemas.companies.read",
|
|
172
|
+
"crm.schemas.contacts.read",
|
|
173
|
+
"crm.schemas.deals.read",
|
|
174
|
+
"forms",
|
|
175
|
+
"tickets"
|
|
176
|
+
],
|
|
177
|
+
authQuery: { grant_type: "authorization_code" },
|
|
178
|
+
authentication: "body"
|
|
179
|
+
};
|
|
180
|
+
/** Fields that only the server writes, after the user connects the account. */
|
|
181
|
+
const OAUTH2_TOKEN_FIELDS = [
|
|
182
|
+
"accessToken",
|
|
183
|
+
"refreshToken",
|
|
184
|
+
"expiresAt",
|
|
185
|
+
"tokenType",
|
|
186
|
+
"grantedScope"
|
|
187
|
+
];
|
|
188
|
+
/** Asks for one contact. Any answer that is not 2xx fails the test. */
|
|
189
|
+
async function check(credential) {
|
|
190
|
+
await callHubspot(hubspotAccess(credential), {
|
|
191
|
+
method: "GET",
|
|
192
|
+
path: "/crm/v3/objects/contacts",
|
|
193
|
+
query: { limit: 1 }
|
|
194
|
+
}, {
|
|
195
|
+
signal: AbortSignal.timeout(TIMEOUT_MS$1),
|
|
196
|
+
timeoutMs: TIMEOUT_MS$1
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const hubspotTokenCredential = {
|
|
200
|
+
type: HUBSPOT_TOKEN_CREDENTIAL,
|
|
201
|
+
label: "HubSpot service key",
|
|
202
|
+
fields: zod.z.object({
|
|
203
|
+
/** From HubSpot: Development, Keys, Service keys. */
|
|
204
|
+
appToken: zod.z.string().min(1).meta({
|
|
205
|
+
title: "Service Key",
|
|
206
|
+
placeholder: "pat-na1-…"
|
|
207
|
+
}) }),
|
|
208
|
+
secretFields: ["appToken"],
|
|
209
|
+
icon: "UserGroupIcon",
|
|
210
|
+
iconUrl: HUBSPOT_ICON,
|
|
211
|
+
test: check
|
|
212
|
+
};
|
|
213
|
+
const hubspotOAuth2Credential = {
|
|
214
|
+
type: HUBSPOT_OAUTH2_CREDENTIAL,
|
|
215
|
+
label: "HubSpot OAuth2",
|
|
216
|
+
fields: zod.z.object({
|
|
217
|
+
clientId: zod.z.string().min(1),
|
|
218
|
+
clientSecret: zod.z.string().min(1),
|
|
219
|
+
accessToken: zod.z.string().min(1).optional(),
|
|
220
|
+
refreshToken: zod.z.string().min(1).optional(),
|
|
221
|
+
/** ISO 8601 time. */
|
|
222
|
+
expiresAt: zod.z.iso.datetime().optional(),
|
|
223
|
+
tokenType: zod.z.string().min(1).optional(),
|
|
224
|
+
grantedScope: zod.z.string().optional()
|
|
225
|
+
}),
|
|
226
|
+
secretFields: [
|
|
227
|
+
"clientSecret",
|
|
228
|
+
"accessToken",
|
|
229
|
+
"refreshToken"
|
|
230
|
+
],
|
|
231
|
+
serverFields: [...OAUTH2_TOKEN_FIELDS],
|
|
232
|
+
oauth2: HUBSPOT_OAUTH2,
|
|
233
|
+
icon: "UserGroupIcon",
|
|
234
|
+
iconUrl: HUBSPOT_ICON,
|
|
235
|
+
test: check
|
|
236
|
+
};
|
|
237
|
+
/** The credential of an app. The trigger uses it for the webhook settings and the signature. */
|
|
238
|
+
const hubspotDeveloperCredential = {
|
|
239
|
+
type: HUBSPOT_DEVELOPER_CREDENTIAL,
|
|
240
|
+
label: "HubSpot developer API",
|
|
241
|
+
fields: zod.z.object({
|
|
242
|
+
/** The key of the developer account. It sets the webhook settings of the app. */
|
|
243
|
+
apiKey: zod.z.string().min(1).meta({ title: "Developer API Key" }),
|
|
244
|
+
appId: zod.z.string().min(1).meta({ title: "App ID" }),
|
|
245
|
+
clientId: zod.z.string().min(1).optional().meta({ title: "Client ID" }),
|
|
246
|
+
/** HubSpot signs each webhook request with the client secret of the app. */
|
|
247
|
+
clientSecret: zod.z.string().min(1).meta({ title: "Client Secret" })
|
|
248
|
+
}),
|
|
249
|
+
secretFields: ["apiKey", "clientSecret"],
|
|
250
|
+
icon: "UserGroupIcon",
|
|
251
|
+
iconUrl: HUBSPOT_ICON,
|
|
252
|
+
async test({ data }) {
|
|
253
|
+
const appId = typeof data.appId === "string" ? data.appId.trim() : "";
|
|
254
|
+
const key = typeof data.apiKey === "string" ? data.apiKey.trim() : "";
|
|
255
|
+
if (!appId || !key) throw new Error("The credential needs an app ID and a developer API key");
|
|
256
|
+
try {
|
|
257
|
+
await callHubspot({
|
|
258
|
+
kind: "hapikey",
|
|
259
|
+
key
|
|
260
|
+
}, {
|
|
261
|
+
method: "GET",
|
|
262
|
+
path: `/webhooks/v3/${encodeURIComponent(appId)}/settings`
|
|
263
|
+
}, {
|
|
264
|
+
signal: AbortSignal.timeout(TIMEOUT_MS$1),
|
|
265
|
+
timeoutMs: TIMEOUT_MS$1
|
|
266
|
+
});
|
|
267
|
+
} catch (error) {
|
|
268
|
+
if (error instanceof HubspotError && error.status === 404) return;
|
|
269
|
+
if (error instanceof HubspotError && (error.status === 401 || error.status === 403)) throw new Error("HubSpot did not accept the developer API key for this app");
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
// src/fields.ts
|
|
275
|
+
const CONTACT_FIELDS = [
|
|
276
|
+
{
|
|
277
|
+
key: "annualRevenue",
|
|
278
|
+
prop: "annualrevenue",
|
|
279
|
+
kind: "numberText",
|
|
280
|
+
title: "Annual Revenue"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
key: "buyingRole",
|
|
284
|
+
prop: "hs_buying_role",
|
|
285
|
+
kind: "multi",
|
|
286
|
+
title: "Buying Role",
|
|
287
|
+
description: "Role the contact plays during the sales process. Contacts can have multiple roles, and can share roles with others.",
|
|
288
|
+
options: [
|
|
289
|
+
["BLOCKER", "Blocker"],
|
|
290
|
+
["BUDGET_HOLDER", "Budget Holder"],
|
|
291
|
+
["CHAMPION", "Champion"],
|
|
292
|
+
["DECISION_MAKER", "Decision Maker"],
|
|
293
|
+
["END_USER", "End User"],
|
|
294
|
+
["EXECUTIVE_SPONSOR", "Executive Sponsor"],
|
|
295
|
+
["INFLUENCER", "Influencer"],
|
|
296
|
+
["LEGAL_AND_COMPLIANCE", "Legal & Compliance"],
|
|
297
|
+
["OTHER", "Other"]
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: "city",
|
|
302
|
+
prop: "city",
|
|
303
|
+
kind: "string",
|
|
304
|
+
title: "City"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
key: "clickedFacebookAd",
|
|
308
|
+
prop: "hs_facebook_ad_clicked",
|
|
309
|
+
kind: "string",
|
|
310
|
+
title: "Clicked Facebook Ad"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
key: "closeDate",
|
|
314
|
+
prop: "closedate",
|
|
315
|
+
kind: "dateMs",
|
|
316
|
+
title: "Close Date",
|
|
317
|
+
description: "A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
key: "companyName",
|
|
321
|
+
prop: "company",
|
|
322
|
+
kind: "string",
|
|
323
|
+
title: "Company Name"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
key: "companySize",
|
|
327
|
+
prop: "company_size",
|
|
328
|
+
kind: "string",
|
|
329
|
+
title: "Company Size"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
key: "contactOwner",
|
|
333
|
+
prop: "hubspot_owner_id",
|
|
334
|
+
kind: "string",
|
|
335
|
+
title: "Contact Owner"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
key: "country",
|
|
339
|
+
prop: "country",
|
|
340
|
+
kind: "string",
|
|
341
|
+
title: "Country/Region"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "countryRegionCode",
|
|
345
|
+
prop: "hs_country_region_code",
|
|
346
|
+
kind: "string",
|
|
347
|
+
title: "Country/Region Code",
|
|
348
|
+
description: "The contact's two-letter country code"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
key: "dateOfBirth",
|
|
352
|
+
prop: "date_of_birth",
|
|
353
|
+
kind: "dateRaw",
|
|
354
|
+
title: "Date of Birth",
|
|
355
|
+
description: "A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
key: "degree",
|
|
359
|
+
prop: "degree",
|
|
360
|
+
kind: "string",
|
|
361
|
+
title: "Degree"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
key: "emailCustomerQuarantinedReason",
|
|
365
|
+
prop: "hs_email_customer_quarantined_reason",
|
|
366
|
+
kind: "enum",
|
|
367
|
+
title: "Email Address Quarantine Reason",
|
|
368
|
+
description: "The reason why the email address has been quarantined",
|
|
369
|
+
options: [
|
|
370
|
+
["SUSPENSION_REMEDIATION", "Suspension Remediation"],
|
|
371
|
+
["BLOCKLIST_REMEDIATION", "Blocklist Remediation"],
|
|
372
|
+
["TRUST_SAFETY_REMEDIATION", "Trust & Safety Remediation"]
|
|
373
|
+
]
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
key: "employmentRole",
|
|
377
|
+
prop: "hs_role",
|
|
378
|
+
kind: "enum",
|
|
379
|
+
title: "Employment Role",
|
|
380
|
+
description: "Job role",
|
|
381
|
+
options: [
|
|
382
|
+
["accounting", "Accounting"],
|
|
383
|
+
["administrative", "Administrative"],
|
|
384
|
+
["business_development", "Business Development"],
|
|
385
|
+
["communications", "Communications"],
|
|
386
|
+
["consulting", "Consulting"],
|
|
387
|
+
["customer_service", "Customer Service"],
|
|
388
|
+
["design", "Design"],
|
|
389
|
+
["education", "Education"],
|
|
390
|
+
["engineering", "Engineering"],
|
|
391
|
+
["entrepreneurship", "Entrepreneurship"],
|
|
392
|
+
["finance", "Finance"],
|
|
393
|
+
["health_professional", "Health Professional"],
|
|
394
|
+
["human_resources", "Human Resources"],
|
|
395
|
+
["information_technology", "Information Technology"],
|
|
396
|
+
["legal", "Legal"],
|
|
397
|
+
["marketing", "Marketing"],
|
|
398
|
+
["operations", "Operations"],
|
|
399
|
+
["product", "Product"],
|
|
400
|
+
["project_management", "Project Management"],
|
|
401
|
+
["public_relations", "Public Relations"],
|
|
402
|
+
["quality_assurance", "Quality Assurance"],
|
|
403
|
+
["real_estate", "Real Estate"],
|
|
404
|
+
["recruiting", "Recruiting"],
|
|
405
|
+
["research", "Research"],
|
|
406
|
+
["retired", "Retired"],
|
|
407
|
+
["sales", "Sales"],
|
|
408
|
+
["support", "Support"]
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
key: "employmentSeniority",
|
|
413
|
+
prop: "hs_seniority",
|
|
414
|
+
kind: "enum",
|
|
415
|
+
title: "Employment Seniority",
|
|
416
|
+
description: "Job Seniority",
|
|
417
|
+
options: [
|
|
418
|
+
["director", "Director"],
|
|
419
|
+
["employee", "Employee"],
|
|
420
|
+
["entry", "Entry"],
|
|
421
|
+
["executive", "Executive"],
|
|
422
|
+
["manager", "Manager"],
|
|
423
|
+
["owner", "Owner"],
|
|
424
|
+
["partner", "Partner"],
|
|
425
|
+
["senior", "Senior"],
|
|
426
|
+
["vp", "VP"]
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
key: "employmentSubRole",
|
|
431
|
+
prop: "hs_sub_role",
|
|
432
|
+
kind: "enum",
|
|
433
|
+
title: "Employment Sub Role",
|
|
434
|
+
description: "Job sub role",
|
|
435
|
+
options: [
|
|
436
|
+
["account_executive", "Account Executive"],
|
|
437
|
+
["account_manager", "Account Manager"],
|
|
438
|
+
["accountant", "Accountant"],
|
|
439
|
+
["accounting_manager", "Accounting Manager"],
|
|
440
|
+
["administrative_assistant", "Administrative Assistant"],
|
|
441
|
+
["appraisal", "Appraisal"],
|
|
442
|
+
["architect_it", "Architect IT"],
|
|
443
|
+
["assistant", "Assistant"],
|
|
444
|
+
["attorney", "Attorney"],
|
|
445
|
+
["auditor", "Auditor"],
|
|
446
|
+
["brand_marketing", "Brand Marketing"],
|
|
447
|
+
["business_analyst", "Business Analyst"],
|
|
448
|
+
["business_consultant", "Business Consultant"],
|
|
449
|
+
["business_manager", "Business Manager"],
|
|
450
|
+
["chief_compliance_officer", "Chief Compliance Officer"],
|
|
451
|
+
["chief_data_officer", "Chief Data Officer"],
|
|
452
|
+
["chief_executive_officer", "Chief Executive Officer"],
|
|
453
|
+
["chief_experience_officer", "Chief Experience Officer"],
|
|
454
|
+
["chief_financial_officer", "Chief Financial Officer"],
|
|
455
|
+
["chief_human_resources_officer", "Chief Human Resources Officer"],
|
|
456
|
+
["chief_information_officer", "Chief Information Officer"],
|
|
457
|
+
["chief_innovation_officer", "Chief Innovation Officer"],
|
|
458
|
+
["chief_legal_officer", "Chief Legal Officer"],
|
|
459
|
+
["chief_marketing_officer", "Chief Marketing Officer"],
|
|
460
|
+
["chief_operating_officer", "Chief Operating Officer"],
|
|
461
|
+
["chief_product_officer", "Chief Product Officer"],
|
|
462
|
+
["chief_revenue_officer", "Chief Revenue Officer"],
|
|
463
|
+
["chief_risk_officer", "Chief Risk Officer"],
|
|
464
|
+
["chief_security_officer", "Chief Security Officer"],
|
|
465
|
+
["chief_sustainability_officer", "Chief Sustainability Officer"],
|
|
466
|
+
["chief_technology_officer", "Chief Technology Officer"],
|
|
467
|
+
["communications_manager", "Communications Manager"],
|
|
468
|
+
["community", "Community"],
|
|
469
|
+
["content_marketing", "Content Marketing"],
|
|
470
|
+
["contracts", "Contracts"],
|
|
471
|
+
["creative", "Creative"],
|
|
472
|
+
["customer_service_specialist", "Customer Service Specialist"],
|
|
473
|
+
["customer_success", "Customer Success"],
|
|
474
|
+
["data_it", "Data IT"],
|
|
475
|
+
["data_science_engineer", "Data Science Engineer"],
|
|
476
|
+
["database_administrator", "Database Administrator"],
|
|
477
|
+
["design_engineer", "Design Engineer"],
|
|
478
|
+
["development_specialist", "Development Specialist"],
|
|
479
|
+
["devops_engineer", "Devops Engineer"],
|
|
480
|
+
["digital_marketing", "Digital Marketing"],
|
|
481
|
+
["director_of_development", "Director of Development"],
|
|
482
|
+
["editorial", "Editorial"],
|
|
483
|
+
["electrical_engineer", "Electrical Engineer"],
|
|
484
|
+
["engineering_manager", "Engineering Manager"],
|
|
485
|
+
["events", "Events"],
|
|
486
|
+
["executive_assistant", "Executive Assistant"],
|
|
487
|
+
["facilities", "Facilities"],
|
|
488
|
+
["fashion_design", "Fashion Design"],
|
|
489
|
+
["field_marketing", "Field Marketing"],
|
|
490
|
+
["financial_analyst", "Financial Analyst"],
|
|
491
|
+
["financial_controller", "Financial Controller"],
|
|
492
|
+
["fitness", "Fitness"],
|
|
493
|
+
["founder", "Founder"],
|
|
494
|
+
["general_counsel", "General Counsel"],
|
|
495
|
+
["general_manager", "General Manager"],
|
|
496
|
+
["general_partner", "General Partner"],
|
|
497
|
+
["graphic_design", "Graphic Design"],
|
|
498
|
+
["human_resources_specialist", "Human Resources Specialist"],
|
|
499
|
+
["information_technology_specialist", "Information Technology Specialist"],
|
|
500
|
+
["investment", "Investment"],
|
|
501
|
+
["investment_banker", "Investment Banker"],
|
|
502
|
+
["journalist", "Journalist"],
|
|
503
|
+
["key_account_manager", "Key Account Manager"],
|
|
504
|
+
["law_enforcement", "Law Enforcement"],
|
|
505
|
+
["lawyer", "Lawyer"],
|
|
506
|
+
["logistics_manager", "Logistics Manager"],
|
|
507
|
+
["management", "Management"],
|
|
508
|
+
["marketing_specialist", "Marketing Specialist"],
|
|
509
|
+
["mechanical_engineer", "Mechanical Engineer"],
|
|
510
|
+
["medical_doctor", "Medical Doctor"],
|
|
511
|
+
["network_engineer", "Network Engineer"],
|
|
512
|
+
["nurse", "Nurse"],
|
|
513
|
+
["office_management", "Office Management"],
|
|
514
|
+
["office_manager", "Office Manager"],
|
|
515
|
+
["operational_specialist", "Operational Specialist"],
|
|
516
|
+
["owner", "Owner"],
|
|
517
|
+
["paralegal", "Paralegal"],
|
|
518
|
+
["principal", "Principal"],
|
|
519
|
+
["product_design", "Product Design"],
|
|
520
|
+
["product_manager", "Product Manager"],
|
|
521
|
+
["product_marketing", "Product Marketing"],
|
|
522
|
+
["production_manager", "Production Manager"],
|
|
523
|
+
["professor", "Professor"],
|
|
524
|
+
["program_coordinator", "Program Coordinator"],
|
|
525
|
+
["program_manager", "Program Manager"],
|
|
526
|
+
["project_engineer", "Project Engineer"],
|
|
527
|
+
["project_manager", "Project Manager"],
|
|
528
|
+
["property_manager", "Property Manager"],
|
|
529
|
+
["qa_engineer", "QA Engineer"],
|
|
530
|
+
["qa_it", "QA IT"],
|
|
531
|
+
["quality_assurance_manager", "Quality Assurance Manager"],
|
|
532
|
+
["quality_assurance_specialist", "Quality Assurance Specialist"],
|
|
533
|
+
["realtor", "Realtor"],
|
|
534
|
+
["recruiter", "Recruiter"],
|
|
535
|
+
["relationship_manager", "Relationship Manager"],
|
|
536
|
+
["research_analyst", "Research Analyst"],
|
|
537
|
+
["retail", "Retail"],
|
|
538
|
+
["retired", "Retired"],
|
|
539
|
+
["risk_compliance", "Risk Compliance"],
|
|
540
|
+
["sales_executive", "Sales Executive"],
|
|
541
|
+
["sales_operations", "Sales Operations"],
|
|
542
|
+
["sales_specialist", "Sales Specialist"],
|
|
543
|
+
["salesperson", "Salesperson"],
|
|
544
|
+
["secretary", "Secretary"],
|
|
545
|
+
["social_marketing", "Social Marketing"],
|
|
546
|
+
["software_engineer", "Software Engineer"],
|
|
547
|
+
["strategy", "Strategy"],
|
|
548
|
+
["student", "Student"],
|
|
549
|
+
["support", "Support"],
|
|
550
|
+
["support_specialist", "Support Specialist"],
|
|
551
|
+
["system_administrator", "System Administrator"],
|
|
552
|
+
["system_analyst", "System Analyst"],
|
|
553
|
+
["systems_engineer", "Systems Engineer"],
|
|
554
|
+
["talent", "Talent"],
|
|
555
|
+
["tax_audit", "Tax Audit"],
|
|
556
|
+
["teacher", "Teacher"],
|
|
557
|
+
["technical_manager", "Technical Manager"],
|
|
558
|
+
["technical_support_specialist", "Technical Support Specialist"],
|
|
559
|
+
["therapist", "Therapist"],
|
|
560
|
+
["training", "Training"],
|
|
561
|
+
["video", "Video"],
|
|
562
|
+
["web_developer", "Web Developer"],
|
|
563
|
+
["writer", "Writer"]
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
key: "enrichedEmailBounceDetected",
|
|
568
|
+
prop: "hs_enriched_email_bounce_detected",
|
|
569
|
+
kind: "boolean",
|
|
570
|
+
title: "Enriched Email Bounce Detected"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
key: "facebookClickId",
|
|
574
|
+
prop: "hs_facebook_click_id",
|
|
575
|
+
kind: "number",
|
|
576
|
+
title: "Facebook Click ID"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
key: "faxNumber",
|
|
580
|
+
prop: "fax",
|
|
581
|
+
kind: "string",
|
|
582
|
+
title: "Fax Number"
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
key: "fieldOfStudy",
|
|
586
|
+
prop: "field_of_study",
|
|
587
|
+
kind: "string",
|
|
588
|
+
title: "Field Of Study",
|
|
589
|
+
description: "A contact's field of study. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
key: "firstName",
|
|
593
|
+
prop: "firstname",
|
|
594
|
+
kind: "string",
|
|
595
|
+
title: "First Name",
|
|
596
|
+
description: "A contact's first name"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
key: "gender",
|
|
600
|
+
prop: "gender",
|
|
601
|
+
kind: "string",
|
|
602
|
+
title: "Gender"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
key: "googleAdClickId",
|
|
606
|
+
prop: "hs_google_click_id",
|
|
607
|
+
kind: "number",
|
|
608
|
+
title: "Google Ad Click ID"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
key: "graduationDate",
|
|
612
|
+
prop: "graduation_date",
|
|
613
|
+
kind: "dateRaw",
|
|
614
|
+
title: "Graduation Date",
|
|
615
|
+
description: "A contact's graduation date. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
key: "industry",
|
|
619
|
+
prop: "industry",
|
|
620
|
+
kind: "string",
|
|
621
|
+
title: "Industry",
|
|
622
|
+
description: "The industry a contact is in"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
key: "inferredLanguageCodes",
|
|
626
|
+
prop: "hs_inferred_language_codes",
|
|
627
|
+
kind: "enum",
|
|
628
|
+
title: "Inferred Language Codes",
|
|
629
|
+
description: "Inferred languages based on location. ISO 639-1.",
|
|
630
|
+
options: [
|
|
631
|
+
["ab", "Abkhazian"],
|
|
632
|
+
["aa", "Afar"],
|
|
633
|
+
["af", "Afrikaans"],
|
|
634
|
+
["ak", "Akan"],
|
|
635
|
+
["sq", "Albanian"],
|
|
636
|
+
["am", "Amharic"],
|
|
637
|
+
["ar", "Arabic"],
|
|
638
|
+
["an", "Aragonese"],
|
|
639
|
+
["hy", "Armenian"],
|
|
640
|
+
["as", "Assamese"],
|
|
641
|
+
["av", "Avaric"],
|
|
642
|
+
["ae", "Avestan"],
|
|
643
|
+
["ay", "Aymara"],
|
|
644
|
+
["az", "Azerbaijani"],
|
|
645
|
+
["bm", "Bambara"],
|
|
646
|
+
["ba", "Bashkir"],
|
|
647
|
+
["eu", "Basque"],
|
|
648
|
+
["be", "Belarusian"],
|
|
649
|
+
["bn", "Bengali"],
|
|
650
|
+
["bi", "Bislama"],
|
|
651
|
+
["nb", "Bokmål, Norwegian; Norwegian Bokmål"],
|
|
652
|
+
["bs", "Bosnian"],
|
|
653
|
+
["br", "Breton"],
|
|
654
|
+
["bg", "Bulgarian"],
|
|
655
|
+
["my", "Burmese"],
|
|
656
|
+
["ca", "Catalan; Valencian"],
|
|
657
|
+
["km", "Central Khmer"],
|
|
658
|
+
["ch", "Chamorro"],
|
|
659
|
+
["ce", "Chechen"],
|
|
660
|
+
["ny", "Chichewa; Chewa; Nyanja"],
|
|
661
|
+
["zh", "Chinese"],
|
|
662
|
+
["cu", "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"],
|
|
663
|
+
["cv", "Chuvash"],
|
|
664
|
+
["kw", "Cornish"],
|
|
665
|
+
["co", "Corsican"],
|
|
666
|
+
["cr", "Cree"],
|
|
667
|
+
["hr", "Croatian"],
|
|
668
|
+
["cs", "Czech"],
|
|
669
|
+
["da", "Danish"],
|
|
670
|
+
["dv", "Divehi; Dhivehi; Maldivian"],
|
|
671
|
+
["nl", "Dutch; Flemish"],
|
|
672
|
+
["dz", "Dzongkha"],
|
|
673
|
+
["en", "English"],
|
|
674
|
+
["eo", "Esperanto"],
|
|
675
|
+
["et", "Estonian"],
|
|
676
|
+
["ee", "Ewe"],
|
|
677
|
+
["fo", "Faroese"],
|
|
678
|
+
["fj", "Fijian"],
|
|
679
|
+
["fi", "Finnish"],
|
|
680
|
+
["fr", "French"],
|
|
681
|
+
["ff", "Fulah"],
|
|
682
|
+
["gd", "Gaelic; Scottish Gaelic"],
|
|
683
|
+
["gl", "Galician"],
|
|
684
|
+
["lg", "Ganda"],
|
|
685
|
+
["ka", "Georgian"],
|
|
686
|
+
["de", "German"],
|
|
687
|
+
["el", "Greek, Modern (1453-)"],
|
|
688
|
+
["gn", "Guarani"],
|
|
689
|
+
["gu", "Gujarati"],
|
|
690
|
+
["ht", "Haitian; Haitian Creole"],
|
|
691
|
+
["ha", "Hausa"],
|
|
692
|
+
["he", "Hebrew"],
|
|
693
|
+
["hz", "Herero"],
|
|
694
|
+
["hi", "Hindi"],
|
|
695
|
+
["ho", "Hiri Motu"],
|
|
696
|
+
["hu", "Hungarian"],
|
|
697
|
+
["is", "Icelandic"],
|
|
698
|
+
["io", "Ido"],
|
|
699
|
+
["ig", "Igbo"],
|
|
700
|
+
["id", "Indonesian"],
|
|
701
|
+
["ia", "Interlingua (International Auxiliary Language Association)"],
|
|
702
|
+
["ie", "Interlingue; Occidental"],
|
|
703
|
+
["iu", "Inuktitut"],
|
|
704
|
+
["ik", "Inupiaq"],
|
|
705
|
+
["ga", "Irish"],
|
|
706
|
+
["it", "Italian"],
|
|
707
|
+
["ja", "Japanese"],
|
|
708
|
+
["jv", "Javanese"],
|
|
709
|
+
["kl", "Kalaallisut; Greenlandic"],
|
|
710
|
+
["kn", "Kannada"],
|
|
711
|
+
["kr", "Kanuri"],
|
|
712
|
+
["ks", "Kashmiri"],
|
|
713
|
+
["kk", "Kazakh"],
|
|
714
|
+
["ki", "Kikuyu; Gikuyu"],
|
|
715
|
+
["rw", "Kinyarwanda"],
|
|
716
|
+
["ky", "Kirghiz; Kyrgyz"],
|
|
717
|
+
["kv", "Komi"],
|
|
718
|
+
["kg", "Kongo"],
|
|
719
|
+
["ko", "Korean"],
|
|
720
|
+
["kj", "Kuanyama; Kwanyama"],
|
|
721
|
+
["ku", "Kurdish"],
|
|
722
|
+
["lo", "Lao"],
|
|
723
|
+
["la", "Latin"],
|
|
724
|
+
["lv", "Latvian"],
|
|
725
|
+
["li", "Limburgan; Limburger; Limburgish"],
|
|
726
|
+
["ln", "Lingala"],
|
|
727
|
+
["lt", "Lithuanian"],
|
|
728
|
+
["lu", "Luba-Katanga"],
|
|
729
|
+
["lb", "Luxembourgish; Letzeburgesch"],
|
|
730
|
+
["mk", "Macedonian"],
|
|
731
|
+
["mg", "Malagasy"],
|
|
732
|
+
["ms", "Malay (Macrolanguage)"],
|
|
733
|
+
["ml", "Malayalam"],
|
|
734
|
+
["mt", "Maltese"],
|
|
735
|
+
["gv", "Manx"],
|
|
736
|
+
["mi", "Maori"],
|
|
737
|
+
["mr", "Marathi"],
|
|
738
|
+
["mh", "Marshallese"],
|
|
739
|
+
["mn", "Mongolian"],
|
|
740
|
+
["na", "Nauru"],
|
|
741
|
+
["nv", "Navajo; Navaho"],
|
|
742
|
+
["nd", "Ndebele, North; North Ndebele"],
|
|
743
|
+
["nr", "Ndebele, South; South Ndebele"],
|
|
744
|
+
["ng", "Ndonga"],
|
|
745
|
+
["ne", "Nepali (Macrolanguage)"],
|
|
746
|
+
["se", "Northern Sami"],
|
|
747
|
+
["no", "Norwegian"],
|
|
748
|
+
["nn", "Norwegian Nynorsk; Nynorsk, Norwegian"],
|
|
749
|
+
["oc", "Occitan (Post 1500)"],
|
|
750
|
+
["oj", "Ojibwa"],
|
|
751
|
+
["or", "Oriya (Macrolanguage)"],
|
|
752
|
+
["om", "Oromo"],
|
|
753
|
+
["os", "Ossetian; Ossetic"],
|
|
754
|
+
["pi", "Pali"],
|
|
755
|
+
["pa", "Panjabi; Punjabi"],
|
|
756
|
+
["fa", "Persian"],
|
|
757
|
+
["pl", "Polish"],
|
|
758
|
+
["pt", "Portuguese"],
|
|
759
|
+
["ps", "Pushto; Pashto"],
|
|
760
|
+
["qu", "Quechua"],
|
|
761
|
+
["ro", "Romanian; Moldavian; Moldovan"],
|
|
762
|
+
["rm", "Romansh"],
|
|
763
|
+
["rn", "Rundi"],
|
|
764
|
+
["ru", "Russian"],
|
|
765
|
+
["sm", "Samoan"],
|
|
766
|
+
["sg", "Sango"],
|
|
767
|
+
["sa", "Sanskrit"],
|
|
768
|
+
["sc", "Sardinian"],
|
|
769
|
+
["sr", "Serbian"],
|
|
770
|
+
["sn", "Shona"],
|
|
771
|
+
["ii", "Sichuan Yi; Nuosu"],
|
|
772
|
+
["sd", "Sindhi"],
|
|
773
|
+
["si", "Sinhala; Sinhalese"],
|
|
774
|
+
["sk", "Slovak"],
|
|
775
|
+
["sl", "Slovenian"],
|
|
776
|
+
["so", "Somali"],
|
|
777
|
+
["st", "Sotho, Southern"],
|
|
778
|
+
["es", "Spanish; Castilian"],
|
|
779
|
+
["su", "Sundanese"],
|
|
780
|
+
["sw", "Swahili (Macrolanguage)"],
|
|
781
|
+
["ss", "Swati"],
|
|
782
|
+
["sv", "Swedish"],
|
|
783
|
+
["tl", "Tagalog"],
|
|
784
|
+
["ty", "Tahitian"],
|
|
785
|
+
["tg", "Tajik"],
|
|
786
|
+
["ta", "Tamil"],
|
|
787
|
+
["tt", "Tatar"],
|
|
788
|
+
["te", "Telugu"],
|
|
789
|
+
["th", "Thai"],
|
|
790
|
+
["bo", "Tibetan"],
|
|
791
|
+
["ti", "Tigrinya"],
|
|
792
|
+
["to", "Tonga (Tonga Islands)"],
|
|
793
|
+
["ts", "Tsonga"],
|
|
794
|
+
["tn", "Tswana"],
|
|
795
|
+
["tr", "Turkish"],
|
|
796
|
+
["tk", "Turkmen"],
|
|
797
|
+
["tw", "Twi"],
|
|
798
|
+
["ug", "Uighur; Uyghur"],
|
|
799
|
+
["uk", "Ukrainian"],
|
|
800
|
+
["ur", "Urdu"],
|
|
801
|
+
["uz", "Uzbek"],
|
|
802
|
+
["ve", "Venda"],
|
|
803
|
+
["vi", "Vietnamese"],
|
|
804
|
+
["vo", "Volapük"],
|
|
805
|
+
["wa", "Walloon"],
|
|
806
|
+
["cy", "Welsh"],
|
|
807
|
+
["fy", "Western Frisian"],
|
|
808
|
+
["wo", "Wolof"],
|
|
809
|
+
["xh", "Xhosa"],
|
|
810
|
+
["yi", "Yiddish"],
|
|
811
|
+
["yo", "Yoruba"],
|
|
812
|
+
["za", "Zhuang; Chuang"],
|
|
813
|
+
["zu", "Zulu"]
|
|
814
|
+
]
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
key: "jobFunction",
|
|
818
|
+
prop: "job_function",
|
|
819
|
+
kind: "string",
|
|
820
|
+
title: "Job Function",
|
|
821
|
+
description: "A contact's job function. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
key: "jobTitle",
|
|
825
|
+
prop: "jobtitle",
|
|
826
|
+
kind: "string",
|
|
827
|
+
title: "Job Title",
|
|
828
|
+
description: "A contact's job title"
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
key: "lastName",
|
|
832
|
+
prop: "lastname",
|
|
833
|
+
kind: "string",
|
|
834
|
+
title: "Last Name",
|
|
835
|
+
description: "A contact's last name"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
key: "latestTrafficSource",
|
|
839
|
+
prop: "hs_latest_source",
|
|
840
|
+
kind: "enum",
|
|
841
|
+
title: "Latest Traffic Source",
|
|
842
|
+
description: "The source of the latest session for a contact",
|
|
843
|
+
options: [
|
|
844
|
+
["DIRECT_TRAFFIC", "Direct Traffic"],
|
|
845
|
+
["EMAIL_MARKETING", "Email Marketing"],
|
|
846
|
+
["OFFLINE", "Offline Sources"],
|
|
847
|
+
["ORGANIC_SEARCH", "Organic Search"],
|
|
848
|
+
["SOCIAL_MEDIA", "Organic Social"],
|
|
849
|
+
["OTHER_CAMPAIGNS", "Other Campaigns"],
|
|
850
|
+
["PAID_SEARCH", "Paid Search"],
|
|
851
|
+
["PAID_SOCIAL", "Paid Social"],
|
|
852
|
+
["REFERRALS", "Referrals"]
|
|
853
|
+
]
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
key: "latestTrafficSourceDate",
|
|
857
|
+
prop: "hs_latest_source_timestamp",
|
|
858
|
+
kind: "dateMs",
|
|
859
|
+
title: "Latest Traffic Source Date",
|
|
860
|
+
description: "The time of the latest session for a contact A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
key: "leadStatus",
|
|
864
|
+
prop: "hs_lead_status",
|
|
865
|
+
kind: "string",
|
|
866
|
+
title: "Lead Status",
|
|
867
|
+
description: "The contact's sales, prospecting or outreach status."
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
key: "processingContactData",
|
|
871
|
+
prop: "hs_legal_basis",
|
|
872
|
+
kind: "string",
|
|
873
|
+
title: "Legal Basic For Processing Contact Data",
|
|
874
|
+
description: "Legal basis for processing contact's data; 'Not applicable' will exempt the contact from GDPR protections."
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
key: "lifeCycleStage",
|
|
878
|
+
prop: "lifecyclestage",
|
|
879
|
+
kind: "string",
|
|
880
|
+
title: "Lifecycle Stage",
|
|
881
|
+
description: "The qualification of contacts to sales readiness. It can be set through imports, forms, workflows, and manually on a per contact basis."
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
key: "linkedinUrl",
|
|
885
|
+
prop: "hs_linkedin_url",
|
|
886
|
+
kind: "string",
|
|
887
|
+
title: "LinkedIn URL",
|
|
888
|
+
description: "The URL of the contact's LinkedIn page"
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
key: "maritalStatus",
|
|
892
|
+
prop: "marital_status",
|
|
893
|
+
kind: "string",
|
|
894
|
+
title: "Marital Status",
|
|
895
|
+
description: "A contact's marital status. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
key: "memberEmail",
|
|
899
|
+
prop: "hs_content_membership_email",
|
|
900
|
+
kind: "string",
|
|
901
|
+
title: "Member Email",
|
|
902
|
+
description: "Email used to send private content information to members"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
key: "membershipNote",
|
|
906
|
+
prop: "hs_content_membership_notes",
|
|
907
|
+
kind: "string",
|
|
908
|
+
title: "Membership Note",
|
|
909
|
+
description: "The notes relating to the contact's content membership"
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
key: "message",
|
|
913
|
+
prop: "message",
|
|
914
|
+
kind: "string",
|
|
915
|
+
title: "Message",
|
|
916
|
+
description: "A default property to be used for any message or comments a contact may want to leave on a form"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
key: "militaryStatus",
|
|
920
|
+
prop: "military_status",
|
|
921
|
+
kind: "string",
|
|
922
|
+
title: "Military Status",
|
|
923
|
+
description: "Contact's military status. Required for the Facebook Ads Integration. Automatically synced from the Lead Ads tool."
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
key: "mobilePhoneNumber",
|
|
927
|
+
prop: "mobilephone",
|
|
928
|
+
kind: "string",
|
|
929
|
+
title: "Mobile Phone Number",
|
|
930
|
+
description: "A contact's mobile phone number"
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
key: "numberOfEmployees",
|
|
934
|
+
prop: "numemployees",
|
|
935
|
+
kind: "string",
|
|
936
|
+
title: "Number Of Employees",
|
|
937
|
+
description: "The number of company employees."
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
key: "originalSource",
|
|
941
|
+
prop: "hs_analytics_source",
|
|
942
|
+
kind: "string",
|
|
943
|
+
title: "Original Source",
|
|
944
|
+
description: "The first known source through which a contact found your website. Source is automatically set by HubSpot, but may be updated manually."
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
key: "persona",
|
|
948
|
+
prop: "hs_persona",
|
|
949
|
+
kind: "string",
|
|
950
|
+
title: "Persona",
|
|
951
|
+
description: "A contact's persona"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
key: "phoneNumber",
|
|
955
|
+
prop: "phone",
|
|
956
|
+
kind: "string",
|
|
957
|
+
title: "Phone Number",
|
|
958
|
+
description: "A contact's primary phone number"
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
key: "postalCode",
|
|
962
|
+
prop: "zip",
|
|
963
|
+
kind: "string",
|
|
964
|
+
title: "Postal Code",
|
|
965
|
+
description: "The contact's zip code. This might be set via import, form, or integration."
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
key: "prefferedLanguage",
|
|
969
|
+
prop: "hs_language",
|
|
970
|
+
kind: "string",
|
|
971
|
+
title: "Preffered Language",
|
|
972
|
+
description: "Set your contact's preferred language for communications. This property can be changed from an import, form, or integration."
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
key: "prospectingAgentLastEnrolled",
|
|
976
|
+
prop: "hs_prospecting_agent_last_enrolled",
|
|
977
|
+
kind: "dateMs",
|
|
978
|
+
title: "Prospecting Agent Last Enrolled",
|
|
979
|
+
description: "The last time the Prospecting Agent enrolled this contact A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
key: "prospectingAgentTotalEnrolledCount",
|
|
983
|
+
prop: "hs_prospecting_agent_total_enrolled_count",
|
|
984
|
+
kind: "number",
|
|
985
|
+
title: "Prospecting Agent Total Enrolled Count"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
key: "relationshipStatus",
|
|
989
|
+
prop: "relationship_status",
|
|
990
|
+
kind: "string",
|
|
991
|
+
title: "Relationship Status",
|
|
992
|
+
description: "A contact's relationship status. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
key: "salutation",
|
|
996
|
+
prop: "salutation",
|
|
997
|
+
kind: "string",
|
|
998
|
+
title: "Salutation",
|
|
999
|
+
description: "The title used to address a contact"
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
key: "school",
|
|
1003
|
+
prop: "school",
|
|
1004
|
+
kind: "string",
|
|
1005
|
+
title: "School",
|
|
1006
|
+
description: "A contact's school. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
key: "seniority",
|
|
1010
|
+
prop: "seniority",
|
|
1011
|
+
kind: "string",
|
|
1012
|
+
title: "Seniority",
|
|
1013
|
+
description: "A contact's seniority. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
key: "startDate",
|
|
1017
|
+
prop: "start_date",
|
|
1018
|
+
kind: "dateRaw",
|
|
1019
|
+
title: "Start Date",
|
|
1020
|
+
description: "A contact's start date. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
key: "stateRegion",
|
|
1024
|
+
prop: "state",
|
|
1025
|
+
kind: "string",
|
|
1026
|
+
title: "State/Region",
|
|
1027
|
+
description: "The contact's state of residence. This might be set via import, form, or integration."
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
key: "stateRegionCode",
|
|
1031
|
+
prop: "hs_state_code",
|
|
1032
|
+
kind: "string",
|
|
1033
|
+
title: "State/Region Code",
|
|
1034
|
+
description: "The contact's state or region code"
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
key: "status",
|
|
1038
|
+
prop: "hs_content_membership_status",
|
|
1039
|
+
kind: "string",
|
|
1040
|
+
title: "Status",
|
|
1041
|
+
description: "The status of the contact's content membership."
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
key: "streetAddress",
|
|
1045
|
+
prop: "address",
|
|
1046
|
+
kind: "string",
|
|
1047
|
+
title: "Street Address",
|
|
1048
|
+
description: "A contact's street address, including apartment or unit #"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
key: "timeZone",
|
|
1052
|
+
prop: "hs_timezone",
|
|
1053
|
+
kind: "enum",
|
|
1054
|
+
title: "Time Zone",
|
|
1055
|
+
description: "The contact’s time zone. This can be set automatically by HubSpot based on other contact properties. It can also be set manually for each contact.",
|
|
1056
|
+
options: [
|
|
1057
|
+
["atlantic_slash_cape_verde", "UTC -01:00 Atlantic Cape Verde"],
|
|
1058
|
+
["america_slash_godthab", "UTC -02:00 America Godthab"],
|
|
1059
|
+
["america_slash_miquelon", "UTC -02:00 America Miquelon"],
|
|
1060
|
+
["america_slash_noronha", "UTC -02:00 America Noronha"],
|
|
1061
|
+
["atlantic_slash_south_georgia", "UTC -02:00 Atlantic South Georgia"],
|
|
1062
|
+
["brazil_slash_denoronha", "UTC -02:00 Brazil DeNoronha"],
|
|
1063
|
+
["america_slash_st_johns", "UTC -02:30 America St Johns"],
|
|
1064
|
+
["canada_slash_newfoundland", "UTC -02:30 Canada Newfoundland"],
|
|
1065
|
+
["america_slash_araguaina", "UTC -03:00 America Araguaina"],
|
|
1066
|
+
["america_slash_argentina_slash_buenos_aires", "UTC -03:00 America Argentina (Buenos Aires)"],
|
|
1067
|
+
["america_slash_argentina_slash_catamarca", "UTC -03:00 America Argentina (Catamarca)"],
|
|
1068
|
+
["america_slash_argentina_slash_comodrivadavia", "UTC -03:00 America Argentina (ComodRivadavia)"],
|
|
1069
|
+
["america_slash_argentina_slash_cordoba", "UTC -03:00 America Argentina (Cordoba)"],
|
|
1070
|
+
["america_slash_argentina_slash_jujuy", "UTC -03:00 America Argentina (Jujuy)"],
|
|
1071
|
+
["america_slash_argentina_slash_la_rioja", "UTC -03:00 America Argentina (La Rioja)"],
|
|
1072
|
+
["america_slash_argentina_slash_mendoza", "UTC -03:00 America Argentina (Mendoza)"],
|
|
1073
|
+
["america_slash_argentina_slash_rio_gallegos", "UTC -03:00 America Argentina (Rio Gallegos)"],
|
|
1074
|
+
["america_slash_argentina_slash_salta", "UTC -03:00 America Argentina (Salta)"],
|
|
1075
|
+
["america_slash_argentina_slash_san_juan", "UTC -03:00 America Argentina (San Juan)"],
|
|
1076
|
+
["america_slash_argentina_slash_san_luis", "UTC -03:00 America Argentina (San Luis)"],
|
|
1077
|
+
["america_slash_argentina_slash_tucuman", "UTC -03:00 America Argentina (Tucuman)"],
|
|
1078
|
+
["america_slash_argentina_slash_ushuaia", "UTC -03:00 America Argentina (Ushuaia)"],
|
|
1079
|
+
["america_slash_bahia", "UTC -03:00 America Bahia"],
|
|
1080
|
+
["america_slash_belem", "UTC -03:00 America Belem"],
|
|
1081
|
+
["america_slash_buenos_aires", "UTC -03:00 America Buenos Aires"],
|
|
1082
|
+
["america_slash_catamarca", "UTC -03:00 America Catamarca"],
|
|
1083
|
+
["america_slash_cayenne", "UTC -03:00 America Cayenne"],
|
|
1084
|
+
["america_slash_cordoba", "UTC -03:00 America Cordoba"],
|
|
1085
|
+
["america_slash_fortaleza", "UTC -03:00 America Fortaleza"],
|
|
1086
|
+
["america_slash_glace_bay", "UTC -03:00 America Glace Bay"],
|
|
1087
|
+
["america_slash_goose_bay", "UTC -03:00 America Goose Bay"],
|
|
1088
|
+
["america_slash_halifax", "UTC -03:00 America Halifax"],
|
|
1089
|
+
["america_slash_jujuy", "UTC -03:00 America Jujuy"],
|
|
1090
|
+
["america_slash_maceio", "UTC -03:00 America Maceio"],
|
|
1091
|
+
["america_slash_mendoza", "UTC -03:00 America Mendoza"],
|
|
1092
|
+
["america_slash_moncton", "UTC -03:00 America Moncton"],
|
|
1093
|
+
["america_slash_montevideo", "UTC -03:00 America Montevideo"],
|
|
1094
|
+
["america_slash_paramaribo", "UTC -03:00 America Paramaribo"],
|
|
1095
|
+
["america_slash_punta_arenas", "UTC -03:00 America Punta Arenas"],
|
|
1096
|
+
["america_slash_recife", "UTC -03:00 America Recife"],
|
|
1097
|
+
["america_slash_rosario", "UTC -03:00 America Rosario"],
|
|
1098
|
+
["america_slash_santarem", "UTC -03:00 America Santarem"],
|
|
1099
|
+
["america_slash_sao_paulo", "UTC -03:00 America Sao Paulo"],
|
|
1100
|
+
["america_slash_thule", "UTC -03:00 America Thule"],
|
|
1101
|
+
["antarctica_slash_palmer", "UTC -03:00 Antarctica Palmer"],
|
|
1102
|
+
["antarctica_slash_rothera", "UTC -03:00 Antarctica Rothera"],
|
|
1103
|
+
["atlantic_slash_bermuda", "UTC -03:00 Atlantic Bermuda"],
|
|
1104
|
+
["atlantic_slash_stanley", "UTC -03:00 Atlantic Stanley"],
|
|
1105
|
+
["brazil_slash_east", "UTC -03:00 Brazil East"],
|
|
1106
|
+
["canada_slash_atlantic", "UTC -03:00 Canada Atlantic"],
|
|
1107
|
+
["america_slash_anguilla", "UTC -04:00 America Anguilla"],
|
|
1108
|
+
["america_slash_antigua", "UTC -04:00 America Antigua"],
|
|
1109
|
+
["america_slash_aruba", "UTC -04:00 America Aruba"],
|
|
1110
|
+
["america_slash_asuncion", "UTC -04:00 America Asuncion"],
|
|
1111
|
+
["america_slash_barbados", "UTC -04:00 America Barbados"],
|
|
1112
|
+
["america_slash_blanc_hyphen_sablon", "UTC -04:00 America Blanc-Sablon"],
|
|
1113
|
+
["america_slash_boa_vista", "UTC -04:00 America Boa Vista"],
|
|
1114
|
+
["america_slash_campo_grande", "UTC -04:00 America Campo Grande"],
|
|
1115
|
+
["america_slash_caracas", "UTC -04:00 America Caracas"],
|
|
1116
|
+
["cuba", "UTC -04:00 America Cuba"],
|
|
1117
|
+
["america_slash_cuiaba", "UTC -04:00 America Cuiaba"],
|
|
1118
|
+
["america_slash_curacao", "UTC -04:00 America Curacao"],
|
|
1119
|
+
["america_slash_detroit", "UTC -04:00 America Detroit"],
|
|
1120
|
+
["america_slash_dominica", "UTC -04:00 America Dominica"],
|
|
1121
|
+
["america_slash_fort_wayne", "UTC -04:00 America Fort Wayne"],
|
|
1122
|
+
["america_slash_grand_turk", "UTC -04:00 America Grand Turk"],
|
|
1123
|
+
["america_slash_grenada", "UTC -04:00 America Grenada"],
|
|
1124
|
+
["america_slash_guadeloupe", "UTC -04:00 America Guadeloupe"],
|
|
1125
|
+
["america_slash_guyana", "UTC -04:00 America Guyana"],
|
|
1126
|
+
["america_slash_havana", "UTC -04:00 America Havana"],
|
|
1127
|
+
["america_slash_indiana_slash_indianapolis", "UTC -04:00 America Indiana (Indianapolis)"],
|
|
1128
|
+
["america_slash_indiana_slash_marengo", "UTC -04:00 America Indiana (Marengo)"],
|
|
1129
|
+
["america_slash_indiana_slash_petersburg", "UTC -04:00 America Indiana (Petersburg)"],
|
|
1130
|
+
["america_slash_indiana_slash_vevay", "UTC -04:00 America Indiana (Vevay)"],
|
|
1131
|
+
["america_slash_indiana_slash_vincennes", "UTC -04:00 America Indiana (Vincennes)"],
|
|
1132
|
+
["america_slash_indiana_slash_winamac", "UTC -04:00 America Indiana (Winamac)"],
|
|
1133
|
+
["america_slash_indianapolis", "UTC -04:00 America Indianapolis"],
|
|
1134
|
+
["america_slash_iqaluit", "UTC -04:00 America Iqaluit"],
|
|
1135
|
+
["america_slash_kentucky_slash_louisville", "UTC -04:00 America Kentucky (Louisville)"],
|
|
1136
|
+
["america_slash_kentucky_slash_monticello", "UTC -04:00 America Kentucky (Monticello)"],
|
|
1137
|
+
["america_slash_kralendijk", "UTC -04:00 America Kralendijk"],
|
|
1138
|
+
["america_slash_la_paz", "UTC -04:00 America La Paz"],
|
|
1139
|
+
["america_slash_louisville", "UTC -04:00 America Louisville"],
|
|
1140
|
+
["america_slash_lower_princes", "UTC -04:00 America Lower Princes"],
|
|
1141
|
+
["america_slash_manaus", "UTC -04:00 America Manaus"],
|
|
1142
|
+
["america_slash_marigot", "UTC -04:00 America Marigot"],
|
|
1143
|
+
["america_slash_martinique", "UTC -04:00 America Martinique"],
|
|
1144
|
+
["america_slash_montreal", "UTC -04:00 America Montreal"],
|
|
1145
|
+
["america_slash_montserrat", "UTC -04:00 America Montserrat"],
|
|
1146
|
+
["america_slash_nassau", "UTC -04:00 America Nassau"],
|
|
1147
|
+
["america_slash_new_york", "UTC -04:00 America New York"],
|
|
1148
|
+
["america_slash_nipigon", "UTC -04:00 America Nipigon"],
|
|
1149
|
+
["america_slash_pangnirtung", "UTC -04:00 America Pangnirtung"],
|
|
1150
|
+
["america_slash_port_of_spain", "UTC -04:00 America Port of Spain"],
|
|
1151
|
+
["america_slash_port_hyphen_au_hyphen_prince", "UTC -04:00 America Port-Au-Prince"],
|
|
1152
|
+
["america_slash_porto_velho", "UTC -04:00 America Porto Velho"],
|
|
1153
|
+
["america_slash_puerto_rico", "UTC -04:00 America Puerto Rico"],
|
|
1154
|
+
["america_slash_santiago", "UTC -04:00 America Santiago"],
|
|
1155
|
+
["america_slash_santo_domingo", "UTC -04:00 America Santo Domingo"],
|
|
1156
|
+
["america_slash_st_barthelemy", "UTC -04:00 America St Barthelemy"],
|
|
1157
|
+
["america_slash_st_kitts", "UTC -04:00 America St Kitts"],
|
|
1158
|
+
["america_slash_st_lucia", "UTC -04:00 America St Lucia"],
|
|
1159
|
+
["america_slash_st_thomas", "UTC -04:00 America St Thomas"],
|
|
1160
|
+
["america_slash_st_vincent", "UTC -04:00 America St Vincent"],
|
|
1161
|
+
["america_slash_thunder_bay", "UTC -04:00 America Thunder Bay"],
|
|
1162
|
+
["america_slash_toronto", "UTC -04:00 America Toronto"],
|
|
1163
|
+
["america_slash_tortola", "UTC -04:00 America Tortola"],
|
|
1164
|
+
["america_slash_virgin", "UTC -04:00 America Virgin"],
|
|
1165
|
+
["brazil_slash_west", "UTC -04:00 Brazil West"],
|
|
1166
|
+
["canada_slash_eastern", "UTC -04:00 Canada Eastern"],
|
|
1167
|
+
["chile_slash_continental", "UTC -04:00 Chile Continental"],
|
|
1168
|
+
["us_slash_east_hyphen_indiana", "UTC -04:00 US East-Indiana"],
|
|
1169
|
+
["us_slash_eastern", "UTC -04:00 US Eastern"],
|
|
1170
|
+
["us_slash_michigan", "UTC -04:00 US Michigan"],
|
|
1171
|
+
["america_slash_atikokan", "UTC -05:00 America Atikokan"],
|
|
1172
|
+
["america_slash_bahia_banderas", "UTC -05:00 America Bahia Banderas"],
|
|
1173
|
+
["america_slash_bogota", "UTC -05:00 America Bogota"],
|
|
1174
|
+
["america_slash_cancun", "UTC -05:00 America Cancun"],
|
|
1175
|
+
["america_slash_cayman", "UTC -05:00 America Cayman"],
|
|
1176
|
+
["america_slash_chicago", "UTC -05:00 America Chicago"],
|
|
1177
|
+
["america_slash_coral_harbour", "UTC -05:00 America Coral Harbour"],
|
|
1178
|
+
["america_slash_eirunepe", "UTC -05:00 America Eirunepe"],
|
|
1179
|
+
["america_slash_guayaquil", "UTC -05:00 America Guayaquil"],
|
|
1180
|
+
["america_slash_indiana_slash_knox", "UTC -05:00 America Indiana (Knox)"],
|
|
1181
|
+
["america_slash_indiana_slash_tell_city", "UTC -05:00 America Indiana (Tell City)"],
|
|
1182
|
+
["america_slash_jamaica", "UTC -05:00 America Jamaica"],
|
|
1183
|
+
["america_slash_knox_in", "UTC -05:00 America Knox IN"],
|
|
1184
|
+
["america_slash_lima", "UTC -05:00 America Lima"],
|
|
1185
|
+
["america_slash_matamoros", "UTC -05:00 America Matamoros"],
|
|
1186
|
+
["america_slash_menominee", "UTC -05:00 America Menominee"],
|
|
1187
|
+
["america_slash_merida", "UTC -05:00 America Merida"],
|
|
1188
|
+
["america_slash_mexico_city", "UTC -05:00 America Mexico City"],
|
|
1189
|
+
["america_slash_monterrey", "UTC -05:00 America Monterrey"],
|
|
1190
|
+
["america_slash_north_dakota_slash_beulah", "UTC -05:00 America North Dakota (Beulah)"],
|
|
1191
|
+
["america_slash_north_dakota_slash_center", "UTC -05:00 America North Dakota (Center)"],
|
|
1192
|
+
["america_slash_north_dakota_slash_new_salem", "UTC -05:00 America North Dakota (New Salem)"],
|
|
1193
|
+
["america_slash_panama", "UTC -05:00 America Panama"],
|
|
1194
|
+
["america_slash_porto_acre", "UTC -05:00 America Porto Acre"],
|
|
1195
|
+
["america_slash_rainy_river", "UTC -05:00 America Rainy River"],
|
|
1196
|
+
["america_slash_rankin_inlet", "UTC -05:00 America Rankin Inlet"],
|
|
1197
|
+
["america_slash_resolute", "UTC -05:00 America Resolute"],
|
|
1198
|
+
["america_slash_rio_branco", "UTC -05:00 America Rio Branco"],
|
|
1199
|
+
["america_slash_winnipeg", "UTC -05:00 America Winnipeg"],
|
|
1200
|
+
["brazil_slash_acre", "UTC -05:00 Brazil Acre"],
|
|
1201
|
+
["canada_slash_central", "UTC -05:00 Canada Central"],
|
|
1202
|
+
["mexico_slash_general", "UTC -05:00 Mexico General"],
|
|
1203
|
+
["us_slash_central", "UTC -05:00 US Central"],
|
|
1204
|
+
["us_slash_indiana_hyphen_starke", "UTC -05:00 US Indiana-Starke"],
|
|
1205
|
+
["america_slash_belize", "UTC -06:00 America Belize"],
|
|
1206
|
+
["america_slash_boise", "UTC -06:00 America Boise"],
|
|
1207
|
+
["america_slash_cambridge_bay", "UTC -06:00 America Cambridge Bay"],
|
|
1208
|
+
["america_slash_chihuahua", "UTC -06:00 America Chihuahua"],
|
|
1209
|
+
["america_slash_costa_rica", "UTC -06:00 America Costa Rica"],
|
|
1210
|
+
["america_slash_denver", "UTC -06:00 America Denver"],
|
|
1211
|
+
["america_slash_edmonton", "UTC -06:00 America Edmonton"],
|
|
1212
|
+
["america_slash_el_salvador", "UTC -06:00 America El Salvador"],
|
|
1213
|
+
["america_slash_guatemala", "UTC -06:00 America Guatemala"],
|
|
1214
|
+
["america_slash_inuvik", "UTC -06:00 America Inuvik"],
|
|
1215
|
+
["america_slash_managua", "UTC -06:00 America Managua"],
|
|
1216
|
+
["america_slash_mazatlan", "UTC -06:00 America Mazatlan"],
|
|
1217
|
+
["navajo", "UTC -06:00 America Navajo"],
|
|
1218
|
+
["america_slash_ojinaga", "UTC -06:00 America Ojinaga"],
|
|
1219
|
+
["america_slash_regina", "UTC -06:00 America Regina"],
|
|
1220
|
+
["america_slash_shiprock", "UTC -06:00 America Shiprock"],
|
|
1221
|
+
["america_slash_swift_current", "UTC -06:00 America Swift Current"],
|
|
1222
|
+
["america_slash_tegucigalpa", "UTC -06:00 America Tegucigalpa"],
|
|
1223
|
+
["america_slash_yellowknife", "UTC -06:00 America Yellowknife"],
|
|
1224
|
+
["canada_slash_mountain", "UTC -06:00 Canada Mountain"],
|
|
1225
|
+
["canada_slash_saskatchewan", "UTC -06:00 Canada Saskatchewan"],
|
|
1226
|
+
["chile_slash_easterisland", "UTC -06:00 Chile EasterIsland"],
|
|
1227
|
+
["mexico_slash_bajasur", "UTC -06:00 Mexico BajaSur"],
|
|
1228
|
+
["pacific_slash_easter", "UTC -06:00 Pacific Easter"],
|
|
1229
|
+
["pacific_slash_galapagos", "UTC -06:00 Pacific Galapagos"],
|
|
1230
|
+
["us_slash_mountain", "UTC -06:00 US Mountain"],
|
|
1231
|
+
["america_slash_creston", "UTC -07:00 America Creston"],
|
|
1232
|
+
["america_slash_dawson", "UTC -07:00 America Dawson"],
|
|
1233
|
+
["america_slash_dawson_creek", "UTC -07:00 America Dawson Creek"],
|
|
1234
|
+
["america_slash_ensenada", "UTC -07:00 America Ensenada"],
|
|
1235
|
+
["america_slash_fort_nelson", "UTC -07:00 America Fort Nelson"],
|
|
1236
|
+
["america_slash_hermosillo", "UTC -07:00 America Hermosillo"],
|
|
1237
|
+
["america_slash_los_angeles", "UTC -07:00 America Los Angeles"],
|
|
1238
|
+
["america_slash_phoenix", "UTC -07:00 America Phoenix"],
|
|
1239
|
+
["america_slash_santa_isabel", "UTC -07:00 America Santa Isabel"],
|
|
1240
|
+
["america_slash_tijuana", "UTC -07:00 America Tijuana"],
|
|
1241
|
+
["america_slash_vancouver", "UTC -07:00 America Vancouver"],
|
|
1242
|
+
["america_slash_whitehorse", "UTC -07:00 America Whitehorse"],
|
|
1243
|
+
["canada_slash_pacific", "UTC -07:00 Canada Pacific"],
|
|
1244
|
+
["canada_slash_yukon", "UTC -07:00 Canada Yukon"],
|
|
1245
|
+
["mexico_slash_bajanorte", "UTC -07:00 Mexico BajaNorte"],
|
|
1246
|
+
["us_slash_arizona", "UTC -07:00 US Arizona"],
|
|
1247
|
+
["us_slash_pacific", "UTC -07:00 US Pacific"],
|
|
1248
|
+
["us_slash_pacific_hyphen_new", "UTC -07:00 US Pacific-New"],
|
|
1249
|
+
["america_slash_anchorage", "UTC -08:00 America Anchorage"],
|
|
1250
|
+
["america_slash_juneau", "UTC -08:00 America Juneau"],
|
|
1251
|
+
["america_slash_metlakatla", "UTC -08:00 America Metlakatla"],
|
|
1252
|
+
["america_slash_nome", "UTC -08:00 America Nome"],
|
|
1253
|
+
["america_slash_sitka", "UTC -08:00 America Sitka"],
|
|
1254
|
+
["america_slash_yakutat", "UTC -08:00 America Yakutat"],
|
|
1255
|
+
["pacific_slash_pitcairn", "UTC -08:00 Pacific Pitcairn"],
|
|
1256
|
+
["us_slash_alaska", "UTC -08:00 US Alaska"],
|
|
1257
|
+
["america_slash_adak", "UTC -09:00 America Adak"],
|
|
1258
|
+
["america_slash_atka", "UTC -09:00 America Atka"],
|
|
1259
|
+
["pacific_slash_gambier", "UTC -09:00 Pacific Gambier"],
|
|
1260
|
+
["us_slash_aleutian", "UTC -09:00 US Aleutian"],
|
|
1261
|
+
["pacific_slash_marquesas", "UTC -09:30 Pacific Marquesas"],
|
|
1262
|
+
["pacific_slash_honolulu", "UTC -10:00 Pacific Honolulu"],
|
|
1263
|
+
["pacific_slash_johnston", "UTC -10:00 Pacific Johnston"],
|
|
1264
|
+
["pacific_slash_rarotonga", "UTC -10:00 Pacific Rarotonga"],
|
|
1265
|
+
["pacific_slash_tahiti", "UTC -10:00 Pacific Tahiti"],
|
|
1266
|
+
["us_slash_hawaii", "UTC -10:00 US Hawaii"],
|
|
1267
|
+
["pacific_slash_midway", "UTC -11:00 Pacific Midway"],
|
|
1268
|
+
["pacific_slash_niue", "UTC -11:00 Pacific Niue"],
|
|
1269
|
+
["pacific_slash_pago_pago", "UTC -11:00 Pacific Pago Pago"],
|
|
1270
|
+
["pacific_slash_samoa", "UTC -11:00 Pacific Samoa"],
|
|
1271
|
+
["us_slash_samoa", "UTC -11:00 US Samoa"],
|
|
1272
|
+
["africa_slash_abidjan", "UTC +00:00 Africa Abidjan"],
|
|
1273
|
+
["africa_slash_accra", "UTC +00:00 Africa Accra"],
|
|
1274
|
+
["africa_slash_bamako", "UTC +00:00 Africa Bamako"],
|
|
1275
|
+
["africa_slash_banjul", "UTC +00:00 Africa Banjul"],
|
|
1276
|
+
["africa_slash_bissau", "UTC +00:00 Africa Bissau"],
|
|
1277
|
+
["africa_slash_conakry", "UTC +00:00 Africa Conakry"],
|
|
1278
|
+
["africa_slash_dakar", "UTC +00:00 Africa Dakar"],
|
|
1279
|
+
["africa_slash_freetown", "UTC +00:00 Africa Freetown"],
|
|
1280
|
+
["africa_slash_lome", "UTC +00:00 Africa Lome"],
|
|
1281
|
+
["africa_slash_monrovia", "UTC +00:00 Africa Monrovia"],
|
|
1282
|
+
["africa_slash_nouakchott", "UTC +00:00 Africa Nouakchott"],
|
|
1283
|
+
["africa_slash_ouagadougou", "UTC +00:00 Africa Ouagadougou"],
|
|
1284
|
+
["africa_slash_timbuktu", "UTC +00:00 Africa Timbuktu"],
|
|
1285
|
+
["america_slash_danmarkshavn", "UTC +00:00 America Danmarkshavn"],
|
|
1286
|
+
["america_slash_scoresbysund", "UTC +00:00 America Scoresbysund"],
|
|
1287
|
+
["atlantic_slash_azores", "UTC +00:00 Atlantic Azores"],
|
|
1288
|
+
["atlantic_slash_reykjavik", "UTC +00:00 Atlantic Reykjavik"],
|
|
1289
|
+
["atlantic_slash_st_helena", "UTC +00:00 Atlantic St Helena"],
|
|
1290
|
+
["iceland", "UTC +00:00 Europe Iceland"],
|
|
1291
|
+
["africa_slash_algiers", "UTC +01:00 Africa Algiers"],
|
|
1292
|
+
["africa_slash_bangui", "UTC +01:00 Africa Bangui"],
|
|
1293
|
+
["africa_slash_brazzaville", "UTC +01:00 Africa Brazzaville"],
|
|
1294
|
+
["africa_slash_casablanca", "UTC +01:00 Africa Casablanca"],
|
|
1295
|
+
["africa_slash_douala", "UTC +01:00 Africa Douala"],
|
|
1296
|
+
["africa_slash_el_aaiun", "UTC +01:00 Africa El Aaiun"],
|
|
1297
|
+
["africa_slash_kinshasa", "UTC +01:00 Africa Kinshasa"],
|
|
1298
|
+
["africa_slash_lagos", "UTC +01:00 Africa Lagos"],
|
|
1299
|
+
["africa_slash_libreville", "UTC +01:00 Africa Libreville"],
|
|
1300
|
+
["africa_slash_luanda", "UTC +01:00 Africa Luanda"],
|
|
1301
|
+
["africa_slash_malabo", "UTC +01:00 Africa Malabo"],
|
|
1302
|
+
["africa_slash_ndjamena", "UTC +01:00 Africa Ndjamena"],
|
|
1303
|
+
["africa_slash_niamey", "UTC +01:00 Africa Niamey"],
|
|
1304
|
+
["africa_slash_porto_hyphen_novo", "UTC +01:00 Africa Porto-Novo"],
|
|
1305
|
+
["africa_slash_sao_tome", "UTC +01:00 Africa Sao Tome"],
|
|
1306
|
+
["africa_slash_tunis", "UTC +01:00 Africa Tunis"],
|
|
1307
|
+
["atlantic_slash_canary", "UTC +01:00 Atlantic Canary"],
|
|
1308
|
+
["atlantic_slash_faeroe", "UTC +01:00 Atlantic Faeroe"],
|
|
1309
|
+
["atlantic_slash_faroe", "UTC +01:00 Atlantic Faroe"],
|
|
1310
|
+
["atlantic_slash_madeira", "UTC +01:00 Atlantic Madeira"],
|
|
1311
|
+
["europe_slash_belfast", "UTC +01:00 Europe Belfast"],
|
|
1312
|
+
["europe_slash_dublin", "UTC +01:00 Europe Dublin"],
|
|
1313
|
+
["eire", "UTC +01:00 Europe Eire"],
|
|
1314
|
+
["europe_slash_guernsey", "UTC +01:00 Europe Guernsey"],
|
|
1315
|
+
["europe_slash_isle_of_man", "UTC +01:00 Europe Isle of Man"],
|
|
1316
|
+
["europe_slash_jersey", "UTC +01:00 Europe Jersey"],
|
|
1317
|
+
["europe_slash_lisbon", "UTC +01:00 Europe Lisbon"],
|
|
1318
|
+
["europe_slash_london", "UTC +01:00 Europe London"],
|
|
1319
|
+
["portugal", "UTC +01:00 Europe Portugal"],
|
|
1320
|
+
["africa_slash_blantyre", "UTC +02:00 Africa Blantyre"],
|
|
1321
|
+
["africa_slash_bujumbura", "UTC +02:00 Africa Bujumbura"],
|
|
1322
|
+
["africa_slash_cairo", "UTC +02:00 Africa Cairo"],
|
|
1323
|
+
["africa_slash_ceuta", "UTC +02:00 Africa Ceuta"],
|
|
1324
|
+
["egypt", "UTC +02:00 Africa Egypt"],
|
|
1325
|
+
["africa_slash_gaborone", "UTC +02:00 Africa Gaborone"],
|
|
1326
|
+
["africa_slash_harare", "UTC +02:00 Africa Harare"],
|
|
1327
|
+
["africa_slash_johannesburg", "UTC +02:00 Africa Johannesburg"],
|
|
1328
|
+
["africa_slash_khartoum", "UTC +02:00 Africa Khartoum"],
|
|
1329
|
+
["africa_slash_kigali", "UTC +02:00 Africa Kigali"],
|
|
1330
|
+
["libya", "UTC +02:00 Africa Libya"],
|
|
1331
|
+
["africa_slash_lubumbashi", "UTC +02:00 Africa Lubumbashi"],
|
|
1332
|
+
["africa_slash_lusaka", "UTC +02:00 Africa Lusaka"],
|
|
1333
|
+
["africa_slash_maputo", "UTC +02:00 Africa Maputo"],
|
|
1334
|
+
["africa_slash_maseru", "UTC +02:00 Africa Maseru"],
|
|
1335
|
+
["africa_slash_mbabane", "UTC +02:00 Africa Mbabane"],
|
|
1336
|
+
["africa_slash_tripoli", "UTC +02:00 Africa Tripoli"],
|
|
1337
|
+
["africa_slash_windhoek", "UTC +02:00 Africa Windhoek"],
|
|
1338
|
+
["antarctica_slash_troll", "UTC +02:00 Antarctica Troll"],
|
|
1339
|
+
["arctic_slash_longyearbyen", "UTC +02:00 Arctic Longyearbyen"],
|
|
1340
|
+
["atlantic_slash_jan_mayen", "UTC +02:00 Atlantic Jan Mayen"],
|
|
1341
|
+
["europe_slash_amsterdam", "UTC +02:00 Europe Amsterdam"],
|
|
1342
|
+
["europe_slash_andorra", "UTC +02:00 Europe Andorra"],
|
|
1343
|
+
["europe_slash_belgrade", "UTC +02:00 Europe Belgrade"],
|
|
1344
|
+
["europe_slash_berlin", "UTC +02:00 Europe Berlin"],
|
|
1345
|
+
["europe_slash_bratislava", "UTC +02:00 Europe Bratislava"],
|
|
1346
|
+
["europe_slash_brussels", "UTC +02:00 Europe Brussels"],
|
|
1347
|
+
["europe_slash_budapest", "UTC +02:00 Europe Budapest"],
|
|
1348
|
+
["europe_slash_busingen", "UTC +02:00 Europe Busingen"],
|
|
1349
|
+
["europe_slash_copenhagen", "UTC +02:00 Europe Copenhagen"],
|
|
1350
|
+
["europe_slash_gibraltar", "UTC +02:00 Europe Gibraltar"],
|
|
1351
|
+
["europe_slash_kaliningrad", "UTC +02:00 Europe Kaliningrad"],
|
|
1352
|
+
["europe_slash_ljubljana", "UTC +02:00 Europe Ljubljana"],
|
|
1353
|
+
["europe_slash_luxembourg", "UTC +02:00 Europe Luxembourg"],
|
|
1354
|
+
["europe_slash_madrid", "UTC +02:00 Europe Madrid"],
|
|
1355
|
+
["europe_slash_malta", "UTC +02:00 Europe Malta"],
|
|
1356
|
+
["europe_slash_monaco", "UTC +02:00 Europe Monaco"],
|
|
1357
|
+
["europe_slash_oslo", "UTC +02:00 Europe Oslo"],
|
|
1358
|
+
["europe_slash_paris", "UTC +02:00 Europe Paris"],
|
|
1359
|
+
["europe_slash_podgorica", "UTC +02:00 Europe Podgorica"],
|
|
1360
|
+
["poland", "UTC +02:00 Europe Poland"],
|
|
1361
|
+
["europe_slash_prague", "UTC +02:00 Europe Prague"],
|
|
1362
|
+
["europe_slash_rome", "UTC +02:00 Europe Rome"],
|
|
1363
|
+
["europe_slash_san_marino", "UTC +02:00 Europe San Marino"],
|
|
1364
|
+
["europe_slash_sarajevo", "UTC +02:00 Europe Sarajevo"],
|
|
1365
|
+
["europe_slash_skopje", "UTC +02:00 Europe Skopje"],
|
|
1366
|
+
["europe_slash_stockholm", "UTC +02:00 Europe Stockholm"],
|
|
1367
|
+
["europe_slash_tirane", "UTC +02:00 Europe Tirane"],
|
|
1368
|
+
["europe_slash_vaduz", "UTC +02:00 Europe Vaduz"],
|
|
1369
|
+
["europe_slash_vatican", "UTC +02:00 Europe Vatican"],
|
|
1370
|
+
["europe_slash_vienna", "UTC +02:00 Europe Vienna"],
|
|
1371
|
+
["europe_slash_warsaw", "UTC +02:00 Europe Warsaw"],
|
|
1372
|
+
["europe_slash_zagreb", "UTC +02:00 Europe Zagreb"],
|
|
1373
|
+
["europe_slash_zurich", "UTC +02:00 Europe Zurich"],
|
|
1374
|
+
["africa_slash_addis_ababa", "UTC +03:00 Africa Addis Ababa"],
|
|
1375
|
+
["africa_slash_asmara", "UTC +03:00 Africa Asmara"],
|
|
1376
|
+
["africa_slash_asmera", "UTC +03:00 Africa Asmera"],
|
|
1377
|
+
["africa_slash_dar_es_salaam", "UTC +03:00 Africa Dar Es Salaam"],
|
|
1378
|
+
["africa_slash_djibouti", "UTC +03:00 Africa Djibouti"],
|
|
1379
|
+
["africa_slash_juba", "UTC +03:00 Africa Juba"],
|
|
1380
|
+
["africa_slash_kampala", "UTC +03:00 Africa Kampala"],
|
|
1381
|
+
["africa_slash_mogadishu", "UTC +03:00 Africa Mogadishu"],
|
|
1382
|
+
["africa_slash_nairobi", "UTC +03:00 Africa Nairobi"],
|
|
1383
|
+
["antarctica_slash_syowa", "UTC +03:00 Antarctica Syowa"],
|
|
1384
|
+
["asia_slash_aden", "UTC +03:00 Asia Aden"],
|
|
1385
|
+
["asia_slash_amman", "UTC +03:00 Asia Amman"],
|
|
1386
|
+
["asia_slash_baghdad", "UTC +03:00 Asia Baghdad"],
|
|
1387
|
+
["asia_slash_bahrain", "UTC +03:00 Asia Bahrain"],
|
|
1388
|
+
["asia_slash_beirut", "UTC +03:00 Asia Beirut"],
|
|
1389
|
+
["asia_slash_damascus", "UTC +03:00 Asia Damascus"],
|
|
1390
|
+
["asia_slash_famagusta", "UTC +03:00 Asia Famagusta"],
|
|
1391
|
+
["asia_slash_gaza", "UTC +03:00 Asia Gaza"],
|
|
1392
|
+
["asia_slash_hebron", "UTC +03:00 Asia Hebron"],
|
|
1393
|
+
["israel", "UTC +03:00 Asia Israel"],
|
|
1394
|
+
["asia_slash_istanbul", "UTC +03:00 Asia Istanbul"],
|
|
1395
|
+
["asia_slash_jerusalem", "UTC +03:00 Asia Jerusalem"],
|
|
1396
|
+
["asia_slash_kuwait", "UTC +03:00 Asia Kuwait"],
|
|
1397
|
+
["asia_slash_nicosia", "UTC +03:00 Asia Nicosia"],
|
|
1398
|
+
["asia_slash_qatar", "UTC +03:00 Asia Qatar"],
|
|
1399
|
+
["asia_slash_riyadh", "UTC +03:00 Asia Riyadh"],
|
|
1400
|
+
["asia_slash_tel_aviv", "UTC +03:00 Asia Tel Aviv"],
|
|
1401
|
+
["turkey", "UTC +03:00 Asia Türkiye"],
|
|
1402
|
+
["europe_slash_athens", "UTC +03:00 Europe Athens"],
|
|
1403
|
+
["europe_slash_bucharest", "UTC +03:00 Europe Bucharest"],
|
|
1404
|
+
["europe_slash_chisinau", "UTC +03:00 Europe Chisinau"],
|
|
1405
|
+
["europe_slash_helsinki", "UTC +03:00 Europe Helsinki"],
|
|
1406
|
+
["europe_slash_istanbul", "UTC +03:00 Europe Istanbul"],
|
|
1407
|
+
["europe_slash_kirov", "UTC +03:00 Europe Kirov"],
|
|
1408
|
+
["europe_slash_kiev", "UTC +03:00 Europe Kyiv"],
|
|
1409
|
+
["europe_slash_mariehamn", "UTC +03:00 Europe Mariehamn"],
|
|
1410
|
+
["europe_slash_minsk", "UTC +03:00 Europe Minsk"],
|
|
1411
|
+
["europe_slash_moscow", "UTC +03:00 Europe Moscow"],
|
|
1412
|
+
["europe_slash_nicosia", "UTC +03:00 Europe Nicosia"],
|
|
1413
|
+
["europe_slash_riga", "UTC +03:00 Europe Riga"],
|
|
1414
|
+
["europe_slash_simferopol", "UTC +03:00 Europe Simferopol"],
|
|
1415
|
+
["europe_slash_sofia", "UTC +03:00 Europe Sofia"],
|
|
1416
|
+
["europe_slash_tallinn", "UTC +03:00 Europe Tallinn"],
|
|
1417
|
+
["europe_slash_tiraspol", "UTC +03:00 Europe Tiraspol"],
|
|
1418
|
+
["europe_slash_uzhgorod", "UTC +03:00 Europe Uzhgorod"],
|
|
1419
|
+
["europe_slash_vilnius", "UTC +03:00 Europe Vilnius"],
|
|
1420
|
+
["europe_slash_zaporozhye", "UTC +03:00 Europe Zaporizhzhia"],
|
|
1421
|
+
["indian_slash_antananarivo", "UTC +03:00 Indian Antananarivo"],
|
|
1422
|
+
["indian_slash_comoro", "UTC +03:00 Indian Comoro"],
|
|
1423
|
+
["indian_slash_mayotte", "UTC +03:00 Indian Mayotte"],
|
|
1424
|
+
["asia_slash_baku", "UTC +04:00 Asia Baku"],
|
|
1425
|
+
["asia_slash_dubai", "UTC +04:00 Asia Dubai"],
|
|
1426
|
+
["asia_slash_muscat", "UTC +04:00 Asia Muscat"],
|
|
1427
|
+
["asia_slash_tbilisi", "UTC +04:00 Asia Tbilisi"],
|
|
1428
|
+
["asia_slash_yerevan", "UTC +04:00 Asia Yerevan"],
|
|
1429
|
+
["europe_slash_astrakhan", "UTC +04:00 Europe Astrakhan"],
|
|
1430
|
+
["europe_slash_samara", "UTC +04:00 Europe Samara"],
|
|
1431
|
+
["europe_slash_saratov", "UTC +04:00 Europe Saratov"],
|
|
1432
|
+
["europe_slash_ulyanovsk", "UTC +04:00 Europe Ulyanovsk"],
|
|
1433
|
+
["europe_slash_volgograd", "UTC +04:00 Europe Volgograd"],
|
|
1434
|
+
["indian_slash_mahe", "UTC +04:00 Indian Mahe"],
|
|
1435
|
+
["indian_slash_mauritius", "UTC +04:00 Indian Mauritius"],
|
|
1436
|
+
["indian_slash_reunion", "UTC +04:00 Indian Reunion"],
|
|
1437
|
+
["iran", "UTC +04:30 Asia Iran"],
|
|
1438
|
+
["asia_slash_kabul", "UTC +04:30 Asia Kabul"],
|
|
1439
|
+
["asia_slash_tehran", "UTC +04:30 Asia Tehran"],
|
|
1440
|
+
["antarctica_slash_mawson", "UTC +05:00 Antarctica Mawson"],
|
|
1441
|
+
["asia_slash_aqtau", "UTC +05:00 Asia Aqtau"],
|
|
1442
|
+
["asia_slash_aqtobe", "UTC +05:00 Asia Aqtobe"],
|
|
1443
|
+
["asia_slash_ashgabat", "UTC +05:00 Asia Ashgabat"],
|
|
1444
|
+
["asia_slash_ashkhabad", "UTC +05:00 Asia Ashkhabad"],
|
|
1445
|
+
["asia_slash_atyrau", "UTC +05:00 Asia Atyrau"],
|
|
1446
|
+
["asia_slash_dushanbe", "UTC +05:00 Asia Dushanbe"],
|
|
1447
|
+
["asia_slash_karachi", "UTC +05:00 Asia Karachi"],
|
|
1448
|
+
["asia_slash_oral", "UTC +05:00 Asia Oral"],
|
|
1449
|
+
["asia_slash_samarkand", "UTC +05:00 Asia Samarkand"],
|
|
1450
|
+
["asia_slash_tashkent", "UTC +05:00 Asia Tashkent"],
|
|
1451
|
+
["asia_slash_yekaterinburg", "UTC +05:00 Asia Yekaterinburg"],
|
|
1452
|
+
["indian_slash_kerguelen", "UTC +05:00 Indian Kerguelen"],
|
|
1453
|
+
["indian_slash_maldives", "UTC +05:00 Indian Maldives"],
|
|
1454
|
+
["asia_slash_calcutta", "UTC +05:30 Asia Calcutta"],
|
|
1455
|
+
["asia_slash_colombo", "UTC +05:30 Asia Colombo"],
|
|
1456
|
+
["asia_slash_kolkata", "UTC +05:30 Asia Kolkata"],
|
|
1457
|
+
["asia_slash_kathmandu", "UTC +05:45 Asia Kathmandu"],
|
|
1458
|
+
["asia_slash_katmandu", "UTC +05:45 Asia Katmandu"],
|
|
1459
|
+
["antarctica_slash_vostok", "UTC +06:00 Antarctica Vostok"],
|
|
1460
|
+
["asia_slash_almaty", "UTC +06:00 Asia Almaty"],
|
|
1461
|
+
["asia_slash_bishkek", "UTC +06:00 Asia Bishkek"],
|
|
1462
|
+
["asia_slash_dacca", "UTC +06:00 Asia Dacca"],
|
|
1463
|
+
["asia_slash_dhaka", "UTC +06:00 Asia Dhaka"],
|
|
1464
|
+
["asia_slash_kashgar", "UTC +06:00 Asia Kashgar"],
|
|
1465
|
+
["asia_slash_omsk", "UTC +06:00 Asia Omsk"],
|
|
1466
|
+
["asia_slash_qyzylorda", "UTC +06:00 Asia Qyzylorda"],
|
|
1467
|
+
["asia_slash_thimbu", "UTC +06:00 Asia Thimbu"],
|
|
1468
|
+
["asia_slash_thimphu", "UTC +06:00 Asia Thimphu"],
|
|
1469
|
+
["asia_slash_urumqi", "UTC +06:00 Asia Urumqi"],
|
|
1470
|
+
["indian_slash_chagos", "UTC +06:00 Indian Chagos"],
|
|
1471
|
+
["asia_slash_rangoon", "UTC +06:30 Asia Rangoon"],
|
|
1472
|
+
["asia_slash_yangon", "UTC +06:30 Asia Yangon"],
|
|
1473
|
+
["indian_slash_cocos", "UTC +06:30 Indian Cocos"],
|
|
1474
|
+
["antarctica_slash_davis", "UTC +07:00 Antarctica Davis"],
|
|
1475
|
+
["asia_slash_bangkok", "UTC +07:00 Asia Bangkok"],
|
|
1476
|
+
["asia_slash_barnaul", "UTC +07:00 Asia Barnaul"],
|
|
1477
|
+
["asia_slash_ho_chi_minh", "UTC +07:00 Asia Ho Chi Minh"],
|
|
1478
|
+
["asia_slash_hovd", "UTC +07:00 Asia Hovd"],
|
|
1479
|
+
["asia_slash_jakarta", "UTC +07:00 Asia Jakarta"],
|
|
1480
|
+
["asia_slash_krasnoyarsk", "UTC +07:00 Asia Krasnoyarsk"],
|
|
1481
|
+
["asia_slash_novokuznetsk", "UTC +07:00 Asia Novokuznetsk"],
|
|
1482
|
+
["asia_slash_novosibirsk", "UTC +07:00 Asia Novosibirsk"],
|
|
1483
|
+
["asia_slash_phnom_penh", "UTC +07:00 Asia Phnom Penh"],
|
|
1484
|
+
["asia_slash_pontianak", "UTC +07:00 Asia Pontianak"],
|
|
1485
|
+
["asia_slash_saigon", "UTC +07:00 Asia Saigon"],
|
|
1486
|
+
["asia_slash_tomsk", "UTC +07:00 Asia Tomsk"],
|
|
1487
|
+
["asia_slash_vientiane", "UTC +07:00 Asia Vientiane"],
|
|
1488
|
+
["indian_slash_christmas", "UTC +07:00 Indian Christmas"],
|
|
1489
|
+
["antarctica_slash_casey", "UTC +08:00 Antarctica Casey"],
|
|
1490
|
+
["asia_slash_brunei", "UTC +08:00 Asia Brunei"],
|
|
1491
|
+
["asia_slash_choibalsan", "UTC +08:00 Asia Choibalsan"],
|
|
1492
|
+
["asia_slash_chongqing", "UTC +08:00 Asia Chongqing"],
|
|
1493
|
+
["asia_slash_chungking", "UTC +08:00 Asia Chungking"],
|
|
1494
|
+
["asia_slash_harbin", "UTC +08:00 Asia Harbin"],
|
|
1495
|
+
["asia_slash_hong_kong", "UTC +08:00 Asia Hong Kong"],
|
|
1496
|
+
["asia_slash_irkutsk", "UTC +08:00 Asia Irkutsk"],
|
|
1497
|
+
["asia_slash_kuala_lumpur", "UTC +08:00 Asia Kuala Lumpur"],
|
|
1498
|
+
["asia_slash_kuching", "UTC +08:00 Asia Kuching"],
|
|
1499
|
+
["asia_slash_macao", "UTC +08:00 Asia Macao"],
|
|
1500
|
+
["asia_slash_macau", "UTC +08:00 Asia Macau"],
|
|
1501
|
+
["asia_slash_makassar", "UTC +08:00 Asia Makassar"],
|
|
1502
|
+
["asia_slash_manila", "UTC +08:00 Asia Manila"],
|
|
1503
|
+
["asia_slash_shanghai", "UTC +08:00 Asia Shanghai"],
|
|
1504
|
+
["asia_slash_singapore", "UTC +08:00 Asia Singapore"],
|
|
1505
|
+
["asia_slash_taipei", "UTC +08:00 Asia Taipei"],
|
|
1506
|
+
["asia_slash_ujung_pandang", "UTC +08:00 Asia Ujung Pandang"],
|
|
1507
|
+
["asia_slash_ulaanbaatar", "UTC +08:00 Asia Ulaanbaatar"],
|
|
1508
|
+
["asia_slash_ulan_bator", "UTC +08:00 Asia Ulan Bator"],
|
|
1509
|
+
["australia_slash_perth", "UTC +08:00 Australia Perth"],
|
|
1510
|
+
["australia_slash_west", "UTC +08:00 Australia West"],
|
|
1511
|
+
["australia_slash_eucla", "UTC +08:45 Australia Eucla"],
|
|
1512
|
+
["asia_slash_chita", "UTC +09:00 Asia Chita"],
|
|
1513
|
+
["asia_slash_dili", "UTC +09:00 Asia Dili"],
|
|
1514
|
+
["japan", "UTC +09:00 Asia Japan"],
|
|
1515
|
+
["asia_slash_jayapura", "UTC +09:00 Asia Jayapura"],
|
|
1516
|
+
["asia_slash_khandyga", "UTC +09:00 Asia Khandyga"],
|
|
1517
|
+
["asia_slash_pyongyang", "UTC +09:00 Asia Pyongyang"],
|
|
1518
|
+
["asia_slash_seoul", "UTC +09:00 Asia Seoul"],
|
|
1519
|
+
["asia_slash_tokyo", "UTC +09:00 Asia Tokyo"],
|
|
1520
|
+
["asia_slash_yakutsk", "UTC +09:00 Asia Yakutsk"],
|
|
1521
|
+
["pacific_slash_palau", "UTC +09:00 Pacific Palau"],
|
|
1522
|
+
["australia_slash_adelaide", "UTC +09:30 Australia Adelaide"],
|
|
1523
|
+
["australia_slash_broken_hill", "UTC +09:30 Australia Broken Hill"],
|
|
1524
|
+
["australia_slash_darwin", "UTC +09:30 Australia Darwin"],
|
|
1525
|
+
["australia_slash_north", "UTC +09:30 Australia North"],
|
|
1526
|
+
["australia_slash_south", "UTC +09:30 Australia South"],
|
|
1527
|
+
["australia_slash_yancowinna", "UTC +09:30 Australia Yancowinna"],
|
|
1528
|
+
["antarctica_slash_dumontdurville", "UTC +10:00 Antarctica DumontDUrville"],
|
|
1529
|
+
["asia_slash_ust_hyphen_nera", "UTC +10:00 Asia Ust-Nera"],
|
|
1530
|
+
["asia_slash_vladivostok", "UTC +10:00 Asia Vladivostok"],
|
|
1531
|
+
["australia_slash_act", "UTC +10:00 Australia ACT"],
|
|
1532
|
+
["australia_slash_brisbane", "UTC +10:00 Australia Brisbane"],
|
|
1533
|
+
["australia_slash_canberra", "UTC +10:00 Australia Canberra"],
|
|
1534
|
+
["australia_slash_currie", "UTC +10:00 Australia Currie"],
|
|
1535
|
+
["australia_slash_hobart", "UTC +10:00 Australia Hobart"],
|
|
1536
|
+
["australia_slash_lindeman", "UTC +10:00 Australia Lindeman"],
|
|
1537
|
+
["australia_slash_melbourne", "UTC +10:00 Australia Melbourne"],
|
|
1538
|
+
["australia_slash_nsw", "UTC +10:00 Australia NSW"],
|
|
1539
|
+
["australia_slash_queensland", "UTC +10:00 Australia Queensland"],
|
|
1540
|
+
["australia_slash_sydney", "UTC +10:00 Australia Sydney"],
|
|
1541
|
+
["australia_slash_tasmania", "UTC +10:00 Australia Tasmania"],
|
|
1542
|
+
["australia_slash_victoria", "UTC +10:00 Australia Victoria"],
|
|
1543
|
+
["pacific_slash_chuuk", "UTC +10:00 Pacific Chuuk"],
|
|
1544
|
+
["pacific_slash_guam", "UTC +10:00 Pacific Guam"],
|
|
1545
|
+
["pacific_slash_port_moresby", "UTC +10:00 Pacific Port Moresby"],
|
|
1546
|
+
["pacific_slash_saipan", "UTC +10:00 Pacific Saipan"],
|
|
1547
|
+
["pacific_slash_truk", "UTC +10:00 Pacific Truk"],
|
|
1548
|
+
["pacific_slash_yap", "UTC +10:00 Pacific Yap"],
|
|
1549
|
+
["australia_slash_lhi", "UTC +10:30 Australia LHI"],
|
|
1550
|
+
["australia_slash_lord_howe", "UTC +10:30 Australia Lord Howe"],
|
|
1551
|
+
["antarctica_slash_macquarie", "UTC +11:00 Antarctica Macquarie"],
|
|
1552
|
+
["asia_slash_magadan", "UTC +11:00 Asia Magadan"],
|
|
1553
|
+
["asia_slash_sakhalin", "UTC +11:00 Asia Sakhalin"],
|
|
1554
|
+
["asia_slash_srednekolymsk", "UTC +11:00 Asia Srednekolymsk"],
|
|
1555
|
+
["pacific_slash_bougainville", "UTC +11:00 Pacific Bougainville"],
|
|
1556
|
+
["pacific_slash_efate", "UTC +11:00 Pacific Efate"],
|
|
1557
|
+
["pacific_slash_guadalcanal", "UTC +11:00 Pacific Guadalcanal"],
|
|
1558
|
+
["pacific_slash_kosrae", "UTC +11:00 Pacific Kosrae"],
|
|
1559
|
+
["pacific_slash_norfolk", "UTC +11:00 Pacific Norfolk"],
|
|
1560
|
+
["pacific_slash_noumea", "UTC +11:00 Pacific Noumea"],
|
|
1561
|
+
["pacific_slash_pohnpei", "UTC +11:00 Pacific Pohnpei"],
|
|
1562
|
+
["pacific_slash_ponape", "UTC +11:00 Pacific Ponape"],
|
|
1563
|
+
["antarctica_slash_mcmurdo", "UTC +12:00 Antarctica McMurdo"],
|
|
1564
|
+
["antarctica_slash_south_pole", "UTC +12:00 Antarctica South Pole"],
|
|
1565
|
+
["asia_slash_anadyr", "UTC +12:00 Asia Anadyr"],
|
|
1566
|
+
["asia_slash_kamchatka", "UTC +12:00 Asia Kamchatka"],
|
|
1567
|
+
["pacific_slash_auckland", "UTC +12:00 Pacific Auckland"],
|
|
1568
|
+
["pacific_slash_fiji", "UTC +12:00 Pacific Fiji"],
|
|
1569
|
+
["pacific_slash_funafuti", "UTC +12:00 Pacific Funafuti"],
|
|
1570
|
+
["kwajalein", "UTC +12:00 Pacific Kwajalein"],
|
|
1571
|
+
["pacific_slash_majuro", "UTC +12:00 Pacific Majuro"],
|
|
1572
|
+
["pacific_slash_nauru", "UTC +12:00 Pacific Nauru"],
|
|
1573
|
+
["pacific_slash_tarawa", "UTC +12:00 Pacific Tarawa"],
|
|
1574
|
+
["pacific_slash_wake", "UTC +12:00 Pacific Wake"],
|
|
1575
|
+
["pacific_slash_wallis", "UTC +12:00 Pacific Wallis"],
|
|
1576
|
+
["pacific_slash_chatham", "UTC +12:45 Pacific Chatham"],
|
|
1577
|
+
["pacific_slash_apia", "UTC +13:00 Pacific Apia"],
|
|
1578
|
+
["pacific_slash_enderbury", "UTC +13:00 Pacific Enderbury"],
|
|
1579
|
+
["pacific_slash_fakaofo", "UTC +13:00 Pacific Fakaofo"],
|
|
1580
|
+
["pacific_slash_tongatapu", "UTC +13:00 Pacific Tongatapu"],
|
|
1581
|
+
["pacific_slash_kiritimati", "UTC +14:00 Pacific Kiritimati"]
|
|
1582
|
+
]
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
key: "twitterUsername",
|
|
1586
|
+
prop: "twitterhandle",
|
|
1587
|
+
kind: "string",
|
|
1588
|
+
title: "Twitter Username",
|
|
1589
|
+
description: "The contact's Twitter handle. This is set by HubSpot using the contact's email address."
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
key: "websiteUrl",
|
|
1593
|
+
prop: "website",
|
|
1594
|
+
kind: "string",
|
|
1595
|
+
title: "Website URL",
|
|
1596
|
+
description: "The contact's company website"
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
key: "whatsappPhoneNumber",
|
|
1600
|
+
prop: "hs_whatsapp_phone_number",
|
|
1601
|
+
kind: "string",
|
|
1602
|
+
title: "WhatsApp Phone Number",
|
|
1603
|
+
description: "The phone number associated with the contact’s WhatsApp account"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
key: "workEmail",
|
|
1607
|
+
prop: "work_email",
|
|
1608
|
+
kind: "string",
|
|
1609
|
+
title: "Work Email",
|
|
1610
|
+
description: "A contact's work email. This property is required for the Facebook Ads Integration. This property will be automatically synced via the Lead Ads tool"
|
|
1611
|
+
}
|
|
1612
|
+
];
|
|
1613
|
+
const COMPANY_CREATE_FIELDS = [
|
|
1614
|
+
{
|
|
1615
|
+
key: "aboutUs",
|
|
1616
|
+
prop: "about_us",
|
|
1617
|
+
kind: "string",
|
|
1618
|
+
title: "About Us"
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
key: "annualRevenue",
|
|
1622
|
+
prop: "annualrevenue",
|
|
1623
|
+
kind: "numberText",
|
|
1624
|
+
title: "Annual Revenue",
|
|
1625
|
+
description: "The actual or estimated annual revenue of the company"
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
key: "city",
|
|
1629
|
+
prop: "city",
|
|
1630
|
+
kind: "string",
|
|
1631
|
+
title: "City",
|
|
1632
|
+
description: "The city where the company is located"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
key: "closeDate",
|
|
1636
|
+
prop: "closedate",
|
|
1637
|
+
kind: "dateMs",
|
|
1638
|
+
title: "Close Date",
|
|
1639
|
+
description: "The date the company or organization was closed as a customer. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
key: "companyDomainName",
|
|
1643
|
+
prop: "domain",
|
|
1644
|
+
kind: "string",
|
|
1645
|
+
title: "Company Domain Name",
|
|
1646
|
+
description: "The domain name of the company or organization"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
key: "companyOwner",
|
|
1650
|
+
prop: "hubspot_owner_id",
|
|
1651
|
+
kind: "string",
|
|
1652
|
+
title: "Company Owner",
|
|
1653
|
+
description: "The owner of the company."
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
key: "countryRegion",
|
|
1657
|
+
prop: "country",
|
|
1658
|
+
kind: "string",
|
|
1659
|
+
title: "Country/Region",
|
|
1660
|
+
description: "The country/region in which the company or organization is located"
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
key: "description",
|
|
1664
|
+
prop: "description",
|
|
1665
|
+
kind: "string",
|
|
1666
|
+
title: "Description",
|
|
1667
|
+
description: "A short statement about the company's mission and goals"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
key: "facebookFans",
|
|
1671
|
+
prop: "facebookfans",
|
|
1672
|
+
kind: "number",
|
|
1673
|
+
title: "Facebook Fans",
|
|
1674
|
+
description: "Number of facebook fans"
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
key: "googlePlusPage",
|
|
1678
|
+
prop: "googleplus_page",
|
|
1679
|
+
kind: "string",
|
|
1680
|
+
title: "Google Plus Page",
|
|
1681
|
+
description: "The URL of the Google Plus page for the company or organization"
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
key: "industry",
|
|
1685
|
+
prop: "industry",
|
|
1686
|
+
kind: "string",
|
|
1687
|
+
title: "Industry",
|
|
1688
|
+
description: "The type of business the company performs."
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
key: "isPublic",
|
|
1692
|
+
prop: "is_public",
|
|
1693
|
+
kind: "boolean",
|
|
1694
|
+
title: "Is Public",
|
|
1695
|
+
description: "Whether that the company is publicly traded"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
key: "leadStatus",
|
|
1699
|
+
prop: "hs_lead_status",
|
|
1700
|
+
kind: "string",
|
|
1701
|
+
title: "Lead Status",
|
|
1702
|
+
description: "The company's sales, prospecting or outreach status."
|
|
1703
|
+
},
|
|
1704
|
+
{
|
|
1705
|
+
key: "lifecycleStatus",
|
|
1706
|
+
prop: "lifecyclestage",
|
|
1707
|
+
kind: "string",
|
|
1708
|
+
title: "Lifecycle Stage",
|
|
1709
|
+
description: "The most advanced lifecycle stage across all contacts associated with this company or organization."
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
key: "linkedinBio",
|
|
1713
|
+
prop: "linkedinbio",
|
|
1714
|
+
kind: "string",
|
|
1715
|
+
title: "LinkedIn Bio",
|
|
1716
|
+
description: "The LinkedIn bio for the company or organization"
|
|
1717
|
+
},
|
|
1718
|
+
{
|
|
1719
|
+
key: "linkedInCompanyPage",
|
|
1720
|
+
prop: "linkedin_company_page",
|
|
1721
|
+
kind: "string",
|
|
1722
|
+
title: "LinkedIn Company Page",
|
|
1723
|
+
description: "The URL of the LinkedIn company page for the company or organization"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
key: "numberOfEmployees",
|
|
1727
|
+
prop: "numberofemployees",
|
|
1728
|
+
kind: "number",
|
|
1729
|
+
title: "Number Of Employees",
|
|
1730
|
+
description: "The total number of employees who work for the company or organization"
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
key: "originalSourceType",
|
|
1734
|
+
prop: "hs_analytics_source",
|
|
1735
|
+
kind: "string",
|
|
1736
|
+
title: "Original Source Type",
|
|
1737
|
+
description: "Original source for the contact with the earliest activity for this company or organization."
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
key: "phoneNumber",
|
|
1741
|
+
prop: "phone",
|
|
1742
|
+
kind: "string",
|
|
1743
|
+
title: "Phone Number",
|
|
1744
|
+
description: "A company's primary phone number. Powered by HubSpot Insights."
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
key: "postalCode",
|
|
1748
|
+
prop: "zip",
|
|
1749
|
+
kind: "string",
|
|
1750
|
+
title: "Postal Code",
|
|
1751
|
+
description: "The postal or zip code of the company or organization. Powered by HubSpot Insights."
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
key: "stateRegion",
|
|
1755
|
+
prop: "state",
|
|
1756
|
+
kind: "string",
|
|
1757
|
+
title: "State/Region",
|
|
1758
|
+
description: "The state or region in which the company or organization is located. Powered by HubSpot Insights."
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
key: "streetAddress",
|
|
1762
|
+
prop: "address",
|
|
1763
|
+
kind: "string",
|
|
1764
|
+
title: "Street Address",
|
|
1765
|
+
description: "The street address of the company or organization, including unit number. Powered by HubSpot Insights."
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
key: "streetAddress2",
|
|
1769
|
+
prop: "address2",
|
|
1770
|
+
kind: "string",
|
|
1771
|
+
title: "Street Address 2",
|
|
1772
|
+
description: "The additional address of the company or organization. Powered by HubSpot Insights."
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
key: "targetAccount",
|
|
1776
|
+
prop: "hs_target_account",
|
|
1777
|
+
kind: "string",
|
|
1778
|
+
title: "Target Account",
|
|
1779
|
+
description: "The Target Account property is a means to flag high priority companies if you are following an account based strategy."
|
|
1780
|
+
},
|
|
1781
|
+
{
|
|
1782
|
+
key: "timezone",
|
|
1783
|
+
prop: "timezone",
|
|
1784
|
+
kind: "string",
|
|
1785
|
+
title: "Timezone",
|
|
1786
|
+
description: "The time zone where the company or organization is located. Powered by HubSpot Insights."
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
key: "totalMoneyRaised",
|
|
1790
|
+
prop: "total_money_raised",
|
|
1791
|
+
kind: "number",
|
|
1792
|
+
title: "Total Money Raised",
|
|
1793
|
+
description: "The total amount of money raised by the company. Powered by HubSpot Insights."
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
key: "twitterBio",
|
|
1797
|
+
prop: "twitterbio",
|
|
1798
|
+
kind: "string",
|
|
1799
|
+
title: "Twitter Bio",
|
|
1800
|
+
description: "The Twitter bio of the company or organization"
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
key: "twitterFollowers",
|
|
1804
|
+
prop: "twitterfollowers",
|
|
1805
|
+
kind: "number",
|
|
1806
|
+
title: "Twitter Followers",
|
|
1807
|
+
description: "The number of Twitter followers of the company or organization"
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
key: "twitterHandle",
|
|
1811
|
+
prop: "twitterhandle",
|
|
1812
|
+
kind: "string",
|
|
1813
|
+
title: "Twitter Handle",
|
|
1814
|
+
description: "The main twitter account of the company or organization"
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
key: "type",
|
|
1818
|
+
prop: "type",
|
|
1819
|
+
kind: "string",
|
|
1820
|
+
title: "Type",
|
|
1821
|
+
description: "The optional classification of this company record - prospect, partner, etc."
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
key: "webTechnologies",
|
|
1825
|
+
prop: "web_technologies",
|
|
1826
|
+
kind: "string",
|
|
1827
|
+
title: "Web Technologies",
|
|
1828
|
+
description: "The web technologies used by the company or organization. Powered by HubSpot Insights."
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
key: "websiteUrl",
|
|
1832
|
+
prop: "website",
|
|
1833
|
+
kind: "string",
|
|
1834
|
+
title: "Website URL",
|
|
1835
|
+
description: "The main website of the company or organization. This property is used to identify unique companies. Powered by HubSpot Insights."
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
key: "yearFounded",
|
|
1839
|
+
prop: "founded_year",
|
|
1840
|
+
kind: "string",
|
|
1841
|
+
title: "Year Founded",
|
|
1842
|
+
description: "The year the company was created. Powered by HubSpot Insights."
|
|
1843
|
+
}
|
|
1844
|
+
];
|
|
1845
|
+
const COMPANY_UPDATE_FIELDS = [
|
|
1846
|
+
{
|
|
1847
|
+
key: "aboutUs",
|
|
1848
|
+
prop: "about_us",
|
|
1849
|
+
kind: "string",
|
|
1850
|
+
title: "About Us"
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
key: "annualRevenue",
|
|
1854
|
+
prop: "annualrevenue",
|
|
1855
|
+
kind: "numberText",
|
|
1856
|
+
title: "Annual Revenue",
|
|
1857
|
+
description: "The actual or estimated annual revenue of the company"
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
key: "city",
|
|
1861
|
+
prop: "city",
|
|
1862
|
+
kind: "string",
|
|
1863
|
+
title: "City",
|
|
1864
|
+
description: "The city where the company is located"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
key: "closeDate",
|
|
1868
|
+
prop: "closedate",
|
|
1869
|
+
kind: "dateMs",
|
|
1870
|
+
title: "Close Date",
|
|
1871
|
+
description: "The date the company or organization was closed as a customer. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
key: "companyDomainName",
|
|
1875
|
+
prop: "domain",
|
|
1876
|
+
kind: "string",
|
|
1877
|
+
title: "Company Domain Name",
|
|
1878
|
+
description: "The domain name of the company or organization"
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
key: "companyOwner",
|
|
1882
|
+
prop: "hubspot_owner_id",
|
|
1883
|
+
kind: "string",
|
|
1884
|
+
title: "Company Owner",
|
|
1885
|
+
description: "The owner of the company."
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
key: "countryRegion",
|
|
1889
|
+
prop: "country",
|
|
1890
|
+
kind: "string",
|
|
1891
|
+
title: "Country/Region",
|
|
1892
|
+
description: "The country/region in which the company or organization is located"
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
key: "description",
|
|
1896
|
+
prop: "description",
|
|
1897
|
+
kind: "string",
|
|
1898
|
+
title: "Description",
|
|
1899
|
+
description: "A short statement about the company's mission and goals"
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
key: "facebookFans",
|
|
1903
|
+
prop: "facebookfans",
|
|
1904
|
+
kind: "number",
|
|
1905
|
+
title: "Facebook Fans",
|
|
1906
|
+
description: "Number of facebook fans"
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
key: "googlePlusPage",
|
|
1910
|
+
prop: "googleplus_page",
|
|
1911
|
+
kind: "string",
|
|
1912
|
+
title: "Google Plus Page",
|
|
1913
|
+
description: "The URL of the Google Plus page for the company or organization"
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
key: "industry",
|
|
1917
|
+
prop: "industry",
|
|
1918
|
+
kind: "string",
|
|
1919
|
+
title: "Industry",
|
|
1920
|
+
description: "The type of business the company performs."
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
key: "isPublic",
|
|
1924
|
+
prop: "is_public",
|
|
1925
|
+
kind: "boolean",
|
|
1926
|
+
title: "Is Public",
|
|
1927
|
+
description: "Whether that the company is publicly traded"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
key: "leadStatus",
|
|
1931
|
+
prop: "hs_lead_status",
|
|
1932
|
+
kind: "string",
|
|
1933
|
+
title: "Lead Status",
|
|
1934
|
+
description: "The company's sales, prospecting or outreach status."
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
key: "lifecycleStatus",
|
|
1938
|
+
prop: "lifecyclestage",
|
|
1939
|
+
kind: "string",
|
|
1940
|
+
title: "Lifecycle Stage",
|
|
1941
|
+
description: "The most advanced lifecycle stage across all contacts associated with this company or organization."
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
key: "linkedinBio",
|
|
1945
|
+
prop: "linkedinbio",
|
|
1946
|
+
kind: "string",
|
|
1947
|
+
title: "Linkedin Bio",
|
|
1948
|
+
description: "The LinkedIn bio for the company or organization"
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
key: "linkedInCompanyPage",
|
|
1952
|
+
prop: "linkedin_company_page",
|
|
1953
|
+
kind: "string",
|
|
1954
|
+
title: "LinkedIn Company Page",
|
|
1955
|
+
description: "The URL of the LinkedIn company page for the company or organization"
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
key: "name",
|
|
1959
|
+
prop: "name",
|
|
1960
|
+
kind: "string",
|
|
1961
|
+
title: "Name"
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
key: "numberOfEmployees",
|
|
1965
|
+
prop: "numberofemployees",
|
|
1966
|
+
kind: "number",
|
|
1967
|
+
title: "Number Of Employees",
|
|
1968
|
+
description: "The total number of employees who work for the company or organization"
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
key: "originalSourceType",
|
|
1972
|
+
prop: "hs_analytics_source",
|
|
1973
|
+
kind: "string",
|
|
1974
|
+
title: "Original Source Type",
|
|
1975
|
+
description: "Original source for the contact with the earliest activity for this company or organization."
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
key: "phoneNumber",
|
|
1979
|
+
prop: "phone",
|
|
1980
|
+
kind: "string",
|
|
1981
|
+
title: "Phone Number",
|
|
1982
|
+
description: "A company's primary phone number. Powered by HubSpot Insights."
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
key: "postalCode",
|
|
1986
|
+
prop: "zip",
|
|
1987
|
+
kind: "string",
|
|
1988
|
+
title: "Postal Code",
|
|
1989
|
+
description: "The postal or zip code of the company or organization. Powered by HubSpot Insights."
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
key: "stateRegion",
|
|
1993
|
+
prop: "state",
|
|
1994
|
+
kind: "string",
|
|
1995
|
+
title: "State/Region",
|
|
1996
|
+
description: "The state or region in which the company or organization is located. Powered by HubSpot Insights."
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
key: "streetAddress",
|
|
2000
|
+
prop: "address",
|
|
2001
|
+
kind: "string",
|
|
2002
|
+
title: "Street Address",
|
|
2003
|
+
description: "The street address of the company or organization, including unit number. Powered by HubSpot Insights."
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
key: "streetAddress2",
|
|
2007
|
+
prop: "address2",
|
|
2008
|
+
kind: "string",
|
|
2009
|
+
title: "Street Address 2",
|
|
2010
|
+
description: "The additional address of the company or organization. Powered by HubSpot Insights."
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
key: "targetAccount",
|
|
2014
|
+
prop: "hs_target_account",
|
|
2015
|
+
kind: "string",
|
|
2016
|
+
title: "Target Account",
|
|
2017
|
+
description: "The Target Account property is a means to flag high priority companies if you are following an account based strategy."
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
key: "timezone",
|
|
2021
|
+
prop: "timezone",
|
|
2022
|
+
kind: "string",
|
|
2023
|
+
title: "Timezone",
|
|
2024
|
+
description: "The time zone where the company or organization is located. Powered by HubSpot Insights."
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
key: "totalMoneyRaised",
|
|
2028
|
+
prop: "total_money_raised",
|
|
2029
|
+
kind: "number",
|
|
2030
|
+
title: "Total Money Raised",
|
|
2031
|
+
description: "The total amount of money raised by the company. Powered by HubSpot Insights."
|
|
2032
|
+
},
|
|
2033
|
+
{
|
|
2034
|
+
key: "twitterBio",
|
|
2035
|
+
prop: "twitterbio",
|
|
2036
|
+
kind: "string",
|
|
2037
|
+
title: "Twitter Bio",
|
|
2038
|
+
description: "The Twitter bio of the company or organization"
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
key: "twitterFollowers",
|
|
2042
|
+
prop: "twitterfollowers",
|
|
2043
|
+
kind: "number",
|
|
2044
|
+
title: "Twitter Followers",
|
|
2045
|
+
description: "The number of Twitter followers of the company or organization"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
key: "twitterHandle",
|
|
2049
|
+
prop: "twitterhandle",
|
|
2050
|
+
kind: "string",
|
|
2051
|
+
title: "Twitter Handle",
|
|
2052
|
+
description: "The main twitter account of the company or organization"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
key: "type",
|
|
2056
|
+
prop: "type",
|
|
2057
|
+
kind: "string",
|
|
2058
|
+
title: "Type",
|
|
2059
|
+
description: "The optional classification of this company record - prospect, partner, etc."
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
key: "webTechnologies",
|
|
2063
|
+
prop: "web_technologies",
|
|
2064
|
+
kind: "string",
|
|
2065
|
+
title: "Web Technologies",
|
|
2066
|
+
description: "The web technologies used by the company or organization. Powered by HubSpot Insights."
|
|
2067
|
+
},
|
|
2068
|
+
{
|
|
2069
|
+
key: "websiteUrl",
|
|
2070
|
+
prop: "website",
|
|
2071
|
+
kind: "string",
|
|
2072
|
+
title: "Website URL",
|
|
2073
|
+
description: "The main website of the company or organization. This property is used to identify unique companies. Powered by HubSpot Insights."
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
key: "yearFounded",
|
|
2077
|
+
prop: "founded_year",
|
|
2078
|
+
kind: "string",
|
|
2079
|
+
title: "Year Founded",
|
|
2080
|
+
description: "The year the company was created. Powered by HubSpot Insights."
|
|
2081
|
+
}
|
|
2082
|
+
];
|
|
2083
|
+
const DEAL_CREATE_FIELDS = [
|
|
2084
|
+
{
|
|
2085
|
+
key: "amount",
|
|
2086
|
+
prop: "amount",
|
|
2087
|
+
kind: "string",
|
|
2088
|
+
title: "Amount"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
key: "closeDate",
|
|
2092
|
+
prop: "closedate",
|
|
2093
|
+
kind: "dateMs",
|
|
2094
|
+
title: "Close Date",
|
|
2095
|
+
description: "A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2096
|
+
},
|
|
2097
|
+
{
|
|
2098
|
+
key: "description",
|
|
2099
|
+
prop: "description",
|
|
2100
|
+
kind: "string",
|
|
2101
|
+
title: "Deal Description"
|
|
2102
|
+
},
|
|
2103
|
+
{
|
|
2104
|
+
key: "dealName",
|
|
2105
|
+
prop: "dealname",
|
|
2106
|
+
kind: "string",
|
|
2107
|
+
title: "Deal Name"
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
key: "dealOwner",
|
|
2111
|
+
prop: "hubspot_owner_id",
|
|
2112
|
+
kind: "string",
|
|
2113
|
+
title: "Deal Owner",
|
|
2114
|
+
description: "The HubSpot user to be assigned to the deal"
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
key: "dealType",
|
|
2118
|
+
prop: "dealtype",
|
|
2119
|
+
kind: "string",
|
|
2120
|
+
title: "Deal Type"
|
|
2121
|
+
},
|
|
2122
|
+
{
|
|
2123
|
+
key: "pipeline",
|
|
2124
|
+
prop: "pipeline",
|
|
2125
|
+
kind: "string",
|
|
2126
|
+
title: "Pipeline"
|
|
2127
|
+
}
|
|
2128
|
+
];
|
|
2129
|
+
const DEAL_UPDATE_FIELDS = [
|
|
2130
|
+
{
|
|
2131
|
+
key: "amount",
|
|
2132
|
+
prop: "amount",
|
|
2133
|
+
kind: "string",
|
|
2134
|
+
title: "Amount"
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
key: "closeDate",
|
|
2138
|
+
prop: "closedate",
|
|
2139
|
+
kind: "dateMs",
|
|
2140
|
+
title: "Close Date",
|
|
2141
|
+
description: "A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
key: "description",
|
|
2145
|
+
prop: "description",
|
|
2146
|
+
kind: "string",
|
|
2147
|
+
title: "Deal Description"
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
key: "dealName",
|
|
2151
|
+
prop: "dealname",
|
|
2152
|
+
kind: "string",
|
|
2153
|
+
title: "Deal Name"
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
key: "dealOwner",
|
|
2157
|
+
prop: "hubspot_owner_id",
|
|
2158
|
+
kind: "string",
|
|
2159
|
+
title: "Deal Owner",
|
|
2160
|
+
description: "The HubSpot user to be assigned to the deal"
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
key: "stage",
|
|
2164
|
+
prop: "dealstage",
|
|
2165
|
+
kind: "string",
|
|
2166
|
+
title: "Deal Stage",
|
|
2167
|
+
description: "The deal stage is required when creating a deal. See the CRM Pipelines API for details on managing pipelines and stages."
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
key: "dealType",
|
|
2171
|
+
prop: "dealtype",
|
|
2172
|
+
kind: "string",
|
|
2173
|
+
title: "Deal Type"
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
key: "pipeline",
|
|
2177
|
+
prop: "pipeline",
|
|
2178
|
+
kind: "string",
|
|
2179
|
+
title: "Pipeline"
|
|
2180
|
+
}
|
|
2181
|
+
];
|
|
2182
|
+
const TICKET_CREATE_FIELDS = [
|
|
2183
|
+
{
|
|
2184
|
+
key: "category",
|
|
2185
|
+
prop: "hs_ticket_category",
|
|
2186
|
+
kind: "string",
|
|
2187
|
+
title: "Category",
|
|
2188
|
+
description: "Main reason customer reached out for help."
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
key: "closeDate",
|
|
2192
|
+
prop: "closed_date",
|
|
2193
|
+
kind: "dateMs",
|
|
2194
|
+
title: "Close Date",
|
|
2195
|
+
description: "The date the ticket was closed. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
key: "createDate",
|
|
2199
|
+
prop: "createdate",
|
|
2200
|
+
kind: "dateMs",
|
|
2201
|
+
title: "Create Date",
|
|
2202
|
+
description: "The date the ticket was created. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
key: "description",
|
|
2206
|
+
prop: "content",
|
|
2207
|
+
kind: "string",
|
|
2208
|
+
title: "Description",
|
|
2209
|
+
description: "Description of the ticket"
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
key: "priority",
|
|
2213
|
+
prop: "hs_ticket_priority",
|
|
2214
|
+
kind: "string",
|
|
2215
|
+
title: "Priority",
|
|
2216
|
+
description: "The level of attention needed on the ticket."
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
key: "resolution",
|
|
2220
|
+
prop: "hs_resolution",
|
|
2221
|
+
kind: "string",
|
|
2222
|
+
title: "Resolution",
|
|
2223
|
+
description: "The action taken to resolve the ticket."
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
key: "source",
|
|
2227
|
+
prop: "source_type",
|
|
2228
|
+
kind: "string",
|
|
2229
|
+
title: "Source",
|
|
2230
|
+
description: "Channel where ticket was originally submitted."
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
key: "ticketOwnerId",
|
|
2234
|
+
prop: "hubspot_owner_id",
|
|
2235
|
+
kind: "string",
|
|
2236
|
+
title: "Ticket Owner",
|
|
2237
|
+
description: "The user from your team that the ticket is assigned to. You can assign additional users to a ticket record by creating a custom HubSpot user property."
|
|
2238
|
+
}
|
|
2239
|
+
];
|
|
2240
|
+
const TICKET_UPDATE_FIELDS = [
|
|
2241
|
+
{
|
|
2242
|
+
key: "category",
|
|
2243
|
+
prop: "hs_ticket_category",
|
|
2244
|
+
kind: "string",
|
|
2245
|
+
title: "Category",
|
|
2246
|
+
description: "Main reason customer reached out for help."
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
key: "closeDate",
|
|
2250
|
+
prop: "closed_date",
|
|
2251
|
+
kind: "dateMs",
|
|
2252
|
+
title: "Close Date",
|
|
2253
|
+
description: "The date the ticket was closed. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
key: "createDate",
|
|
2257
|
+
prop: "createdate",
|
|
2258
|
+
kind: "dateMs",
|
|
2259
|
+
title: "Create Date",
|
|
2260
|
+
description: "The date the ticket was created. A date and time as ISO 8601, such as 2025-01-31T10:00:00Z"
|
|
2261
|
+
},
|
|
2262
|
+
{
|
|
2263
|
+
key: "description",
|
|
2264
|
+
prop: "content",
|
|
2265
|
+
kind: "string",
|
|
2266
|
+
title: "Description",
|
|
2267
|
+
description: "Description of the ticket"
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
key: "pipelineId",
|
|
2271
|
+
prop: "hs_pipeline",
|
|
2272
|
+
kind: "string",
|
|
2273
|
+
title: "Pipeline",
|
|
2274
|
+
description: "The ID of the pipeline the ticket is in."
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
key: "priority",
|
|
2278
|
+
prop: "hs_ticket_priority",
|
|
2279
|
+
kind: "string",
|
|
2280
|
+
title: "Priority",
|
|
2281
|
+
description: "The level of attention needed on the ticket."
|
|
2282
|
+
},
|
|
2283
|
+
{
|
|
2284
|
+
key: "resolution",
|
|
2285
|
+
prop: "hs_resolution",
|
|
2286
|
+
kind: "string",
|
|
2287
|
+
title: "Resolution",
|
|
2288
|
+
description: "The action taken to resolve the ticket."
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
key: "source",
|
|
2292
|
+
prop: "source_type",
|
|
2293
|
+
kind: "string",
|
|
2294
|
+
title: "Source",
|
|
2295
|
+
description: "Channel where ticket was originally submitted."
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
key: "stageId",
|
|
2299
|
+
prop: "hs_pipeline_stage",
|
|
2300
|
+
kind: "string",
|
|
2301
|
+
title: "Stage",
|
|
2302
|
+
description: "The stage ID of the pipeline the ticket is in; depends on Pipeline ID."
|
|
2303
|
+
},
|
|
2304
|
+
{
|
|
2305
|
+
key: "ticketName",
|
|
2306
|
+
prop: "subject",
|
|
2307
|
+
kind: "string",
|
|
2308
|
+
title: "Ticket Name"
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
key: "ticketOwnerId",
|
|
2312
|
+
prop: "hubspot_owner_id",
|
|
2313
|
+
kind: "string",
|
|
2314
|
+
title: "Ticket Owner",
|
|
2315
|
+
description: "The user from your team that the ticket is assigned to. You can assign additional users to a ticket record by creating a custom HubSpot user property."
|
|
2316
|
+
}
|
|
2317
|
+
];
|
|
2318
|
+
// src/config.ts
|
|
2319
|
+
const RESOURCES = [
|
|
2320
|
+
"company",
|
|
2321
|
+
"contact",
|
|
2322
|
+
"contactList",
|
|
2323
|
+
"deal",
|
|
2324
|
+
"engagement",
|
|
2325
|
+
"ticket"
|
|
2326
|
+
];
|
|
2327
|
+
const OPERATIONS_OF = {
|
|
2328
|
+
company: [
|
|
2329
|
+
"create",
|
|
2330
|
+
"delete",
|
|
2331
|
+
"get",
|
|
2332
|
+
"getAll",
|
|
2333
|
+
"getRecentlyCreatedUpdated",
|
|
2334
|
+
"searchByDomain",
|
|
2335
|
+
"update"
|
|
2336
|
+
],
|
|
2337
|
+
contact: [
|
|
2338
|
+
"upsert",
|
|
2339
|
+
"delete",
|
|
2340
|
+
"get",
|
|
2341
|
+
"getAll",
|
|
2342
|
+
"getRecentlyCreatedUpdated",
|
|
2343
|
+
"search"
|
|
2344
|
+
],
|
|
2345
|
+
contactList: ["add", "remove"],
|
|
2346
|
+
deal: [
|
|
2347
|
+
"create",
|
|
2348
|
+
"delete",
|
|
2349
|
+
"get",
|
|
2350
|
+
"getAll",
|
|
2351
|
+
"getRecentlyCreatedUpdated",
|
|
2352
|
+
"search",
|
|
2353
|
+
"update"
|
|
2354
|
+
],
|
|
2355
|
+
engagement: [
|
|
2356
|
+
"create",
|
|
2357
|
+
"delete",
|
|
2358
|
+
"get",
|
|
2359
|
+
"getAll"
|
|
2360
|
+
],
|
|
2361
|
+
ticket: [
|
|
2362
|
+
"create",
|
|
2363
|
+
"delete",
|
|
2364
|
+
"get",
|
|
2365
|
+
"getAll",
|
|
2366
|
+
"update"
|
|
2367
|
+
]
|
|
2368
|
+
};
|
|
2369
|
+
const ALL_OPERATIONS = [...new Set(Object.values(OPERATIONS_OF).flat())];
|
|
2370
|
+
const AUTHENTICATIONS = ["appToken", "oAuth2"];
|
|
2371
|
+
const ENGAGEMENT_TYPES = [
|
|
2372
|
+
"call",
|
|
2373
|
+
"email",
|
|
2374
|
+
"meeting",
|
|
2375
|
+
"task"
|
|
2376
|
+
];
|
|
2377
|
+
const PROPERTY_MODES = ["valueAndHistory", "valueOnly"];
|
|
2378
|
+
const SEARCH_OPERATORS = [
|
|
2379
|
+
"CONTAINS_TOKEN",
|
|
2380
|
+
"EQ",
|
|
2381
|
+
"GT",
|
|
2382
|
+
"GTE",
|
|
2383
|
+
"HAS_PROPERTY",
|
|
2384
|
+
"LT",
|
|
2385
|
+
"LTE",
|
|
2386
|
+
"NEQ",
|
|
2387
|
+
"NOT_HAS_PROPERTY"
|
|
2388
|
+
];
|
|
2389
|
+
/** Show a field for these operations of these resources. */
|
|
2390
|
+
const on = (operations) => ({ showWhen: Object.entries(operations).map(([resource, ops]) => ({
|
|
2391
|
+
resource: [resource],
|
|
2392
|
+
operation: [...ops ?? []]
|
|
2393
|
+
})) });
|
|
2394
|
+
const ISO_HINT = "A date and time as ISO 8601, such as 2025-01-31T10:00:00Z";
|
|
2395
|
+
/** The zod type of one field of an object. */
|
|
2396
|
+
function fieldSchema(spec) {
|
|
2397
|
+
let schema;
|
|
2398
|
+
const meta = { title: spec.title };
|
|
2399
|
+
if (spec.description) meta.description = spec.description;
|
|
2400
|
+
switch (spec.kind) {
|
|
2401
|
+
case "number":
|
|
2402
|
+
case "numberText":
|
|
2403
|
+
schema = zod.z.number();
|
|
2404
|
+
break;
|
|
2405
|
+
case "boolean":
|
|
2406
|
+
schema = zod.z.boolean();
|
|
2407
|
+
break;
|
|
2408
|
+
case "enum":
|
|
2409
|
+
case "multi": {
|
|
2410
|
+
const values = [...new Set((spec.options ?? []).map(([value]) => value))];
|
|
2411
|
+
meta.labels = Object.fromEntries((spec.options ?? []).map(([value, label]) => [value, label]));
|
|
2412
|
+
schema = spec.kind === "enum" ? zod.z.enum(values) : zod.z.array(zod.z.enum(values));
|
|
2413
|
+
break;
|
|
2414
|
+
}
|
|
2415
|
+
default: schema = zod.z.string();
|
|
2416
|
+
}
|
|
2417
|
+
return schema.meta(meta);
|
|
2418
|
+
}
|
|
2419
|
+
/** An object with one optional key for each field. */
|
|
2420
|
+
const collectionOf = (specs, extra = {}) => zod.z.object({
|
|
2421
|
+
...Object.fromEntries(specs.map((spec) => [spec.key, fieldSchema(spec)])),
|
|
2422
|
+
...extra
|
|
2423
|
+
}).partial();
|
|
2424
|
+
const customProperties = zod.z.record(zod.z.string(), zod.z.unknown()).meta({
|
|
2425
|
+
ui: "fields",
|
|
2426
|
+
title: "Custom Properties",
|
|
2427
|
+
description: "The name is the internal name of the property. The value is the new value"
|
|
2428
|
+
});
|
|
2429
|
+
const propertyList = (title, description) => zod.z.array(zod.z.string()).meta({
|
|
2430
|
+
title,
|
|
2431
|
+
description
|
|
2432
|
+
});
|
|
2433
|
+
const propertyMode = zod.z.enum(PROPERTY_MODES).meta({
|
|
2434
|
+
title: "Include",
|
|
2435
|
+
description: "Get the current value of a property, or the value and all the old values of the property",
|
|
2436
|
+
labels: {
|
|
2437
|
+
valueAndHistory: "Value And History",
|
|
2438
|
+
valueOnly: "Value Only"
|
|
2439
|
+
}
|
|
2440
|
+
});
|
|
2441
|
+
const sinceField = zod.z.string().meta({
|
|
2442
|
+
title: "Since",
|
|
2443
|
+
description: ISO_HINT
|
|
2444
|
+
});
|
|
2445
|
+
const filterItem = zod.z.object({
|
|
2446
|
+
propertyName: zod.z.string().meta({
|
|
2447
|
+
title: "Property Name",
|
|
2448
|
+
description: "The internal name of the property, such as email"
|
|
2449
|
+
}),
|
|
2450
|
+
operator: zod.z.enum(SEARCH_OPERATORS).default("EQ").meta({
|
|
2451
|
+
labels: {
|
|
2452
|
+
CONTAINS_TOKEN: "Contains Exactly",
|
|
2453
|
+
EQ: "Equal",
|
|
2454
|
+
GT: "Greater Than",
|
|
2455
|
+
GTE: "Greater Than Or Equal",
|
|
2456
|
+
HAS_PROPERTY: "Is Known",
|
|
2457
|
+
LT: "Less Than",
|
|
2458
|
+
LTE: "Less Than Or Equal",
|
|
2459
|
+
NEQ: "Not Equal",
|
|
2460
|
+
NOT_HAS_PROPERTY: "Is Unknown"
|
|
2461
|
+
},
|
|
2462
|
+
hints: {
|
|
2463
|
+
GT: "For number properties",
|
|
2464
|
+
GTE: "For number properties",
|
|
2465
|
+
LT: "For number properties",
|
|
2466
|
+
LTE: "For number properties"
|
|
2467
|
+
}
|
|
2468
|
+
}),
|
|
2469
|
+
value: zod.z.string().optional().meta({ description: "Not used with Is Known and Is Unknown" })
|
|
2470
|
+
});
|
|
2471
|
+
const filterGroup = zod.z.object({ filters: zod.z.array(filterItem).default([]).meta({
|
|
2472
|
+
title: "Filters",
|
|
2473
|
+
description: "Use filters to limit the results to the CRM objects with matching property values. The filters of one group use AND"
|
|
2474
|
+
}) });
|
|
2475
|
+
const searchOptions = zod.z.object({
|
|
2476
|
+
direction: zod.z.enum(["ASCENDING", "DESCENDING"]).meta({
|
|
2477
|
+
title: "Sort Order",
|
|
2478
|
+
description: "The direction of the sort. The default is Descending",
|
|
2479
|
+
labels: {
|
|
2480
|
+
ASCENDING: "Ascending",
|
|
2481
|
+
DESCENDING: "Descending"
|
|
2482
|
+
}
|
|
2483
|
+
}),
|
|
2484
|
+
properties: propertyList("Field Names", "The properties to include in the results, such as firstname"),
|
|
2485
|
+
query: zod.z.string().meta({ description: "A text search against all property values of the object type" }),
|
|
2486
|
+
sortBy: zod.z.string().meta({
|
|
2487
|
+
title: "Sort By",
|
|
2488
|
+
description: "The internal name of the property to sort by. The default is createdate"
|
|
2489
|
+
})
|
|
2490
|
+
}).partial();
|
|
2491
|
+
const idList = (title, description) => zod.z.string().meta({
|
|
2492
|
+
title,
|
|
2493
|
+
description
|
|
2494
|
+
});
|
|
2495
|
+
const taskMetadata = zod.z.object({
|
|
2496
|
+
body: zod.z.string(),
|
|
2497
|
+
forObjectType: zod.z.enum(["COMPANY", "CONTACT"]).meta({
|
|
2498
|
+
title: "For Object Type",
|
|
2499
|
+
labels: {
|
|
2500
|
+
COMPANY: "Company",
|
|
2501
|
+
CONTACT: "Contact"
|
|
2502
|
+
}
|
|
2503
|
+
}),
|
|
2504
|
+
status: zod.z.enum([
|
|
2505
|
+
"COMPLETED",
|
|
2506
|
+
"DEFERRED",
|
|
2507
|
+
"IN_PROGRESS",
|
|
2508
|
+
"NOT_STARTED",
|
|
2509
|
+
"WAITING"
|
|
2510
|
+
]).meta({ labels: {
|
|
2511
|
+
COMPLETED: "Completed",
|
|
2512
|
+
DEFERRED: "Deferred",
|
|
2513
|
+
IN_PROGRESS: "In Progress",
|
|
2514
|
+
NOT_STARTED: "Not Started",
|
|
2515
|
+
WAITING: "Waiting"
|
|
2516
|
+
} }),
|
|
2517
|
+
subject: zod.z.string()
|
|
2518
|
+
}).partial();
|
|
2519
|
+
const emailMetadata = zod.z.object({
|
|
2520
|
+
bcc: zod.z.string().meta({
|
|
2521
|
+
title: "BCC",
|
|
2522
|
+
description: "Email addresses with commas between"
|
|
2523
|
+
}),
|
|
2524
|
+
cc: zod.z.string().meta({
|
|
2525
|
+
title: "CC",
|
|
2526
|
+
description: "Email addresses with commas between"
|
|
2527
|
+
}),
|
|
2528
|
+
fromEmail: zod.z.string().meta({ title: "From Email" }),
|
|
2529
|
+
firstName: zod.z.string().meta({ title: "From First Name" }),
|
|
2530
|
+
lastName: zod.z.string().meta({ title: "From Last Name" }),
|
|
2531
|
+
html: zod.z.string().meta({ title: "HTML" }),
|
|
2532
|
+
subject: zod.z.string(),
|
|
2533
|
+
toEmail: zod.z.string().meta({
|
|
2534
|
+
title: "To Emails",
|
|
2535
|
+
description: "Email addresses with commas between"
|
|
2536
|
+
})
|
|
2537
|
+
}).partial();
|
|
2538
|
+
const meetingMetadata = zod.z.object({
|
|
2539
|
+
body: zod.z.string(),
|
|
2540
|
+
endTime: zod.z.string().meta({
|
|
2541
|
+
title: "End Time",
|
|
2542
|
+
description: ISO_HINT
|
|
2543
|
+
}),
|
|
2544
|
+
internalMeetingNotes: zod.z.string().meta({ title: "Internal Meeting Notes" }),
|
|
2545
|
+
startTime: zod.z.string().meta({
|
|
2546
|
+
title: "Start Time",
|
|
2547
|
+
description: ISO_HINT
|
|
2548
|
+
}),
|
|
2549
|
+
title: zod.z.string()
|
|
2550
|
+
}).partial();
|
|
2551
|
+
const callMetadata = zod.z.object({
|
|
2552
|
+
body: zod.z.string(),
|
|
2553
|
+
durationMilliseconds: zod.z.number().meta({ title: "Duration Milliseconds" }),
|
|
2554
|
+
fromNumber: zod.z.string().meta({ title: "From Number" }),
|
|
2555
|
+
recordingUrl: zod.z.string().meta({ title: "Recording URL" }),
|
|
2556
|
+
status: zod.z.enum([
|
|
2557
|
+
"BUSY",
|
|
2558
|
+
"CALLING_CRM_USER",
|
|
2559
|
+
"CANCELED",
|
|
2560
|
+
"COMPLETED",
|
|
2561
|
+
"CONNECTING",
|
|
2562
|
+
"FAILED",
|
|
2563
|
+
"IN_PROGRESS",
|
|
2564
|
+
"NO_ANSWER",
|
|
2565
|
+
"QUEUED",
|
|
2566
|
+
"RINGING"
|
|
2567
|
+
]).meta({ labels: {
|
|
2568
|
+
BUSY: "Busy",
|
|
2569
|
+
CALLING_CRM_USER: "Calling CRM User",
|
|
2570
|
+
CANCELED: "Canceled",
|
|
2571
|
+
COMPLETED: "Completed",
|
|
2572
|
+
CONNECTING: "Connecting",
|
|
2573
|
+
FAILED: "Failed",
|
|
2574
|
+
IN_PROGRESS: "In Progress",
|
|
2575
|
+
NO_ANSWER: "No Answer",
|
|
2576
|
+
QUEUED: "Queued",
|
|
2577
|
+
RINGING: "Ringing"
|
|
2578
|
+
} }),
|
|
2579
|
+
toNumber: zod.z.string().meta({ title: "To Number" })
|
|
2580
|
+
}).partial();
|
|
2581
|
+
const isList = on({
|
|
2582
|
+
contact: [
|
|
2583
|
+
"getAll",
|
|
2584
|
+
"getRecentlyCreatedUpdated",
|
|
2585
|
+
"search"
|
|
2586
|
+
],
|
|
2587
|
+
company: [
|
|
2588
|
+
"getAll",
|
|
2589
|
+
"getRecentlyCreatedUpdated",
|
|
2590
|
+
"searchByDomain"
|
|
2591
|
+
],
|
|
2592
|
+
deal: [
|
|
2593
|
+
"getAll",
|
|
2594
|
+
"getRecentlyCreatedUpdated",
|
|
2595
|
+
"search"
|
|
2596
|
+
],
|
|
2597
|
+
engagement: ["getAll"],
|
|
2598
|
+
ticket: ["getAll"]
|
|
2599
|
+
});
|
|
2600
|
+
const listCondition = (resource, operations) => ({
|
|
2601
|
+
resource: [resource],
|
|
2602
|
+
operation: [...operations],
|
|
2603
|
+
returnAll: [false]
|
|
2604
|
+
});
|
|
2605
|
+
const hubspotConfig = zod.z.object({
|
|
2606
|
+
authentication: zod.z.enum(AUTHENTICATIONS).default("appToken").meta({
|
|
2607
|
+
labels: {
|
|
2608
|
+
appToken: "Service Key",
|
|
2609
|
+
oAuth2: "OAuth2"
|
|
2610
|
+
},
|
|
2611
|
+
hints: {
|
|
2612
|
+
appToken: "A service key (private app token) of your HubSpot account",
|
|
2613
|
+
oAuth2: "Sign in with a HubSpot account"
|
|
2614
|
+
}
|
|
2615
|
+
}),
|
|
2616
|
+
resource: zod.z.enum(RESOURCES).default("contact").meta({ labels: {
|
|
2617
|
+
company: "Company",
|
|
2618
|
+
contact: "Contact",
|
|
2619
|
+
contactList: "Contact List",
|
|
2620
|
+
deal: "Deal",
|
|
2621
|
+
engagement: "Engagement",
|
|
2622
|
+
ticket: "Ticket"
|
|
2623
|
+
} }),
|
|
2624
|
+
operation: zod.z.enum(ALL_OPERATIONS).default("upsert").meta({
|
|
2625
|
+
labels: {
|
|
2626
|
+
add: "Add",
|
|
2627
|
+
create: "Create",
|
|
2628
|
+
delete: "Delete",
|
|
2629
|
+
get: "Get",
|
|
2630
|
+
getAll: "Get Many",
|
|
2631
|
+
getRecentlyCreatedUpdated: "Get Recently Created/Updated",
|
|
2632
|
+
remove: "Remove",
|
|
2633
|
+
search: "Search",
|
|
2634
|
+
searchByDomain: "Search",
|
|
2635
|
+
update: "Update",
|
|
2636
|
+
upsert: "Create or Update"
|
|
2637
|
+
},
|
|
2638
|
+
hints: {
|
|
2639
|
+
add: "Add a contact to a list",
|
|
2640
|
+
create: "Create an object",
|
|
2641
|
+
delete: "Delete an object",
|
|
2642
|
+
get: "Get an object",
|
|
2643
|
+
getAll: "Get many objects",
|
|
2644
|
+
getRecentlyCreatedUpdated: "Get recently created or updated objects",
|
|
2645
|
+
remove: "Remove a contact from a list",
|
|
2646
|
+
search: "Search objects",
|
|
2647
|
+
searchByDomain: "Search companies by their website domain",
|
|
2648
|
+
update: "Update an object",
|
|
2649
|
+
upsert: "Create a contact, or update the contact if it exists"
|
|
2650
|
+
}
|
|
2651
|
+
}),
|
|
2652
|
+
email: zod.z.string().optional().meta({
|
|
2653
|
+
showWhen: [{
|
|
2654
|
+
resource: ["contact"],
|
|
2655
|
+
operation: ["upsert"]
|
|
2656
|
+
}, {
|
|
2657
|
+
resource: ["contactList"],
|
|
2658
|
+
operation: ["add"],
|
|
2659
|
+
by: ["email"]
|
|
2660
|
+
}],
|
|
2661
|
+
description: "The email address of the contact"
|
|
2662
|
+
}),
|
|
2663
|
+
contactFields: collectionOf(CONTACT_FIELDS, {
|
|
2664
|
+
associatedCompanyId: zod.z.string().meta({
|
|
2665
|
+
title: "Associated Company ID",
|
|
2666
|
+
description: "The ID of a company to link to the contact"
|
|
2667
|
+
}),
|
|
2668
|
+
properties: propertyList("Contact Properties to Include", "The properties to include in the result. Used when Simplify Output is off"),
|
|
2669
|
+
customProperties
|
|
2670
|
+
}).default({}).meta({
|
|
2671
|
+
...on({ contact: ["upsert"] }),
|
|
2672
|
+
title: "Contact Properties"
|
|
2673
|
+
}),
|
|
2674
|
+
upsertOptions: zod.z.object({ resolveData: zod.z.boolean().meta({
|
|
2675
|
+
title: "Simplify Output",
|
|
2676
|
+
description: "On: the result is the answer of the update. Off: the node gets the full profile of the contact"
|
|
2677
|
+
}) }).partial().default({}).meta({
|
|
2678
|
+
...on({ contact: ["upsert"] }),
|
|
2679
|
+
title: "Options"
|
|
2680
|
+
}),
|
|
2681
|
+
contactId: zod.z.string().optional().meta({
|
|
2682
|
+
...on({ contact: ["delete", "get"] }),
|
|
2683
|
+
title: "Contact ID",
|
|
2684
|
+
description: "The ID of the contact. This is not the email, but a number such as 1485"
|
|
2685
|
+
}),
|
|
2686
|
+
contactOptions: zod.z.object({
|
|
2687
|
+
formSubmissionMode: zod.z.enum([
|
|
2688
|
+
"all",
|
|
2689
|
+
"none",
|
|
2690
|
+
"newest",
|
|
2691
|
+
"oldest"
|
|
2692
|
+
]).meta({
|
|
2693
|
+
title: "Form Submission Mode",
|
|
2694
|
+
description: "Which form submissions to get",
|
|
2695
|
+
labels: {
|
|
2696
|
+
all: "All",
|
|
2697
|
+
none: "None",
|
|
2698
|
+
newest: "Newest",
|
|
2699
|
+
oldest: "Oldest"
|
|
2700
|
+
}
|
|
2701
|
+
}),
|
|
2702
|
+
listMemberships: zod.z.boolean().meta({
|
|
2703
|
+
title: "Include List Memberships",
|
|
2704
|
+
description: "Get the current list memberships of the contact"
|
|
2705
|
+
}),
|
|
2706
|
+
properties: propertyList("Contact Properties to Include", "The properties to include in the results. By default the results have only the contact ID"),
|
|
2707
|
+
propertyMode
|
|
2708
|
+
}).partial().default({}).meta({
|
|
2709
|
+
...on({ contact: [
|
|
2710
|
+
"get",
|
|
2711
|
+
"getAll",
|
|
2712
|
+
"getRecentlyCreatedUpdated"
|
|
2713
|
+
] }),
|
|
2714
|
+
title: "Options"
|
|
2715
|
+
}),
|
|
2716
|
+
filterGroups: zod.z.array(filterGroup).default([]).meta({
|
|
2717
|
+
...on({
|
|
2718
|
+
contact: ["search"],
|
|
2719
|
+
deal: ["search"]
|
|
2720
|
+
}),
|
|
2721
|
+
title: "Filter Groups",
|
|
2722
|
+
description: "Groups combine with OR. HubSpot allows 3 groups at most. The filters of one group combine with AND"
|
|
2723
|
+
}),
|
|
2724
|
+
searchOptions: searchOptions.default({}).meta({
|
|
2725
|
+
...on({
|
|
2726
|
+
contact: ["search"],
|
|
2727
|
+
deal: ["search"]
|
|
2728
|
+
}),
|
|
2729
|
+
title: "Options"
|
|
2730
|
+
}),
|
|
2731
|
+
by: zod.z.enum(["id", "email"]).default("email").meta({
|
|
2732
|
+
showWhen: {
|
|
2733
|
+
resource: ["contactList"],
|
|
2734
|
+
operation: ["add"]
|
|
2735
|
+
},
|
|
2736
|
+
title: "By",
|
|
2737
|
+
labels: {
|
|
2738
|
+
id: "Contact ID",
|
|
2739
|
+
email: "Email"
|
|
2740
|
+
}
|
|
2741
|
+
}),
|
|
2742
|
+
id: zod.z.number().optional().meta({
|
|
2743
|
+
showWhen: [{
|
|
2744
|
+
resource: ["contactList"],
|
|
2745
|
+
operation: ["add"],
|
|
2746
|
+
by: ["id"]
|
|
2747
|
+
}, {
|
|
2748
|
+
resource: ["contactList"],
|
|
2749
|
+
operation: ["remove"]
|
|
2750
|
+
}],
|
|
2751
|
+
title: "Contact ID",
|
|
2752
|
+
description: "The ID of the contact to add or to remove"
|
|
2753
|
+
}),
|
|
2754
|
+
listId: zod.z.number().optional().meta({
|
|
2755
|
+
...on({ contactList: ["add", "remove"] }),
|
|
2756
|
+
title: "List ID",
|
|
2757
|
+
description: "The ID of the list, as HubSpot shows it (the ILS list ID). HubSpot allows only static lists"
|
|
2758
|
+
}),
|
|
2759
|
+
name: zod.z.string().optional().meta({ showWhen: {
|
|
2760
|
+
resource: ["company"],
|
|
2761
|
+
operation: ["create"]
|
|
2762
|
+
} }),
|
|
2763
|
+
companyFields: collectionOf(COMPANY_CREATE_FIELDS, { customProperties }).default({}).meta({
|
|
2764
|
+
...on({ company: ["create"] }),
|
|
2765
|
+
title: "Company Properties"
|
|
2766
|
+
}),
|
|
2767
|
+
companyId: zod.z.string().optional().meta({
|
|
2768
|
+
...on({ company: [
|
|
2769
|
+
"delete",
|
|
2770
|
+
"get",
|
|
2771
|
+
"update"
|
|
2772
|
+
] }),
|
|
2773
|
+
title: "Company ID"
|
|
2774
|
+
}),
|
|
2775
|
+
companyUpdateFields: collectionOf(COMPANY_UPDATE_FIELDS, { customProperties }).default({}).meta({
|
|
2776
|
+
...on({ company: ["update"] }),
|
|
2777
|
+
title: "Update Fields"
|
|
2778
|
+
}),
|
|
2779
|
+
companyGetOptions: zod.z.object({ includeMergeAudits: zod.z.boolean().meta({
|
|
2780
|
+
title: "Include Merge Audits",
|
|
2781
|
+
description: "Get the merge history if the company merged with another company record"
|
|
2782
|
+
}) }).partial().default({}).meta({
|
|
2783
|
+
...on({ company: ["get"] }),
|
|
2784
|
+
title: "Options"
|
|
2785
|
+
}),
|
|
2786
|
+
companyListOptions: zod.z.object({
|
|
2787
|
+
includeMergeAudits: zod.z.boolean().meta({
|
|
2788
|
+
title: "Include Merge Audits",
|
|
2789
|
+
description: "Get the merge history if a company merged with another company record"
|
|
2790
|
+
}),
|
|
2791
|
+
properties: propertyList("Companies Properties to Include", "The properties to include in the results"),
|
|
2792
|
+
propertyMode
|
|
2793
|
+
}).partial().default({}).meta({
|
|
2794
|
+
...on({ company: ["getAll"] }),
|
|
2795
|
+
title: "Options"
|
|
2796
|
+
}),
|
|
2797
|
+
companyRecentOptions: zod.z.object({
|
|
2798
|
+
since: sinceField.meta({ description: `Only companies created or updated after this time. ${ISO_HINT}` }),
|
|
2799
|
+
properties: propertyList("Companies Properties to Include", "The properties to include in the results"),
|
|
2800
|
+
propertyMode
|
|
2801
|
+
}).partial().default({}).meta({
|
|
2802
|
+
...on({ company: ["getRecentlyCreatedUpdated"] }),
|
|
2803
|
+
title: "Options"
|
|
2804
|
+
}),
|
|
2805
|
+
domain: zod.z.string().optional().meta({
|
|
2806
|
+
showWhen: {
|
|
2807
|
+
resource: ["company"],
|
|
2808
|
+
operation: ["searchByDomain"]
|
|
2809
|
+
},
|
|
2810
|
+
description: "The website domain of the company, such as example.com"
|
|
2811
|
+
}),
|
|
2812
|
+
domainOptions: zod.z.object({ properties: propertyList("Company Properties to Include", "The properties to include in the results") }).partial().default({}).meta({
|
|
2813
|
+
...on({ company: ["searchByDomain"] }),
|
|
2814
|
+
title: "Options"
|
|
2815
|
+
}),
|
|
2816
|
+
stage: zod.z.string().optional().meta({
|
|
2817
|
+
showWhen: {
|
|
2818
|
+
resource: ["deal"],
|
|
2819
|
+
operation: ["create"]
|
|
2820
|
+
},
|
|
2821
|
+
title: "Deal Stage",
|
|
2822
|
+
description: "The ID of the deal stage. The deal needs a stage. See the CRM Pipelines API for stages"
|
|
2823
|
+
}),
|
|
2824
|
+
dealFields: collectionOf(DEAL_CREATE_FIELDS, {
|
|
2825
|
+
associatedCompany: idList("Associated Company IDs", "IDs of companies to link to the deal, with commas between"),
|
|
2826
|
+
associatedVids: idList("Associated Contact IDs", "IDs of contacts to link to the deal, with commas between"),
|
|
2827
|
+
customProperties
|
|
2828
|
+
}).default({}).meta({
|
|
2829
|
+
...on({ deal: ["create"] }),
|
|
2830
|
+
title: "Deal Properties"
|
|
2831
|
+
}),
|
|
2832
|
+
dealId: zod.z.string().optional().meta({
|
|
2833
|
+
...on({ deal: [
|
|
2834
|
+
"delete",
|
|
2835
|
+
"get",
|
|
2836
|
+
"update"
|
|
2837
|
+
] }),
|
|
2838
|
+
title: "Deal ID"
|
|
2839
|
+
}),
|
|
2840
|
+
dealUpdateFields: collectionOf(DEAL_UPDATE_FIELDS, { customProperties }).default({}).meta({
|
|
2841
|
+
...on({ deal: ["update"] }),
|
|
2842
|
+
title: "Update Fields"
|
|
2843
|
+
}),
|
|
2844
|
+
dealGetOptions: zod.z.object({
|
|
2845
|
+
includePropertyVersions: zod.z.boolean().meta({
|
|
2846
|
+
title: "Include Property Versions",
|
|
2847
|
+
description: "By default you get only the latest version of a property. On: you get all old versions too"
|
|
2848
|
+
}),
|
|
2849
|
+
properties: propertyList("Deal Properties to Include", "The properties to include in the results. By default the results have only the deal ID"),
|
|
2850
|
+
propertyMode
|
|
2851
|
+
}).partial().default({}).meta({
|
|
2852
|
+
...on({ deal: ["get"] }),
|
|
2853
|
+
title: "Filters"
|
|
2854
|
+
}),
|
|
2855
|
+
dealListOptions: zod.z.object({
|
|
2856
|
+
includeAssociations: zod.z.boolean().meta({
|
|
2857
|
+
title: "Include Associations",
|
|
2858
|
+
description: "Include the IDs of the associated contacts and companies in the results. This also adds the num_associated_contacts property"
|
|
2859
|
+
}),
|
|
2860
|
+
properties: propertyList("Deal Properties to Include", "The properties to include in the results. By default the results have only the deal ID"),
|
|
2861
|
+
propertiesWithHistory: propertyList("Deal Properties with History to Include", "Works as Properties, but the results have the history of each property")
|
|
2862
|
+
}).partial().default({}).meta({
|
|
2863
|
+
...on({ deal: ["getAll"] }),
|
|
2864
|
+
title: "Options"
|
|
2865
|
+
}),
|
|
2866
|
+
dealRecentOptions: zod.z.object({
|
|
2867
|
+
since: sinceField.meta({ description: `Only deals created after this time. ${ISO_HINT}` }),
|
|
2868
|
+
includePropertyVersions: zod.z.boolean().meta({
|
|
2869
|
+
title: "Include Property Versions",
|
|
2870
|
+
description: "By default you get only the latest version of a property. On: you get all old versions too"
|
|
2871
|
+
})
|
|
2872
|
+
}).partial().default({}).meta({
|
|
2873
|
+
...on({ deal: ["getRecentlyCreatedUpdated"] }),
|
|
2874
|
+
title: "Options"
|
|
2875
|
+
}),
|
|
2876
|
+
type: zod.z.enum(ENGAGEMENT_TYPES).optional().meta({
|
|
2877
|
+
...on({ engagement: [
|
|
2878
|
+
"create",
|
|
2879
|
+
"delete",
|
|
2880
|
+
"get",
|
|
2881
|
+
"getAll"
|
|
2882
|
+
] }),
|
|
2883
|
+
description: "The type of the engagement. The CRM API keeps each type in its own object, so every operation needs it",
|
|
2884
|
+
labels: {
|
|
2885
|
+
call: "Call",
|
|
2886
|
+
email: "Email",
|
|
2887
|
+
meeting: "Meeting",
|
|
2888
|
+
task: "Task"
|
|
2889
|
+
}
|
|
2890
|
+
}),
|
|
2891
|
+
dueDate: zod.z.string().optional().meta({
|
|
2892
|
+
showWhen: {
|
|
2893
|
+
resource: ["engagement"],
|
|
2894
|
+
operation: ["create"],
|
|
2895
|
+
type: ["task"]
|
|
2896
|
+
},
|
|
2897
|
+
description: `The due date of the task. ${ISO_HINT}`
|
|
2898
|
+
}),
|
|
2899
|
+
taskMetadata: taskMetadata.default({}).meta({
|
|
2900
|
+
showWhen: {
|
|
2901
|
+
resource: ["engagement"],
|
|
2902
|
+
operation: ["create"],
|
|
2903
|
+
type: ["task"]
|
|
2904
|
+
},
|
|
2905
|
+
title: "Metadata"
|
|
2906
|
+
}),
|
|
2907
|
+
emailMetadata: emailMetadata.default({}).meta({
|
|
2908
|
+
showWhen: {
|
|
2909
|
+
resource: ["engagement"],
|
|
2910
|
+
operation: ["create"],
|
|
2911
|
+
type: ["email"]
|
|
2912
|
+
},
|
|
2913
|
+
title: "Metadata"
|
|
2914
|
+
}),
|
|
2915
|
+
meetingMetadata: meetingMetadata.default({}).meta({
|
|
2916
|
+
showWhen: {
|
|
2917
|
+
resource: ["engagement"],
|
|
2918
|
+
operation: ["create"],
|
|
2919
|
+
type: ["meeting"]
|
|
2920
|
+
},
|
|
2921
|
+
title: "Metadata"
|
|
2922
|
+
}),
|
|
2923
|
+
callMetadata: callMetadata.default({}).meta({
|
|
2924
|
+
showWhen: {
|
|
2925
|
+
resource: ["engagement"],
|
|
2926
|
+
operation: ["create"],
|
|
2927
|
+
type: ["call"]
|
|
2928
|
+
},
|
|
2929
|
+
title: "Metadata"
|
|
2930
|
+
}),
|
|
2931
|
+
associations: zod.z.object({
|
|
2932
|
+
companyIds: zod.z.string().meta({
|
|
2933
|
+
title: "Company IDs",
|
|
2934
|
+
description: "IDs with commas between"
|
|
2935
|
+
}),
|
|
2936
|
+
contactIds: zod.z.string().meta({
|
|
2937
|
+
title: "Contact IDs",
|
|
2938
|
+
description: "IDs with commas between"
|
|
2939
|
+
}),
|
|
2940
|
+
dealIds: zod.z.string().meta({
|
|
2941
|
+
title: "Deals IDs",
|
|
2942
|
+
description: "IDs with commas between"
|
|
2943
|
+
}),
|
|
2944
|
+
ownerId: zod.z.number().meta({ title: "Owner ID" }),
|
|
2945
|
+
ticketIds: zod.z.string().meta({
|
|
2946
|
+
title: "Ticket IDs",
|
|
2947
|
+
description: "IDs with commas between"
|
|
2948
|
+
})
|
|
2949
|
+
}).partial().default({}).meta({
|
|
2950
|
+
showWhen: {
|
|
2951
|
+
resource: ["engagement"],
|
|
2952
|
+
operation: ["create"]
|
|
2953
|
+
},
|
|
2954
|
+
title: "Engagement Properties: Associations"
|
|
2955
|
+
}),
|
|
2956
|
+
engagementId: zod.z.string().optional().meta({
|
|
2957
|
+
...on({ engagement: ["delete", "get"] }),
|
|
2958
|
+
title: "Engagement ID"
|
|
2959
|
+
}),
|
|
2960
|
+
pipelineId: zod.z.string().optional().meta({
|
|
2961
|
+
showWhen: {
|
|
2962
|
+
resource: ["ticket"],
|
|
2963
|
+
operation: ["create"]
|
|
2964
|
+
},
|
|
2965
|
+
title: "Pipeline ID",
|
|
2966
|
+
description: "The ID of the pipeline of the ticket"
|
|
2967
|
+
}),
|
|
2968
|
+
stageId: zod.z.string().optional().meta({
|
|
2969
|
+
showWhen: {
|
|
2970
|
+
resource: ["ticket"],
|
|
2971
|
+
operation: ["create"]
|
|
2972
|
+
},
|
|
2973
|
+
title: "Stage ID",
|
|
2974
|
+
description: "The ID of the stage in the pipeline of the ticket"
|
|
2975
|
+
}),
|
|
2976
|
+
ticketName: zod.z.string().optional().meta({ showWhen: {
|
|
2977
|
+
resource: ["ticket"],
|
|
2978
|
+
operation: ["create"]
|
|
2979
|
+
} }),
|
|
2980
|
+
ticketFields: collectionOf(TICKET_CREATE_FIELDS, {
|
|
2981
|
+
associatedCompanyIds: idList("Company IDs", "IDs of companies to link to the ticket, with commas between"),
|
|
2982
|
+
associatedContactIds: idList("Contact IDs", "IDs of contacts to link to the ticket, with commas between")
|
|
2983
|
+
}).default({}).meta({
|
|
2984
|
+
...on({ ticket: ["create"] }),
|
|
2985
|
+
title: "Ticket Properties"
|
|
2986
|
+
}),
|
|
2987
|
+
ticketId: zod.z.string().optional().meta({
|
|
2988
|
+
...on({ ticket: [
|
|
2989
|
+
"delete",
|
|
2990
|
+
"get",
|
|
2991
|
+
"update"
|
|
2992
|
+
] }),
|
|
2993
|
+
title: "Ticket ID"
|
|
2994
|
+
}),
|
|
2995
|
+
ticketUpdateFields: collectionOf(TICKET_UPDATE_FIELDS, {
|
|
2996
|
+
associatedCompanyIds: idList("Company IDs", "IDs of companies to link to the ticket, with commas between"),
|
|
2997
|
+
associatedContactIds: idList("Contact IDs", "IDs of contacts to link to the ticket, with commas between")
|
|
2998
|
+
}).default({}).meta({
|
|
2999
|
+
...on({ ticket: ["update"] }),
|
|
3000
|
+
title: "Update Fields"
|
|
3001
|
+
}),
|
|
3002
|
+
ticketGetOptions: zod.z.object({
|
|
3003
|
+
includeDeleted: zod.z.boolean().meta({ title: "Include Deleted" }),
|
|
3004
|
+
properties: propertyList("Ticket Properties to Include", "The properties to include in the results"),
|
|
3005
|
+
propertiesWithHistory: propertyList("Properties With History", "Works as Properties, but the results have the history of each property")
|
|
3006
|
+
}).partial().default({}).meta({
|
|
3007
|
+
...on({ ticket: ["get"] }),
|
|
3008
|
+
title: "Options"
|
|
3009
|
+
}),
|
|
3010
|
+
ticketListOptions: zod.z.object({
|
|
3011
|
+
properties: propertyList("Ticket Properties to Include", "The properties to include in the results"),
|
|
3012
|
+
propertiesWithHistory: propertyList("Properties With History", "Works as Properties, but the results have the history of each property")
|
|
3013
|
+
}).partial().default({}).meta({
|
|
3014
|
+
...on({ ticket: ["getAll"] }),
|
|
3015
|
+
title: "Options"
|
|
3016
|
+
}),
|
|
3017
|
+
returnAll: zod.z.boolean().default(false).meta(isList),
|
|
3018
|
+
limit: zod.z.number().int().min(1).max(5e3).default(100).meta({
|
|
3019
|
+
showWhen: [
|
|
3020
|
+
listCondition("contact", [
|
|
3021
|
+
"getAll",
|
|
3022
|
+
"getRecentlyCreatedUpdated",
|
|
3023
|
+
"search"
|
|
3024
|
+
]),
|
|
3025
|
+
listCondition("company", [
|
|
3026
|
+
"getAll",
|
|
3027
|
+
"getRecentlyCreatedUpdated",
|
|
3028
|
+
"searchByDomain"
|
|
3029
|
+
]),
|
|
3030
|
+
listCondition("deal", [
|
|
3031
|
+
"getAll",
|
|
3032
|
+
"getRecentlyCreatedUpdated",
|
|
3033
|
+
"search"
|
|
3034
|
+
]),
|
|
3035
|
+
listCondition("engagement", ["getAll"]),
|
|
3036
|
+
listCondition("ticket", ["getAll"])
|
|
3037
|
+
],
|
|
3038
|
+
description: "Max number of results to return"
|
|
3039
|
+
}),
|
|
3040
|
+
timeoutMs: zod.z.number().int().min(1).max(3e5).default(3e4)
|
|
3041
|
+
}).superRefine((config, context) => {
|
|
3042
|
+
if (!OPERATIONS_OF[config.resource].includes(config.operation)) context.addIssue({
|
|
3043
|
+
code: "custom",
|
|
3044
|
+
path: ["operation"],
|
|
3045
|
+
message: `"${config.operation}" is not an operation of "${config.resource}"`
|
|
3046
|
+
});
|
|
3047
|
+
});
|
|
3048
|
+
// src/request.ts
|
|
3049
|
+
/** The object type IDs of the CRM. The associations API takes them. */
|
|
3050
|
+
const OBJECT_TYPE_ID = {
|
|
3051
|
+
contact: "0-1",
|
|
3052
|
+
company: "0-2",
|
|
3053
|
+
deal: "0-3",
|
|
3054
|
+
ticket: "0-5",
|
|
3055
|
+
call: "0-48",
|
|
3056
|
+
email: "0-49",
|
|
3057
|
+
meeting: "0-47",
|
|
3058
|
+
task: "0-27"
|
|
3059
|
+
};
|
|
3060
|
+
/** The path word of each object type in `/crm/v3/objects/{word}`. */
|
|
3061
|
+
const PLURAL = {
|
|
3062
|
+
contact: "contacts",
|
|
3063
|
+
company: "companies",
|
|
3064
|
+
deal: "deals",
|
|
3065
|
+
ticket: "tickets",
|
|
3066
|
+
call: "calls",
|
|
3067
|
+
email: "emails",
|
|
3068
|
+
meeting: "meetings",
|
|
3069
|
+
task: "tasks"
|
|
3070
|
+
};
|
|
3071
|
+
const enc = encodeURIComponent;
|
|
3072
|
+
const isSet = (value) => value !== void 0 && value !== null && value !== "";
|
|
3073
|
+
/** A date text as milliseconds since 1970. */
|
|
3074
|
+
function toMs(value) {
|
|
3075
|
+
const time = new Date(String(value)).getTime();
|
|
3076
|
+
if (Number.isNaN(time)) throw new Error(`"${String(value)}" is not a valid date`);
|
|
3077
|
+
return time;
|
|
3078
|
+
}
|
|
3079
|
+
/** The value of a field as HubSpot wants it. */
|
|
3080
|
+
function fieldValue(spec, value) {
|
|
3081
|
+
switch (spec.kind) {
|
|
3082
|
+
case "dateMs": return String(toMs(value));
|
|
3083
|
+
case "multi": return Array.isArray(value) ? value.join(";") : String(value);
|
|
3084
|
+
default: return String(value);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
/** The properties object of the CRM API. HubSpot wants text values. */
|
|
3088
|
+
function propertyMap(specs, values, first = {}) {
|
|
3089
|
+
const map = {};
|
|
3090
|
+
for (const [prop, value] of Object.entries(first)) if (isSet(value)) map[prop] = String(value);
|
|
3091
|
+
for (const spec of specs) {
|
|
3092
|
+
const value = values[spec.key];
|
|
3093
|
+
if (isSet(value)) map[spec.prop] = fieldValue(spec, value);
|
|
3094
|
+
}
|
|
3095
|
+
const custom = values.customProperties;
|
|
3096
|
+
if (typeof custom === "object" && custom !== null) for (const [key, value] of Object.entries(custom)) map[key] = String(value);
|
|
3097
|
+
return map;
|
|
3098
|
+
}
|
|
3099
|
+
/** IDs with commas between as numbers. */
|
|
3100
|
+
function idsOf(text, label = "ID") {
|
|
3101
|
+
if (Array.isArray(text)) return text.flatMap((item) => idsOf(item, label));
|
|
3102
|
+
if (typeof text === "number") {
|
|
3103
|
+
if (!Number.isInteger(text) || text < 0) throw new Error(`"${text}" is not a valid ${label}`);
|
|
3104
|
+
return [text];
|
|
3105
|
+
}
|
|
3106
|
+
if (typeof text !== "string") return [];
|
|
3107
|
+
return text.split(",").map((item) => item.trim()).filter(Boolean).map((item) => {
|
|
3108
|
+
if (!/^\d+$/.test(item)) throw new Error(`"${item}" is not a valid ${label}`);
|
|
3109
|
+
return Number(item);
|
|
3110
|
+
});
|
|
3111
|
+
}
|
|
3112
|
+
/** One numeric ID. */
|
|
3113
|
+
function oneId(value, label) {
|
|
3114
|
+
const ids = idsOf(value, label);
|
|
3115
|
+
if (ids.length !== 1 || ids[0] === void 0) throw new Error(`The field "${label}" needs one ID`);
|
|
3116
|
+
return ids[0];
|
|
3117
|
+
}
|
|
3118
|
+
const need = (value, label) => {
|
|
3119
|
+
if (typeof value === "number") return String(value);
|
|
3120
|
+
if (typeof value !== "string" || value.trim() === "") throw new Error(`The field "${label}" is empty`);
|
|
3121
|
+
return value.trim();
|
|
3122
|
+
};
|
|
3123
|
+
const asValues = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
3124
|
+
const strings = (value) => Array.isArray(value) && value.length > 0 ? value.map(String) : void 0;
|
|
3125
|
+
/**
|
|
3126
|
+
* The property query of the object APIs. A property mode of "value and history" also asks for the
|
|
3127
|
+
* history of the same properties. `withHistory` is true when the user asks for versions.
|
|
3128
|
+
*/
|
|
3129
|
+
function propertyQuery(options, withHistory = false) {
|
|
3130
|
+
const query = {};
|
|
3131
|
+
const properties = strings(options.properties);
|
|
3132
|
+
if (properties) {
|
|
3133
|
+
query.properties = properties.join(",");
|
|
3134
|
+
const history = strings(options.propertiesWithHistory);
|
|
3135
|
+
if (history) query.propertiesWithHistory = history.join(",");
|
|
3136
|
+
else if (withHistory || options.propertyMode === "valueAndHistory") query.propertiesWithHistory = properties.join(",");
|
|
3137
|
+
} else {
|
|
3138
|
+
const history = strings(options.propertiesWithHistory);
|
|
3139
|
+
if (history) query.propertiesWithHistory = history.join(",");
|
|
3140
|
+
}
|
|
3141
|
+
return query;
|
|
3142
|
+
}
|
|
3143
|
+
/** A search body for the CRM search API. At most 3 filter groups. */
|
|
3144
|
+
function searchBody(config) {
|
|
3145
|
+
const options = asValues(config.searchOptions);
|
|
3146
|
+
const body = { sorts: [{
|
|
3147
|
+
propertyName: isSet(options.sortBy) ? options.sortBy : "createdate",
|
|
3148
|
+
direction: isSet(options.direction) ? options.direction : "DESCENDING"
|
|
3149
|
+
}] };
|
|
3150
|
+
const groups = config.filterGroups.filter((group) => group.filters.length > 0);
|
|
3151
|
+
if (groups.length > 3) throw new Error("You can only have 3 filter groups");
|
|
3152
|
+
if (groups.length > 0) body.filterGroups = groups.map((group) => ({ filters: group.filters.map((filter) => {
|
|
3153
|
+
const needsValue = filter.operator !== "HAS_PROPERTY" && filter.operator !== "NOT_HAS_PROPERTY";
|
|
3154
|
+
return {
|
|
3155
|
+
propertyName: filter.propertyName,
|
|
3156
|
+
operator: filter.operator,
|
|
3157
|
+
...needsValue ? { value: filter.value ?? "" } : {}
|
|
3158
|
+
};
|
|
3159
|
+
}) }));
|
|
3160
|
+
const properties = strings(options.properties);
|
|
3161
|
+
if (properties) body.properties = properties;
|
|
3162
|
+
if (isSet(options.query)) body.query = options.query;
|
|
3163
|
+
return body;
|
|
3164
|
+
}
|
|
3165
|
+
/** The search API gives at most 10000 results for one search. */
|
|
3166
|
+
const SEARCH_MAX_RESULTS = 1e4;
|
|
3167
|
+
/** A list of the CRM API: `limit` (at most 100) and `after`. */
|
|
3168
|
+
const pagedList = (place, pageMax = 100, maxResults) => ({
|
|
3169
|
+
itemsKey: "results",
|
|
3170
|
+
sizeParam: "limit",
|
|
3171
|
+
pageMax,
|
|
3172
|
+
...maxResults === void 0 ? {} : { maxResults },
|
|
3173
|
+
place,
|
|
3174
|
+
cursors: [{
|
|
3175
|
+
param: "after",
|
|
3176
|
+
from: "paging.next.after"
|
|
3177
|
+
}],
|
|
3178
|
+
more: "paging"
|
|
3179
|
+
});
|
|
3180
|
+
/** The call of the default association between two records. */
|
|
3181
|
+
function associationCall(from, fromId, to, toId) {
|
|
3182
|
+
return {
|
|
3183
|
+
method: "PUT",
|
|
3184
|
+
path: `/crm/v4/objects/${OBJECT_TYPE_ID[from]}/${enc(String(fromId))}/associations/default/${OBJECT_TYPE_ID[to]}/${toId}`
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
/** The calls of the links of a built request, for the ID of the new record. */
|
|
3188
|
+
function linkCalls(from, fromId, links) {
|
|
3189
|
+
return links.flatMap((link) => link.ids.map((id) => associationCall(from, fromId, link.to, id)));
|
|
3190
|
+
}
|
|
3191
|
+
/** The call for the full record of a contact. */
|
|
3192
|
+
function contactReadCall(id, properties) {
|
|
3193
|
+
return {
|
|
3194
|
+
method: "GET",
|
|
3195
|
+
path: `/crm/v3/objects/contacts/${enc(String(id))}`,
|
|
3196
|
+
query: properties ? { properties: properties.join(",") } : void 0
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
/** The call that finds a contact by its email address. */
|
|
3200
|
+
function contactLookupCall(email) {
|
|
3201
|
+
return {
|
|
3202
|
+
method: "GET",
|
|
3203
|
+
path: `/crm/v3/objects/contacts/${enc(email)}`,
|
|
3204
|
+
query: { idProperty: "email" }
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3207
|
+
/** The call that adds records to a list, or removes them. The records must be in a static list. */
|
|
3208
|
+
function membershipCall(listId, action, ids) {
|
|
3209
|
+
return {
|
|
3210
|
+
method: "PUT",
|
|
3211
|
+
path: `/crm/v3/lists/${listId}/memberships/${action}`,
|
|
3212
|
+
body: ids.map(String)
|
|
3213
|
+
};
|
|
3214
|
+
}
|
|
3215
|
+
const emails = (text) => typeof text === "string" ? text.split(",").map((item) => item.trim()).filter(Boolean).map((email) => ({ email })) : [];
|
|
3216
|
+
const ACTIVITY_TYPES = [
|
|
3217
|
+
"call",
|
|
3218
|
+
"email",
|
|
3219
|
+
"meeting",
|
|
3220
|
+
"task"
|
|
3221
|
+
];
|
|
3222
|
+
const activityType = (value) => {
|
|
3223
|
+
const type = need(value, "type");
|
|
3224
|
+
if (!ACTIVITY_TYPES.includes(type)) throw new Error(`"${type}" is not an engagement type`);
|
|
3225
|
+
return type;
|
|
3226
|
+
};
|
|
3227
|
+
const setIf = (target, prop, value) => {
|
|
3228
|
+
if (isSet(value)) target[prop] = String(value);
|
|
3229
|
+
};
|
|
3230
|
+
/** The properties of an engagement, by type. `now` gives the time of a call or an email. */
|
|
3231
|
+
function engagementProperties(type, config, now) {
|
|
3232
|
+
const props = {};
|
|
3233
|
+
if (type === "email") {
|
|
3234
|
+
const meta = asValues(config.emailMetadata);
|
|
3235
|
+
props.hs_timestamp = now.toISOString();
|
|
3236
|
+
props.hs_email_direction = "EMAIL";
|
|
3237
|
+
setIf(props, "hs_email_subject", meta.subject);
|
|
3238
|
+
setIf(props, "hs_email_html", meta.html);
|
|
3239
|
+
const from = {};
|
|
3240
|
+
if (isSet(meta.fromEmail)) from.email = meta.fromEmail;
|
|
3241
|
+
if (isSet(meta.firstName)) from.firstName = meta.firstName;
|
|
3242
|
+
if (isSet(meta.lastName)) from.lastName = meta.lastName;
|
|
3243
|
+
const to = emails(meta.toEmail);
|
|
3244
|
+
const cc = emails(meta.cc);
|
|
3245
|
+
const bcc = emails(meta.bcc);
|
|
3246
|
+
if (Object.keys(from).length > 0 || to.length > 0 || cc.length > 0 || bcc.length > 0) props.hs_email_headers = JSON.stringify({
|
|
3247
|
+
from,
|
|
3248
|
+
to,
|
|
3249
|
+
cc,
|
|
3250
|
+
bcc
|
|
3251
|
+
});
|
|
3252
|
+
} else if (type === "task") {
|
|
3253
|
+
const meta = asValues(config.taskMetadata);
|
|
3254
|
+
props.hs_timestamp = isSet(config.dueDate) ? String(toMs(config.dueDate)) : now.toISOString();
|
|
3255
|
+
setIf(props, "hs_task_subject", meta.subject);
|
|
3256
|
+
setIf(props, "hs_task_body", meta.body);
|
|
3257
|
+
setIf(props, "hs_task_status", meta.status);
|
|
3258
|
+
} else if (type === "meeting") {
|
|
3259
|
+
const meta = asValues(config.meetingMetadata);
|
|
3260
|
+
const start = isSet(meta.startTime) ? String(toMs(meta.startTime)) : void 0;
|
|
3261
|
+
props.hs_timestamp = start ?? now.toISOString();
|
|
3262
|
+
if (start) props.hs_meeting_start_time = start;
|
|
3263
|
+
if (isSet(meta.endTime)) props.hs_meeting_end_time = String(toMs(meta.endTime));
|
|
3264
|
+
setIf(props, "hs_meeting_title", meta.title);
|
|
3265
|
+
setIf(props, "hs_meeting_body", meta.body);
|
|
3266
|
+
setIf(props, "hs_internal_meeting_notes", meta.internalMeetingNotes);
|
|
3267
|
+
} else {
|
|
3268
|
+
const meta = asValues(config.callMetadata);
|
|
3269
|
+
props.hs_timestamp = now.toISOString();
|
|
3270
|
+
setIf(props, "hs_call_to_number", meta.toNumber);
|
|
3271
|
+
setIf(props, "hs_call_from_number", meta.fromNumber);
|
|
3272
|
+
setIf(props, "hs_call_status", meta.status);
|
|
3273
|
+
setIf(props, "hs_call_duration", meta.durationMilliseconds);
|
|
3274
|
+
setIf(props, "hs_call_recording_url", meta.recordingUrl);
|
|
3275
|
+
setIf(props, "hs_call_body", meta.body);
|
|
3276
|
+
}
|
|
3277
|
+
return props;
|
|
3278
|
+
}
|
|
3279
|
+
/** Does the metadata of the type have at least one value? */
|
|
3280
|
+
function hasMetadata(type, config) {
|
|
3281
|
+
const meta = asValues(type === "email" ? config.emailMetadata : type === "task" ? config.taskMetadata : type === "meeting" ? config.meetingMetadata : config.callMetadata);
|
|
3282
|
+
return Object.values(meta).some(isSet);
|
|
3283
|
+
}
|
|
3284
|
+
/** A search for the objects that changed last. `since` limits the time. */
|
|
3285
|
+
function recentSearch(sortBy, since, properties) {
|
|
3286
|
+
const body = { sorts: [{
|
|
3287
|
+
propertyName: sortBy,
|
|
3288
|
+
direction: "DESCENDING"
|
|
3289
|
+
}] };
|
|
3290
|
+
if (isSet(since)) body.filterGroups = [{ filters: [{
|
|
3291
|
+
propertyName: sortBy,
|
|
3292
|
+
operator: "GTE",
|
|
3293
|
+
value: String(toMs(since))
|
|
3294
|
+
}] }];
|
|
3295
|
+
if (properties) body.properties = properties;
|
|
3296
|
+
return body;
|
|
3297
|
+
}
|
|
3298
|
+
const objectPath = (type, id) => `/crm/v3/objects/${PLURAL[type]}${id === void 0 ? "" : `/${enc(id)}`}`;
|
|
3299
|
+
const remove = (type, id) => ({
|
|
3300
|
+
call: {
|
|
3301
|
+
method: "DELETE",
|
|
3302
|
+
path: objectPath(type, id)
|
|
3303
|
+
},
|
|
3304
|
+
deletedId: id
|
|
3305
|
+
});
|
|
3306
|
+
const list = (type, query = {}) => ({
|
|
3307
|
+
call: {
|
|
3308
|
+
method: "GET",
|
|
3309
|
+
path: objectPath(type),
|
|
3310
|
+
query
|
|
3311
|
+
},
|
|
3312
|
+
list: pagedList("query", query.propertiesWithHistory ? 50 : 100)
|
|
3313
|
+
});
|
|
3314
|
+
const search = (type, body) => ({
|
|
3315
|
+
call: {
|
|
3316
|
+
method: "POST",
|
|
3317
|
+
path: `${objectPath(type)}/search`,
|
|
3318
|
+
body
|
|
3319
|
+
},
|
|
3320
|
+
list: pagedList("body", 100, SEARCH_MAX_RESULTS)
|
|
3321
|
+
});
|
|
3322
|
+
/** The call of one operation. A node with several calls (a create with links) adds the others. */
|
|
3323
|
+
function buildRequest(config, now = /* @__PURE__ */ new Date()) {
|
|
3324
|
+
const { resource, operation } = config;
|
|
3325
|
+
switch (`${resource}.${operation}`) {
|
|
3326
|
+
case "contact.upsert": {
|
|
3327
|
+
const fields = asValues(config.contactFields);
|
|
3328
|
+
const companies = idsOf(fields.associatedCompanyId, "company ID");
|
|
3329
|
+
return {
|
|
3330
|
+
call: {
|
|
3331
|
+
method: "POST",
|
|
3332
|
+
path: "/crm/v3/objects/contacts/batch/upsert",
|
|
3333
|
+
body: { inputs: [{
|
|
3334
|
+
id: need(config.email, "email"),
|
|
3335
|
+
idProperty: "email",
|
|
3336
|
+
properties: propertyMap(CONTACT_FIELDS, fields)
|
|
3337
|
+
}] }
|
|
3338
|
+
},
|
|
3339
|
+
from: "contact",
|
|
3340
|
+
links: companies.length > 0 ? [{
|
|
3341
|
+
to: "company",
|
|
3342
|
+
ids: companies
|
|
3343
|
+
}] : []
|
|
3344
|
+
};
|
|
3345
|
+
}
|
|
3346
|
+
case "contact.get": {
|
|
3347
|
+
const id = need(config.contactId, "contactId");
|
|
3348
|
+
return { call: {
|
|
3349
|
+
method: "GET",
|
|
3350
|
+
path: objectPath("contact", id),
|
|
3351
|
+
query: propertyQuery(asValues(config.contactOptions))
|
|
3352
|
+
} };
|
|
3353
|
+
}
|
|
3354
|
+
case "contact.getAll": return list("contact", propertyQuery(asValues(config.contactOptions)));
|
|
3355
|
+
case "contact.getRecentlyCreatedUpdated": return search("contact", recentSearch("lastmodifieddate", void 0, strings(asValues(config.contactOptions).properties)));
|
|
3356
|
+
case "contact.delete": return remove("contact", need(config.contactId, "contactId"));
|
|
3357
|
+
case "contact.search": return search("contact", searchBody(config));
|
|
3358
|
+
case "contactList.add": {
|
|
3359
|
+
const listId = oneId(config.listId, "listId");
|
|
3360
|
+
if (config.by === "id") return { call: membershipCall(listId, "add", [oneId(config.id, "id")]) };
|
|
3361
|
+
return {
|
|
3362
|
+
call: membershipCall(listId, "add", []),
|
|
3363
|
+
emailLookup: need(config.email, "email")
|
|
3364
|
+
};
|
|
3365
|
+
}
|
|
3366
|
+
case "contactList.remove": return { call: membershipCall(oneId(config.listId, "listId"), "remove", [oneId(config.id, "id")]) };
|
|
3367
|
+
case "company.create": return { call: {
|
|
3368
|
+
method: "POST",
|
|
3369
|
+
path: objectPath("company"),
|
|
3370
|
+
body: { properties: propertyMap(COMPANY_CREATE_FIELDS, asValues(config.companyFields), { name: need(config.name, "name") }) }
|
|
3371
|
+
} };
|
|
3372
|
+
case "company.update": return { call: {
|
|
3373
|
+
method: "PATCH",
|
|
3374
|
+
path: objectPath("company", need(config.companyId, "companyId")),
|
|
3375
|
+
body: { properties: propertyMap(COMPANY_UPDATE_FIELDS, asValues(config.companyUpdateFields)) }
|
|
3376
|
+
} };
|
|
3377
|
+
case "company.get": return { call: {
|
|
3378
|
+
method: "GET",
|
|
3379
|
+
path: objectPath("company", need(config.companyId, "companyId")),
|
|
3380
|
+
query: propertyQuery(asValues(config.companyGetOptions))
|
|
3381
|
+
} };
|
|
3382
|
+
case "company.getAll": return list("company", propertyQuery(asValues(config.companyListOptions)));
|
|
3383
|
+
case "company.getRecentlyCreatedUpdated": {
|
|
3384
|
+
const options = asValues(config.companyRecentOptions);
|
|
3385
|
+
return search("company", recentSearch("hs_lastmodifieddate", options.since, strings(options.properties)));
|
|
3386
|
+
}
|
|
3387
|
+
case "company.searchByDomain": {
|
|
3388
|
+
const domain = need(config.domain, "domain").replace(/^https?:\/\//, "");
|
|
3389
|
+
const properties = strings(asValues(config.domainOptions).properties);
|
|
3390
|
+
return search("company", {
|
|
3391
|
+
filterGroups: [{ filters: [{
|
|
3392
|
+
propertyName: "domain",
|
|
3393
|
+
operator: "EQ",
|
|
3394
|
+
value: domain
|
|
3395
|
+
}] }],
|
|
3396
|
+
...properties ? { properties } : {}
|
|
3397
|
+
});
|
|
3398
|
+
}
|
|
3399
|
+
case "company.delete": return remove("company", need(config.companyId, "companyId"));
|
|
3400
|
+
case "deal.create": {
|
|
3401
|
+
const fields = asValues(config.dealFields);
|
|
3402
|
+
const links = [];
|
|
3403
|
+
const companies = idsOf(fields.associatedCompany, "company ID");
|
|
3404
|
+
if (companies.length > 0) links.push({
|
|
3405
|
+
to: "company",
|
|
3406
|
+
ids: companies
|
|
3407
|
+
});
|
|
3408
|
+
const vids = idsOf(fields.associatedVids, "contact ID");
|
|
3409
|
+
if (vids.length > 0) links.push({
|
|
3410
|
+
to: "contact",
|
|
3411
|
+
ids: vids
|
|
3412
|
+
});
|
|
3413
|
+
return {
|
|
3414
|
+
call: {
|
|
3415
|
+
method: "POST",
|
|
3416
|
+
path: objectPath("deal"),
|
|
3417
|
+
body: { properties: propertyMap(DEAL_CREATE_FIELDS, fields, { dealstage: need(config.stage, "stage") }) }
|
|
3418
|
+
},
|
|
3419
|
+
from: "deal",
|
|
3420
|
+
links
|
|
3421
|
+
};
|
|
3422
|
+
}
|
|
3423
|
+
case "deal.update": return { call: {
|
|
3424
|
+
method: "PATCH",
|
|
3425
|
+
path: objectPath("deal", need(config.dealId, "dealId")),
|
|
3426
|
+
body: { properties: propertyMap(DEAL_UPDATE_FIELDS, asValues(config.dealUpdateFields)) }
|
|
3427
|
+
} };
|
|
3428
|
+
case "deal.get": {
|
|
3429
|
+
const options = asValues(config.dealGetOptions);
|
|
3430
|
+
return { call: {
|
|
3431
|
+
method: "GET",
|
|
3432
|
+
path: objectPath("deal", need(config.dealId, "dealId")),
|
|
3433
|
+
query: propertyQuery(options, options.includePropertyVersions === true)
|
|
3434
|
+
} };
|
|
3435
|
+
}
|
|
3436
|
+
case "deal.getAll": {
|
|
3437
|
+
const options = asValues(config.dealListOptions);
|
|
3438
|
+
const query = propertyQuery(options);
|
|
3439
|
+
if (options.includeAssociations === true) query.associations = "contacts,companies";
|
|
3440
|
+
return list("deal", query);
|
|
3441
|
+
}
|
|
3442
|
+
case "deal.getRecentlyCreatedUpdated": {
|
|
3443
|
+
const options = asValues(config.dealRecentOptions);
|
|
3444
|
+
return search("deal", recentSearch("createdate", options.since, void 0));
|
|
3445
|
+
}
|
|
3446
|
+
case "deal.delete": return remove("deal", need(config.dealId, "dealId"));
|
|
3447
|
+
case "deal.search": return search("deal", searchBody(config));
|
|
3448
|
+
case "engagement.create": {
|
|
3449
|
+
const type = activityType(config.type);
|
|
3450
|
+
if (!hasMetadata(type, config)) throw new Error("At least one metadata field needs to set");
|
|
3451
|
+
const associations = asValues(config.associations);
|
|
3452
|
+
const properties = engagementProperties(type, config, now);
|
|
3453
|
+
if (typeof associations.ownerId === "number" && associations.ownerId) properties.hubspot_owner_id = String(associations.ownerId);
|
|
3454
|
+
const links = [];
|
|
3455
|
+
for (const [name, to] of [
|
|
3456
|
+
["companyIds", "company"],
|
|
3457
|
+
["contactIds", "contact"],
|
|
3458
|
+
["dealIds", "deal"],
|
|
3459
|
+
["ticketIds", "ticket"]
|
|
3460
|
+
]) {
|
|
3461
|
+
const ids = idsOf(associations[name], name);
|
|
3462
|
+
if (ids.length > 0) links.push({
|
|
3463
|
+
to,
|
|
3464
|
+
ids
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
return {
|
|
3468
|
+
call: {
|
|
3469
|
+
method: "POST",
|
|
3470
|
+
path: objectPath(type),
|
|
3471
|
+
body: { properties }
|
|
3472
|
+
},
|
|
3473
|
+
from: type,
|
|
3474
|
+
links
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
case "engagement.get": return { call: {
|
|
3478
|
+
method: "GET",
|
|
3479
|
+
path: objectPath(activityType(config.type), need(config.engagementId, "engagementId"))
|
|
3480
|
+
} };
|
|
3481
|
+
case "engagement.delete": return remove(activityType(config.type), need(config.engagementId, "engagementId"));
|
|
3482
|
+
case "engagement.getAll": return list(activityType(config.type));
|
|
3483
|
+
case "ticket.create": {
|
|
3484
|
+
const fields = asValues(config.ticketFields);
|
|
3485
|
+
const links = [];
|
|
3486
|
+
const companies = idsOf(fields.associatedCompanyIds, "company ID");
|
|
3487
|
+
if (companies.length > 0) links.push({
|
|
3488
|
+
to: "company",
|
|
3489
|
+
ids: companies
|
|
3490
|
+
});
|
|
3491
|
+
const contacts = idsOf(fields.associatedContactIds, "contact ID");
|
|
3492
|
+
if (contacts.length > 0) links.push({
|
|
3493
|
+
to: "contact",
|
|
3494
|
+
ids: contacts
|
|
3495
|
+
});
|
|
3496
|
+
return {
|
|
3497
|
+
call: {
|
|
3498
|
+
method: "POST",
|
|
3499
|
+
path: objectPath("ticket"),
|
|
3500
|
+
body: { properties: propertyMap(TICKET_CREATE_FIELDS, fields, {
|
|
3501
|
+
hs_pipeline: need(config.pipelineId, "pipelineId"),
|
|
3502
|
+
hs_pipeline_stage: need(config.stageId, "stageId"),
|
|
3503
|
+
subject: need(config.ticketName, "ticketName")
|
|
3504
|
+
}) }
|
|
3505
|
+
},
|
|
3506
|
+
from: "ticket",
|
|
3507
|
+
links
|
|
3508
|
+
};
|
|
3509
|
+
}
|
|
3510
|
+
case "ticket.update": {
|
|
3511
|
+
const fields = asValues(config.ticketUpdateFields);
|
|
3512
|
+
const links = [];
|
|
3513
|
+
const companies = idsOf(fields.associatedCompanyIds, "company ID");
|
|
3514
|
+
if (companies.length > 0) links.push({
|
|
3515
|
+
to: "company",
|
|
3516
|
+
ids: companies
|
|
3517
|
+
});
|
|
3518
|
+
const contacts = idsOf(fields.associatedContactIds, "contact ID");
|
|
3519
|
+
if (contacts.length > 0) links.push({
|
|
3520
|
+
to: "contact",
|
|
3521
|
+
ids: contacts
|
|
3522
|
+
});
|
|
3523
|
+
return {
|
|
3524
|
+
call: {
|
|
3525
|
+
method: "PATCH",
|
|
3526
|
+
path: objectPath("ticket", need(config.ticketId, "ticketId")),
|
|
3527
|
+
body: { properties: propertyMap(TICKET_UPDATE_FIELDS, fields) }
|
|
3528
|
+
},
|
|
3529
|
+
from: "ticket",
|
|
3530
|
+
links
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
case "ticket.get": {
|
|
3534
|
+
const options = asValues(config.ticketGetOptions);
|
|
3535
|
+
const query = propertyQuery(options);
|
|
3536
|
+
return {
|
|
3537
|
+
call: {
|
|
3538
|
+
method: "GET",
|
|
3539
|
+
path: objectPath("ticket", need(config.ticketId, "ticketId")),
|
|
3540
|
+
query
|
|
3541
|
+
},
|
|
3542
|
+
archivedFallback: options.includeDeleted === true
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
case "ticket.getAll": return list("ticket", propertyQuery(asValues(config.ticketListOptions)));
|
|
3546
|
+
case "ticket.delete": return remove("ticket", need(config.ticketId, "ticketId"));
|
|
3547
|
+
default: throw new Error(`"${operation}" is not an operation of "${resource}"`);
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
// src/node.ts
|
|
3551
|
+
const asRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
3552
|
+
var node_default = (0, _zerodot_node_sdk.defineNode)({
|
|
3553
|
+
type: "hubspot.api",
|
|
3554
|
+
label: "HubSpot",
|
|
3555
|
+
description: "Manage contacts, companies, deals, tickets, engagements, and lists with HubSpot",
|
|
3556
|
+
category: "integration",
|
|
3557
|
+
app: "HubSpot",
|
|
3558
|
+
actions: [
|
|
3559
|
+
{
|
|
3560
|
+
label: "Create a company",
|
|
3561
|
+
config: {
|
|
3562
|
+
resource: "company",
|
|
3563
|
+
operation: "create"
|
|
3564
|
+
}
|
|
3565
|
+
},
|
|
3566
|
+
{
|
|
3567
|
+
label: "Delete a company",
|
|
3568
|
+
config: {
|
|
3569
|
+
resource: "company",
|
|
3570
|
+
operation: "delete"
|
|
3571
|
+
}
|
|
3572
|
+
},
|
|
3573
|
+
{
|
|
3574
|
+
label: "Get a company",
|
|
3575
|
+
config: {
|
|
3576
|
+
resource: "company",
|
|
3577
|
+
operation: "get"
|
|
3578
|
+
}
|
|
3579
|
+
},
|
|
3580
|
+
{
|
|
3581
|
+
label: "Get many companies",
|
|
3582
|
+
config: {
|
|
3583
|
+
resource: "company",
|
|
3584
|
+
operation: "getAll"
|
|
3585
|
+
}
|
|
3586
|
+
},
|
|
3587
|
+
{
|
|
3588
|
+
label: "Get recently created or updated companies",
|
|
3589
|
+
config: {
|
|
3590
|
+
resource: "company",
|
|
3591
|
+
operation: "getRecentlyCreatedUpdated"
|
|
3592
|
+
}
|
|
3593
|
+
},
|
|
3594
|
+
{
|
|
3595
|
+
label: "Search companies by domain",
|
|
3596
|
+
config: {
|
|
3597
|
+
resource: "company",
|
|
3598
|
+
operation: "searchByDomain"
|
|
3599
|
+
}
|
|
3600
|
+
},
|
|
3601
|
+
{
|
|
3602
|
+
label: "Update a company",
|
|
3603
|
+
config: {
|
|
3604
|
+
resource: "company",
|
|
3605
|
+
operation: "update"
|
|
3606
|
+
}
|
|
3607
|
+
},
|
|
3608
|
+
{
|
|
3609
|
+
label: "Create or update a contact",
|
|
3610
|
+
config: {
|
|
3611
|
+
resource: "contact",
|
|
3612
|
+
operation: "upsert"
|
|
3613
|
+
}
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
label: "Delete a contact",
|
|
3617
|
+
config: {
|
|
3618
|
+
resource: "contact",
|
|
3619
|
+
operation: "delete"
|
|
3620
|
+
}
|
|
3621
|
+
},
|
|
3622
|
+
{
|
|
3623
|
+
label: "Get a contact",
|
|
3624
|
+
config: {
|
|
3625
|
+
resource: "contact",
|
|
3626
|
+
operation: "get"
|
|
3627
|
+
}
|
|
3628
|
+
},
|
|
3629
|
+
{
|
|
3630
|
+
label: "Get many contacts",
|
|
3631
|
+
config: {
|
|
3632
|
+
resource: "contact",
|
|
3633
|
+
operation: "getAll"
|
|
3634
|
+
}
|
|
3635
|
+
},
|
|
3636
|
+
{
|
|
3637
|
+
label: "Get recently created or updated contacts",
|
|
3638
|
+
config: {
|
|
3639
|
+
resource: "contact",
|
|
3640
|
+
operation: "getRecentlyCreatedUpdated"
|
|
3641
|
+
}
|
|
3642
|
+
},
|
|
3643
|
+
{
|
|
3644
|
+
label: "Search contacts",
|
|
3645
|
+
config: {
|
|
3646
|
+
resource: "contact",
|
|
3647
|
+
operation: "search"
|
|
3648
|
+
}
|
|
3649
|
+
},
|
|
3650
|
+
{
|
|
3651
|
+
label: "Add a contact to a list",
|
|
3652
|
+
config: {
|
|
3653
|
+
resource: "contactList",
|
|
3654
|
+
operation: "add"
|
|
3655
|
+
}
|
|
3656
|
+
},
|
|
3657
|
+
{
|
|
3658
|
+
label: "Remove a contact from a list",
|
|
3659
|
+
config: {
|
|
3660
|
+
resource: "contactList",
|
|
3661
|
+
operation: "remove"
|
|
3662
|
+
}
|
|
3663
|
+
},
|
|
3664
|
+
{
|
|
3665
|
+
label: "Create a deal",
|
|
3666
|
+
config: {
|
|
3667
|
+
resource: "deal",
|
|
3668
|
+
operation: "create"
|
|
3669
|
+
}
|
|
3670
|
+
},
|
|
3671
|
+
{
|
|
3672
|
+
label: "Delete a deal",
|
|
3673
|
+
config: {
|
|
3674
|
+
resource: "deal",
|
|
3675
|
+
operation: "delete"
|
|
3676
|
+
}
|
|
3677
|
+
},
|
|
3678
|
+
{
|
|
3679
|
+
label: "Get a deal",
|
|
3680
|
+
config: {
|
|
3681
|
+
resource: "deal",
|
|
3682
|
+
operation: "get"
|
|
3683
|
+
}
|
|
3684
|
+
},
|
|
3685
|
+
{
|
|
3686
|
+
label: "Get many deals",
|
|
3687
|
+
config: {
|
|
3688
|
+
resource: "deal",
|
|
3689
|
+
operation: "getAll"
|
|
3690
|
+
}
|
|
3691
|
+
},
|
|
3692
|
+
{
|
|
3693
|
+
label: "Get recently created or updated deals",
|
|
3694
|
+
config: {
|
|
3695
|
+
resource: "deal",
|
|
3696
|
+
operation: "getRecentlyCreatedUpdated"
|
|
3697
|
+
}
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
label: "Search deals",
|
|
3701
|
+
config: {
|
|
3702
|
+
resource: "deal",
|
|
3703
|
+
operation: "search"
|
|
3704
|
+
}
|
|
3705
|
+
},
|
|
3706
|
+
{
|
|
3707
|
+
label: "Update a deal",
|
|
3708
|
+
config: {
|
|
3709
|
+
resource: "deal",
|
|
3710
|
+
operation: "update"
|
|
3711
|
+
}
|
|
3712
|
+
},
|
|
3713
|
+
{
|
|
3714
|
+
label: "Create an engagement",
|
|
3715
|
+
config: {
|
|
3716
|
+
resource: "engagement",
|
|
3717
|
+
operation: "create"
|
|
3718
|
+
}
|
|
3719
|
+
},
|
|
3720
|
+
{
|
|
3721
|
+
label: "Delete an engagement",
|
|
3722
|
+
config: {
|
|
3723
|
+
resource: "engagement",
|
|
3724
|
+
operation: "delete"
|
|
3725
|
+
}
|
|
3726
|
+
},
|
|
3727
|
+
{
|
|
3728
|
+
label: "Get an engagement",
|
|
3729
|
+
config: {
|
|
3730
|
+
resource: "engagement",
|
|
3731
|
+
operation: "get"
|
|
3732
|
+
}
|
|
3733
|
+
},
|
|
3734
|
+
{
|
|
3735
|
+
label: "Get many engagements",
|
|
3736
|
+
config: {
|
|
3737
|
+
resource: "engagement",
|
|
3738
|
+
operation: "getAll"
|
|
3739
|
+
}
|
|
3740
|
+
},
|
|
3741
|
+
{
|
|
3742
|
+
label: "Create a ticket",
|
|
3743
|
+
config: {
|
|
3744
|
+
resource: "ticket",
|
|
3745
|
+
operation: "create"
|
|
3746
|
+
}
|
|
3747
|
+
},
|
|
3748
|
+
{
|
|
3749
|
+
label: "Delete a ticket",
|
|
3750
|
+
config: {
|
|
3751
|
+
resource: "ticket",
|
|
3752
|
+
operation: "delete"
|
|
3753
|
+
}
|
|
3754
|
+
},
|
|
3755
|
+
{
|
|
3756
|
+
label: "Get a ticket",
|
|
3757
|
+
config: {
|
|
3758
|
+
resource: "ticket",
|
|
3759
|
+
operation: "get"
|
|
3760
|
+
}
|
|
3761
|
+
},
|
|
3762
|
+
{
|
|
3763
|
+
label: "Get many tickets",
|
|
3764
|
+
config: {
|
|
3765
|
+
resource: "ticket",
|
|
3766
|
+
operation: "getAll"
|
|
3767
|
+
}
|
|
3768
|
+
},
|
|
3769
|
+
{
|
|
3770
|
+
label: "Update a ticket",
|
|
3771
|
+
config: {
|
|
3772
|
+
resource: "ticket",
|
|
3773
|
+
operation: "update"
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
],
|
|
3777
|
+
icon: "UserGroupIcon",
|
|
3778
|
+
iconUrl: HUBSPOT_ICON,
|
|
3779
|
+
config: hubspotConfig,
|
|
3780
|
+
defaultConfig: {
|
|
3781
|
+
authentication: "appToken",
|
|
3782
|
+
resource: "contact",
|
|
3783
|
+
operation: "upsert",
|
|
3784
|
+
by: "email",
|
|
3785
|
+
contactFields: {},
|
|
3786
|
+
upsertOptions: {},
|
|
3787
|
+
contactOptions: {},
|
|
3788
|
+
filterGroups: [],
|
|
3789
|
+
searchOptions: {},
|
|
3790
|
+
companyFields: {},
|
|
3791
|
+
companyUpdateFields: {},
|
|
3792
|
+
companyGetOptions: {},
|
|
3793
|
+
companyListOptions: {},
|
|
3794
|
+
companyRecentOptions: {},
|
|
3795
|
+
domainOptions: {},
|
|
3796
|
+
dealFields: {},
|
|
3797
|
+
dealUpdateFields: {},
|
|
3798
|
+
dealGetOptions: {},
|
|
3799
|
+
dealListOptions: {},
|
|
3800
|
+
dealRecentOptions: {},
|
|
3801
|
+
taskMetadata: {},
|
|
3802
|
+
emailMetadata: {},
|
|
3803
|
+
meetingMetadata: {},
|
|
3804
|
+
callMetadata: {},
|
|
3805
|
+
associations: {},
|
|
3806
|
+
ticketFields: {},
|
|
3807
|
+
ticketUpdateFields: {},
|
|
3808
|
+
ticketGetOptions: {},
|
|
3809
|
+
ticketListOptions: {},
|
|
3810
|
+
returnAll: false,
|
|
3811
|
+
limit: 100,
|
|
3812
|
+
timeoutMs: 3e4
|
|
3813
|
+
},
|
|
3814
|
+
credentialTypes: [HUBSPOT_TOKEN_CREDENTIAL, HUBSPOT_OAUTH2_CREDENTIAL],
|
|
3815
|
+
credentialRules: {
|
|
3816
|
+
[HUBSPOT_TOKEN_CREDENTIAL]: { showWhen: { authentication: ["appToken"] } },
|
|
3817
|
+
[HUBSPOT_OAUTH2_CREDENTIAL]: { showWhen: { authentication: ["oAuth2"] } }
|
|
3818
|
+
},
|
|
3819
|
+
ports: {
|
|
3820
|
+
in: ["in"],
|
|
3821
|
+
out: ["out"]
|
|
3822
|
+
},
|
|
3823
|
+
subtitle: (config) => typeof config.operation === "string" ? `${config.operation}: ${String(config.resource ?? "contact")}` : void 0,
|
|
3824
|
+
async run({ config, credential, signal }) {
|
|
3825
|
+
const access = hubspotAccess(credential);
|
|
3826
|
+
const options = {
|
|
3827
|
+
signal,
|
|
3828
|
+
timeoutMs: config.timeoutMs
|
|
3829
|
+
};
|
|
3830
|
+
const request = buildRequest(config);
|
|
3831
|
+
if (request.list) return {
|
|
3832
|
+
port: "out",
|
|
3833
|
+
data: await callHubspotList(access, request.call, request.list, config.returnAll ? null : config.limit, options)
|
|
3834
|
+
};
|
|
3835
|
+
let call = request.call;
|
|
3836
|
+
if (request.emailLookup !== void 0) {
|
|
3837
|
+
const found = asRecord(await callHubspot(access, contactLookupCall(request.emailLookup), options));
|
|
3838
|
+
if (typeof found.id !== "string" && typeof found.id !== "number") throw new Error(`HubSpot did not find a contact with the email "${request.emailLookup}"`);
|
|
3839
|
+
call = {
|
|
3840
|
+
...call,
|
|
3841
|
+
body: [String(found.id)]
|
|
3842
|
+
};
|
|
3843
|
+
}
|
|
3844
|
+
let answer;
|
|
3845
|
+
try {
|
|
3846
|
+
answer = await callHubspot(access, call, options);
|
|
3847
|
+
} catch (error) {
|
|
3848
|
+
if (!(request.archivedFallback && error instanceof HubspotError && error.status === 404)) throw error;
|
|
3849
|
+
answer = await callHubspot(access, {
|
|
3850
|
+
...call,
|
|
3851
|
+
query: {
|
|
3852
|
+
...call.query,
|
|
3853
|
+
archived: true
|
|
3854
|
+
}
|
|
3855
|
+
}, options);
|
|
3856
|
+
}
|
|
3857
|
+
if (request.deletedId !== void 0) return {
|
|
3858
|
+
port: "out",
|
|
3859
|
+
data: answer ?? {
|
|
3860
|
+
vid: request.deletedId,
|
|
3861
|
+
deleted: true
|
|
3862
|
+
}
|
|
3863
|
+
};
|
|
3864
|
+
let result = asRecord(answer);
|
|
3865
|
+
if (config.resource === "contact" && config.operation === "upsert") {
|
|
3866
|
+
const first = Array.isArray(result.results) ? result.results[0] : void 0;
|
|
3867
|
+
if (first === void 0) {
|
|
3868
|
+
const failed = Array.isArray(result.errors) ? asRecord(result.errors[0]) : {};
|
|
3869
|
+
const reason = typeof failed.message === "string" ? failed.message : "no result";
|
|
3870
|
+
throw new Error(`HubSpot did not upsert the contact: ${reason}`);
|
|
3871
|
+
}
|
|
3872
|
+
result = asRecord(first);
|
|
3873
|
+
if (result.id === void 0) throw new Error("HubSpot did not give the ID of the contact");
|
|
3874
|
+
}
|
|
3875
|
+
if (request.from && request.links && request.links.length > 0) for (const link of linkCalls(request.from, result.id, request.links)) await callHubspot(access, link, options);
|
|
3876
|
+
if (config.resource === "contact" && config.operation === "upsert") {
|
|
3877
|
+
if (!asRecord(config.upsertOptions).resolveData) {
|
|
3878
|
+
const fields = asRecord(config.contactFields);
|
|
3879
|
+
const properties = Array.isArray(fields.properties) ? fields.properties.map(String) : void 0;
|
|
3880
|
+
return {
|
|
3881
|
+
port: "out",
|
|
3882
|
+
data: {
|
|
3883
|
+
...asRecord(await callHubspot(access, contactReadCall(result.id, properties?.length ? properties : void 0), options)),
|
|
3884
|
+
isNew: result.new === true
|
|
3885
|
+
}
|
|
3886
|
+
};
|
|
3887
|
+
}
|
|
3888
|
+
return {
|
|
3889
|
+
port: "out",
|
|
3890
|
+
data: {
|
|
3891
|
+
...result,
|
|
3892
|
+
isNew: result.new === true
|
|
3893
|
+
}
|
|
3894
|
+
};
|
|
3895
|
+
}
|
|
3896
|
+
return {
|
|
3897
|
+
port: "out",
|
|
3898
|
+
data: answer ?? { success: true }
|
|
3899
|
+
};
|
|
3900
|
+
}
|
|
3901
|
+
});
|
|
3902
|
+
// src/trigger.ts
|
|
3903
|
+
const TIMEOUT_MS = 15e3;
|
|
3904
|
+
const EVENT_TYPES = [
|
|
3905
|
+
"company.creation",
|
|
3906
|
+
"company.deletion",
|
|
3907
|
+
"company.propertyChange",
|
|
3908
|
+
"contact.creation",
|
|
3909
|
+
"contact.deletion",
|
|
3910
|
+
"contact.privacyDeletion",
|
|
3911
|
+
"contact.propertyChange",
|
|
3912
|
+
"conversation.creation",
|
|
3913
|
+
"conversation.deletion",
|
|
3914
|
+
"conversation.newMessage",
|
|
3915
|
+
"conversation.privacyDeletion",
|
|
3916
|
+
"conversation.propertyChange",
|
|
3917
|
+
"deal.creation",
|
|
3918
|
+
"deal.deletion",
|
|
3919
|
+
"deal.propertyChange",
|
|
3920
|
+
"ticket.creation",
|
|
3921
|
+
"ticket.deletion",
|
|
3922
|
+
"ticket.propertyChange"
|
|
3923
|
+
];
|
|
3924
|
+
/** The events that need the name of a property. */
|
|
3925
|
+
const propertyEvents = EVENT_TYPES.filter((name) => name.endsWith(".propertyChange"));
|
|
3926
|
+
const eventItem = zod.z.object({
|
|
3927
|
+
name: zod.z.enum(EVENT_TYPES).default("contact.creation").meta({
|
|
3928
|
+
title: "Name",
|
|
3929
|
+
labels: {
|
|
3930
|
+
"company.creation": "Company Created",
|
|
3931
|
+
"company.deletion": "Company Deleted",
|
|
3932
|
+
"company.propertyChange": "Company Property Changed",
|
|
3933
|
+
"contact.creation": "Contact Created",
|
|
3934
|
+
"contact.deletion": "Contact Deleted",
|
|
3935
|
+
"contact.privacyDeletion": "Contact Privacy Deleted",
|
|
3936
|
+
"contact.propertyChange": "Contact Property Changed",
|
|
3937
|
+
"conversation.creation": "Conversation Creation",
|
|
3938
|
+
"conversation.deletion": "Conversation Deletion",
|
|
3939
|
+
"conversation.newMessage": "Conversation New Message",
|
|
3940
|
+
"conversation.privacyDeletion": "Conversation Privacy Deletion",
|
|
3941
|
+
"conversation.propertyChange": "Conversation Property Change",
|
|
3942
|
+
"deal.creation": "Deal Created",
|
|
3943
|
+
"deal.deletion": "Deal Deleted",
|
|
3944
|
+
"deal.propertyChange": "Deal Property Changed",
|
|
3945
|
+
"ticket.creation": "Ticket Created",
|
|
3946
|
+
"ticket.deletion": "Ticket Deleted",
|
|
3947
|
+
"ticket.propertyChange": "Ticket Property Changed"
|
|
3948
|
+
},
|
|
3949
|
+
hints: {
|
|
3950
|
+
"company.creation": "A company is created in the account",
|
|
3951
|
+
"company.deletion": "A company is deleted in the account",
|
|
3952
|
+
"company.propertyChange": "A property that you name changes for a company",
|
|
3953
|
+
"contact.creation": "A contact is created in the account",
|
|
3954
|
+
"contact.deletion": "A contact is deleted in the account",
|
|
3955
|
+
"contact.privacyDeletion": "A contact is deleted for privacy compliance reasons",
|
|
3956
|
+
"contact.propertyChange": "A property that you name changes for a contact",
|
|
3957
|
+
"conversation.creation": "A new thread is created in the account",
|
|
3958
|
+
"conversation.deletion": "A thread is archived or soft-deleted in the account",
|
|
3959
|
+
"conversation.newMessage": "A new message on a thread is received",
|
|
3960
|
+
"conversation.privacyDeletion": "A thread is permanently deleted in the account",
|
|
3961
|
+
"conversation.propertyChange": "A property on a thread changes",
|
|
3962
|
+
"deal.creation": "A deal is created in the account",
|
|
3963
|
+
"deal.deletion": "A deal is deleted in the account",
|
|
3964
|
+
"deal.propertyChange": "A property that you name changes for a deal",
|
|
3965
|
+
"ticket.creation": "A ticket is created in the account",
|
|
3966
|
+
"ticket.deletion": "A ticket is deleted in the account",
|
|
3967
|
+
"ticket.propertyChange": "A property that you name changes for a ticket"
|
|
3968
|
+
}
|
|
3969
|
+
}),
|
|
3970
|
+
property: zod.z.string().optional().meta({
|
|
3971
|
+
title: "Property Name",
|
|
3972
|
+
description: "The internal name of the property. Needed for the events that end with Property Changed. For a conversation use assignedTo, isArchived, or status"
|
|
3973
|
+
})
|
|
3974
|
+
});
|
|
3975
|
+
const triggerConfig = zod.z.object({
|
|
3976
|
+
events: zod.z.array(eventItem).min(1).default([{ name: "contact.creation" }]).meta({ title: "Events" }),
|
|
3977
|
+
additionalFields: zod.z.object({ maxConcurrentRequests: zod.z.number().int().min(5).meta({
|
|
3978
|
+
title: "Max Concurrent Requests",
|
|
3979
|
+
description: "The most requests that HubSpot sends at the same time. At least 5"
|
|
3980
|
+
}) }).partial().default({})
|
|
3981
|
+
});
|
|
3982
|
+
/** The value of a header. The name can be in any case. */
|
|
3983
|
+
function headerOf(headers, name) {
|
|
3984
|
+
const wanted = name.toLowerCase();
|
|
3985
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === wanted) return value;
|
|
3986
|
+
}
|
|
3987
|
+
/** The v1 signature: the SHA-256 hash of the client secret and the raw body, as hex. */
|
|
3988
|
+
function signatureV1(secret, rawBody) {
|
|
3989
|
+
return (0, node_crypto.createHash)("sha256").update(`${secret}${rawBody}`).digest("hex");
|
|
3990
|
+
}
|
|
3991
|
+
/** The v3 signature: the base64 HMAC-SHA256 of method, address, body, and timestamp. */
|
|
3992
|
+
function signatureV3(secret, method, uri, rawBody, timestamp) {
|
|
3993
|
+
return (0, node_crypto.createHmac)("sha256", secret).update(`${method}${uri}${rawBody}${timestamp}`).digest("base64");
|
|
3994
|
+
}
|
|
3995
|
+
function same(given, wanted) {
|
|
3996
|
+
const a = Buffer.from(given);
|
|
3997
|
+
const b = Buffer.from(wanted);
|
|
3998
|
+
return a.byteLength === b.byteLength && (0, node_crypto.timingSafeEqual)(a, b);
|
|
3999
|
+
}
|
|
4000
|
+
/**
|
|
4001
|
+
* Checks the signature of a request. A valid v1 signature (header `X-HubSpot-Signature`) or a
|
|
4002
|
+
* valid v3 signature (header `X-HubSpot-Signature-v3`, inside the tolerance) is enough.
|
|
4003
|
+
* `now` is in milliseconds.
|
|
4004
|
+
*/
|
|
4005
|
+
function verifyHubspotRequest(secret, request, url, now = Date.now()) {
|
|
4006
|
+
if (request.rawBody === void 0) return false;
|
|
4007
|
+
const v3 = headerOf(request.headers, "x-hubspot-signature-v3");
|
|
4008
|
+
if (v3 !== void 0) {
|
|
4009
|
+
const timestamp = headerOf(request.headers, "x-hubspot-request-timestamp");
|
|
4010
|
+
if (!timestamp || !/^\d+$/.test(timestamp)) return false;
|
|
4011
|
+
if (Math.abs(now - Number(timestamp)) > 3e5) return false;
|
|
4012
|
+
return same(v3, signatureV3(secret, request.method.toUpperCase(), url, request.rawBody, timestamp));
|
|
4013
|
+
}
|
|
4014
|
+
const v1 = headerOf(request.headers, "x-hubspot-signature");
|
|
4015
|
+
return v1 !== void 0 && same(v1, signatureV1(secret, request.rawBody));
|
|
4016
|
+
}
|
|
4017
|
+
const ID_KEYS = [
|
|
4018
|
+
["contact", "contactId"],
|
|
4019
|
+
["company", "companyId"],
|
|
4020
|
+
["deal", "dealId"],
|
|
4021
|
+
["ticket", "ticketId"],
|
|
4022
|
+
["conversation", "conversationId"]
|
|
4023
|
+
];
|
|
4024
|
+
/** Each event gets the ID under a name for its object, such as `contactId`. */
|
|
4025
|
+
function shapeEvents(body) {
|
|
4026
|
+
if (!Array.isArray(body)) return null;
|
|
4027
|
+
return body.filter((item) => typeof item === "object" && item !== null).map((item) => {
|
|
4028
|
+
const event = { ...item };
|
|
4029
|
+
const type = typeof event.subscriptionType === "string" ? event.subscriptionType : "";
|
|
4030
|
+
for (const [word, name] of ID_KEYS) if (type.includes(word)) event[name] = item.objectId;
|
|
4031
|
+
if (ID_KEYS.some(([word]) => type.includes(word))) delete event.objectId;
|
|
4032
|
+
return event;
|
|
4033
|
+
});
|
|
4034
|
+
}
|
|
4035
|
+
/** Decides about a request that has a valid signature. */
|
|
4036
|
+
function checkHubspotEvent(rawBody) {
|
|
4037
|
+
let parsed;
|
|
4038
|
+
try {
|
|
4039
|
+
parsed = JSON.parse(rawBody);
|
|
4040
|
+
} catch {
|
|
4041
|
+
return { verdict: "ignore" };
|
|
4042
|
+
}
|
|
4043
|
+
const events = shapeEvents(parsed);
|
|
4044
|
+
if (!events || events.length === 0) return { verdict: "ignore" };
|
|
4045
|
+
return {
|
|
4046
|
+
verdict: "accept",
|
|
4047
|
+
input: events
|
|
4048
|
+
};
|
|
4049
|
+
}
|
|
4050
|
+
const base = (access) => `/webhooks/v3/${encodeURIComponent(access.appId)}`;
|
|
4051
|
+
const withKey = (access) => ({
|
|
4052
|
+
kind: "hapikey",
|
|
4053
|
+
key: access.apiKey
|
|
4054
|
+
});
|
|
4055
|
+
/** Removes each subscription and the settings of the app. A 404 is fine. */
|
|
4056
|
+
async function clearApp(access, options) {
|
|
4057
|
+
const results = (await callHubspot(withKey(access), {
|
|
4058
|
+
method: "GET",
|
|
4059
|
+
path: `${base(access)}/subscriptions`
|
|
4060
|
+
}, options).catch((error) => {
|
|
4061
|
+
if (error instanceof HubspotError && error.status === 404) return null;
|
|
4062
|
+
throw error;
|
|
4063
|
+
}))?.results ?? [];
|
|
4064
|
+
for (const subscription of results) {
|
|
4065
|
+
if (subscription.id === void 0) continue;
|
|
4066
|
+
await callHubspot(withKey(access), {
|
|
4067
|
+
method: "DELETE",
|
|
4068
|
+
path: `${base(access)}/subscriptions/${encodeURIComponent(String(subscription.id))}`
|
|
4069
|
+
}, options);
|
|
4070
|
+
}
|
|
4071
|
+
try {
|
|
4072
|
+
await callHubspot(withKey(access), {
|
|
4073
|
+
method: "DELETE",
|
|
4074
|
+
path: `${base(access)}/settings`
|
|
4075
|
+
}, options);
|
|
4076
|
+
} catch (error) {
|
|
4077
|
+
if (!(error instanceof HubspotError && error.status === 404)) throw error;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
// src/index.ts
|
|
4081
|
+
const nodes = [(0, _zerodot_node_sdk.defineNode)({
|
|
4082
|
+
type: "trigger.hubspot",
|
|
4083
|
+
label: "HubSpot Trigger",
|
|
4084
|
+
description: "Start the workflow when an event happens in HubSpot, such as a new contact",
|
|
4085
|
+
category: "trigger",
|
|
4086
|
+
app: "HubSpot",
|
|
4087
|
+
icon: "UserGroupIcon",
|
|
4088
|
+
iconUrl: HUBSPOT_ICON,
|
|
4089
|
+
config: triggerConfig,
|
|
4090
|
+
defaultConfig: {
|
|
4091
|
+
events: [{ name: "contact.creation" }],
|
|
4092
|
+
additionalFields: {}
|
|
4093
|
+
},
|
|
4094
|
+
credentialTypes: [HUBSPOT_DEVELOPER_CREDENTIAL],
|
|
4095
|
+
ports: {
|
|
4096
|
+
in: [],
|
|
4097
|
+
out: ["out"]
|
|
4098
|
+
},
|
|
4099
|
+
subtitle: (config) => Array.isArray(config.events) && config.events.length > 0 ? config.events.map((event) => typeof event === "object" && event ? String(event.name) : "").filter(Boolean).join(", ") : void 0,
|
|
4100
|
+
run: ({ input }) => ({
|
|
4101
|
+
port: "out",
|
|
4102
|
+
data: input
|
|
4103
|
+
}),
|
|
4104
|
+
webhook: {
|
|
4105
|
+
async receive({ credential, request, url }) {
|
|
4106
|
+
if (request.method.toUpperCase() !== "POST") return {
|
|
4107
|
+
verdict: "ignore",
|
|
4108
|
+
response: {
|
|
4109
|
+
status: 200,
|
|
4110
|
+
body: { ok: true }
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4113
|
+
let secret;
|
|
4114
|
+
try {
|
|
4115
|
+
secret = developerAccess(credential).clientSecret;
|
|
4116
|
+
} catch {
|
|
4117
|
+
return {
|
|
4118
|
+
verdict: "forbidden",
|
|
4119
|
+
status: 401
|
|
4120
|
+
};
|
|
4121
|
+
}
|
|
4122
|
+
if (!verifyHubspotRequest(secret, request, url)) return {
|
|
4123
|
+
verdict: "forbidden",
|
|
4124
|
+
status: 401
|
|
4125
|
+
};
|
|
4126
|
+
return checkHubspotEvent(request.rawBody ?? "");
|
|
4127
|
+
},
|
|
4128
|
+
/**
|
|
4129
|
+
* Sets the webhook of the app. HubSpot allows one address for each app, so the trigger
|
|
4130
|
+
* removes the old settings and subscriptions first.
|
|
4131
|
+
*/
|
|
4132
|
+
async activate({ config: raw, credential, url, signal }) {
|
|
4133
|
+
const config = triggerConfig.parse(raw);
|
|
4134
|
+
const access = developerAccess(credential);
|
|
4135
|
+
const options = {
|
|
4136
|
+
signal,
|
|
4137
|
+
timeoutMs: TIMEOUT_MS
|
|
4138
|
+
};
|
|
4139
|
+
if (config.events.length === 0) throw new Error("You must define at least one event");
|
|
4140
|
+
for (const event of config.events) if (propertyEvents.includes(event.name) && !event.property?.trim()) throw new Error(`The event "${event.name}" needs a property name`);
|
|
4141
|
+
await clearApp(access, options);
|
|
4142
|
+
try {
|
|
4143
|
+
await callHubspot(withKey(access), {
|
|
4144
|
+
method: "PUT",
|
|
4145
|
+
path: `${base(access)}/settings`,
|
|
4146
|
+
body: {
|
|
4147
|
+
targetUrl: url,
|
|
4148
|
+
throttling: { maxConcurrentRequests: config.additionalFields.maxConcurrentRequests ?? 5 }
|
|
4149
|
+
}
|
|
4150
|
+
}, options);
|
|
4151
|
+
for (const event of config.events) await callHubspot(withKey(access), {
|
|
4152
|
+
method: "POST",
|
|
4153
|
+
path: `${base(access)}/subscriptions`,
|
|
4154
|
+
body: {
|
|
4155
|
+
eventType: event.name,
|
|
4156
|
+
active: true,
|
|
4157
|
+
...propertyEvents.includes(event.name) ? { propertyName: event.property?.trim() } : {}
|
|
4158
|
+
}
|
|
4159
|
+
}, options);
|
|
4160
|
+
} catch (error) {
|
|
4161
|
+
await clearApp(access, options).catch(() => void 0);
|
|
4162
|
+
throw error;
|
|
4163
|
+
}
|
|
4164
|
+
return { appId: access.appId };
|
|
4165
|
+
},
|
|
4166
|
+
/** Removes the subscriptions and the settings. */
|
|
4167
|
+
async deactivate({ credential, signal }) {
|
|
4168
|
+
await clearApp(developerAccess(credential), {
|
|
4169
|
+
signal,
|
|
4170
|
+
timeoutMs: TIMEOUT_MS
|
|
4171
|
+
});
|
|
4172
|
+
return null;
|
|
4173
|
+
}
|
|
4174
|
+
},
|
|
4175
|
+
webhookTest: { hint: "One HubSpot app allows one trigger. A test run sets the webhook of the app to the test address. Create a contact in HubSpot to send an event" }
|
|
4176
|
+
}), node_default];
|
|
4177
|
+
const credentialTypes = [
|
|
4178
|
+
hubspotTokenCredential,
|
|
4179
|
+
hubspotOAuth2Credential,
|
|
4180
|
+
hubspotDeveloperCredential
|
|
4181
|
+
];
|
|
4182
|
+
exports.credentialTypes = credentialTypes;
|
|
4183
|
+
exports.nodes = nodes;
|