Skip to content

Commit 1385475

Browse files
authored
Merging pull request #18194
* New contact added to list trigger * bump hubspot version * cr 1 * processing by lastMembershipTimestamp * enhance id with membershipTimestamp * remove data chunking * cr 2 * cr 2 * bump versions
1 parent 24c0cbe commit 1385475

File tree

80 files changed

+1125
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1125
-456
lines changed

components/apimage/apimage.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/hubspot/actions/add-contact-to-list/add-contact-to-list.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import hubspot from "../../hubspot.app.mjs";
33
export default {
44
key: "hubspot-add-contact-to-list",
55
name: "Add Contact to List",
6-
description: "Adds a contact to a specific static list. [See the documentation](https://legacydocs.hubspot.com/docs/methods/lists/add_contact_to_list)",
7-
version: "0.0.21",
6+
description:
7+
"Adds a contact to a specific static list. [See the documentation](https://legacydocs.hubspot.com/docs/methods/lists/add_contact_to_list)",
8+
version: "0.0.23",
89
type: "action",
910
props: {
1011
hubspot,
@@ -18,7 +19,8 @@ export default {
1819
],
1920
type: "string",
2021
label: "List",
21-
description: "The list which the contact will be added to. Only static lists are shown here, as dynamic lists cannot be manually added to.",
22+
description:
23+
"The list which the contact will be added to. Only static lists are shown here, as dynamic lists cannot be manually added to.",
2224
},
2325
contactEmail: {
2426
propDefinition: [
@@ -30,8 +32,7 @@ export default {
3032
},
3133
async run({ $ }) {
3234
const {
33-
list,
34-
contactEmail,
35+
list, contactEmail,
3536
} = this;
3637
const response = await this.hubspot.addContactsToList({
3738
$,

components/hubspot/actions/batch-create-companies/batch-create-companies.mjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ import hubspot from "../../hubspot.app.mjs";
66
export default {
77
key: "hubspot-batch-create-companies",
88
name: "Batch Create Companies",
9-
description: "Create a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fcreate)",
10-
version: "0.0.4",
9+
description:
10+
"Create a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fcreate)",
11+
version: "0.0.6",
1112
type: "action",
1213
props: {
1314
hubspot,
1415
inputs: {
1516
type: "string[]",
1617
label: "Inputs (Companies)",
17-
description: "Provide a **list of companies** to be created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fcreate) for more information. Example: `[ { \"properties\": { \"name\": \"CompanyName\"} } ]`",
18+
description:
19+
"Provide a **list of companies** to be created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fcreate) for more information. Example: `[ { \"properties\": { \"name\": \"CompanyName\"} } ]`",
1820
},
1921
},
2022
methods: {
@@ -35,12 +37,19 @@ export default {
3537
inputs: parseObject(this.inputs),
3638
},
3739
});
38-
$.export("$summary", `Created ${response.results.length} compan${response.results.length === 1
39-
? "y"
40-
: "ies"}`);
40+
$.export(
41+
"$summary",
42+
`Created ${response.results.length} compan${
43+
response.results.length === 1
44+
? "y"
45+
: "ies"
46+
}`,
47+
);
4148
return response;
4249
} catch (error) {
43-
const message = JSON.parse((JSON.parse(error.message).message).split(/:(.+)/)[1])[0].message;
50+
const message = JSON.parse(
51+
JSON.parse(error.message).message.split(/:(.+)/)[1],
52+
)[0].message;
4453
throw new ConfigurationError(message.split(/:(.+)/)[0]);
4554
}
4655
},

components/hubspot/actions/batch-create-or-update-contact/batch-create-or-update-contact.mjs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@ import hubspot from "../../hubspot.app.mjs";
33
export default {
44
key: "hubspot-batch-create-or-update-contact",
55
name: "Batch Create or Update Contact",
6-
description: "Create or update a batch of contacts by its ID or email. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
7-
version: "0.0.18",
6+
description:
7+
"Create or update a batch of contacts by its ID or email. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
8+
version: "0.0.20",
89
type: "action",
910
props: {
1011
hubspot,
1112
contacts: {
1213
label: "Contacts Array",
13-
description: "Provide a **list of contacts** to be created or updated. If the provided contact has the prop ID or if the provided email already exists, this action will attempt to update it.\n\n**Expected format for create:** `{ \"company\": \"Biglytics\", \"email\": \"[email protected]\", \"firstname\": \"Bryan\", \"lastname\": \"Cooper\", \"phone\": \"(877) 929-0687\", \"website\": \"biglytics.net\" }` \n\n**Expected format for update:** `{ \"id\": \"101\", \"company\": \"Biglytics\", \"email\": \"[email protected]\", \"firstname\": \"Bryan\", \"lastname\": \"Cooper\", \"phone\": \"(877) 929-0687\", \"website\": \"biglytics.net\" }`",
14+
description:
15+
"Provide a **list of contacts** to be created or updated. If the provided contact has the prop ID or if the provided email already exists, this action will attempt to update it.\n\n**Expected format for create:** `{ \"company\": \"Biglytics\", \"email\": \"[email protected]\", \"firstname\": \"Bryan\", \"lastname\": \"Cooper\", \"phone\": \"(877) 929-0687\", \"website\": \"biglytics.net\" }` \n\n**Expected format for update:** `{ \"id\": \"101\", \"company\": \"Biglytics\", \"email\": \"[email protected]\", \"firstname\": \"Bryan\", \"lastname\": \"Cooper\", \"phone\": \"(877) 929-0687\", \"website\": \"biglytics.net\" }`",
1416
type: "string[]",
1517
},
1618
},
1719
methods: {
1820
parseContactArray(contacts) {
19-
if (typeof (contacts) === "string") {
21+
if (typeof contacts === "string") {
2022
contacts = JSON.parse(contacts);
21-
}
22-
else if (Array.isArray(contacts) && contacts.length > 0 && typeof (contacts[0]) === "string") {
23+
} else if (
24+
Array.isArray(contacts) &&
25+
contacts.length > 0 &&
26+
typeof contacts[0] === "string"
27+
) {
2328
contacts = contacts.map((contact) => JSON.parse(contact));
2429
}
2530
return contacts;
@@ -40,15 +45,18 @@ export default {
4045
},
4146
});
4247
const updateEmails = results?.map(({ properties }) => properties.email);
43-
const insertProperties = contacts.filter(({ email }) => !updateEmails.includes(email))
48+
const insertProperties = contacts
49+
.filter(({ email }) => !updateEmails.includes(email))
4450
.map((properties) => ({
4551
properties,
4652
}));
4753
const updateProperties = [];
4854
for (const contact of results) {
4955
updateProperties.push({
5056
id: contact.id,
51-
properties: contacts.find(({ email }) => contact.properties.email === email),
57+
properties: contacts.find(
58+
({ email }) => contact.properties.email === email,
59+
),
5260
});
5361
}
5462
return {
@@ -62,9 +70,11 @@ export default {
6270

6371
const {
6472
insertProperties, updateProperties,
65-
} = await this.searchExistingContactProperties(contacts, $);
73+
} =
74+
await this.searchExistingContactProperties(contacts, $);
6675

67-
const updatePropertiesWithId = contacts.filter((contact) => (Object.prototype.hasOwnProperty.call(contact, "id")))
76+
const updatePropertiesWithId = contacts
77+
.filter((contact) => Object.prototype.hasOwnProperty.call(contact, "id"))
6878
.map(({
6979
id, ...properties
7080
}) => ({
@@ -90,7 +100,10 @@ export default {
90100
},
91101
});
92102

93-
$.export("$summary", `Successfully created ${insertProperties.length} and updated ${updateProperties.length} contacts`);
103+
$.export(
104+
"$summary",
105+
`Successfully created ${insertProperties.length} and updated ${updateProperties.length} contacts`,
106+
);
94107

95108
return response;
96109
},

components/hubspot/actions/batch-update-companies/batch-update-companies.mjs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ import hubspot from "../../hubspot.app.mjs";
66
export default {
77
key: "hubspot-batch-update-companies",
88
name: "Batch Update Companies",
9-
description: "Update a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupdate)",
10-
version: "0.0.4",
9+
description:
10+
"Update a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupdate)",
11+
version: "0.0.6",
1112
type: "action",
1213
props: {
1314
hubspot,
1415
inputs: {
1516
type: "string[]",
1617
label: "Inputs (Companies)",
17-
description: "Provide a **list of companies** to be updated. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupdate) for more information. Example: `[ { \"id\": \"123\", \"properties\": { \"name\": \"CompanyName\"} } ]`",
18+
description:
19+
"Provide a **list of companies** to be updated. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupdate) for more information. Example: `[ { \"id\": \"123\", \"properties\": { \"name\": \"CompanyName\"} } ]`",
1820
},
1921
},
2022
methods: {
@@ -35,12 +37,19 @@ export default {
3537
inputs: parseObject(this.inputs),
3638
},
3739
});
38-
$.export("$summary", `Updated ${response.results.length} compan${response.results.length === 1
39-
? "y"
40-
: "ies"}`);
40+
$.export(
41+
"$summary",
42+
`Updated ${response.results.length} compan${
43+
response.results.length === 1
44+
? "y"
45+
: "ies"
46+
}`,
47+
);
4148
return response;
4249
} catch (error) {
43-
const message = JSON.parse((JSON.parse(error.message).message).split(/:(.+)/)[1])[0].message;
50+
const message = JSON.parse(
51+
JSON.parse(error.message).message.split(/:(.+)/)[1],
52+
)[0].message;
4453
throw new ConfigurationError(message.split(/:(.+)/)[0]);
4554
}
4655
},

components/hubspot/actions/batch-upsert-companies/batch-upsert-companies.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ import hubspot from "../../hubspot.app.mjs";
66
export default {
77
key: "hubspot-batch-upsert-companies",
88
name: "Batch Upsert Companies",
9-
description: "Upsert a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupsert)",
10-
version: "0.0.4",
9+
description:
10+
"Upsert a batch of companies in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupsert)",
11+
version: "0.0.6",
1112
type: "action",
1213
props: {
1314
hubspot,
1415
infoAlert: {
1516
type: "alert",
1617
alertType: "info",
17-
content: "Create or update companies identified by a unique property value as specified by the `idProperty` query parameter. `idProperty` query param refers to a property whose values are unique for the object. To manage properties in Hubspot, navigate to your Settings -> Data Management -> Properties.",
18+
content:
19+
"Create or update companies identified by a unique property value as specified by the `idProperty` query parameter. `idProperty` query param refers to a property whose values are unique for the object. To manage properties in Hubspot, navigate to your Settings -> Data Management -> Properties.",
1820
},
1921
inputs: {
2022
type: "string[]",
2123
label: "Inputs (Companies)",
22-
description: "Provide a **list of companies** to be upserted. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupsert) for more information. Example: `[ { \"idProperty\": \"unique_property\", \"id\": \"123\", \"properties\": { \"name\": \"CompanyName\" } } ]`",
24+
description:
25+
"Provide a **list of companies** to be upserted. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupsert) for more information. Example: `[ { \"idProperty\": \"unique_property\", \"id\": \"123\", \"properties\": { \"name\": \"CompanyName\" } } ]`",
2326
},
2427
},
2528
methods: {
@@ -43,7 +46,9 @@ export default {
4346
$.export("$summary", `Upserted ${response.results.length} companies`);
4447
return response;
4548
} catch (error) {
46-
const message = JSON.parse((JSON.parse(error.message).message).split(/:(.+)/)[1])[0].message;
49+
const message = JSON.parse(
50+
JSON.parse(error.message).message.split(/:(.+)/)[1],
51+
)[0].message;
4752
throw new ConfigurationError(message.split(/:(.+)/)[0]);
4853
}
4954
},

components/hubspot/actions/clone-email/clone-email.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import hubspot from "../../hubspot.app.mjs";
44
export default {
55
key: "hubspot-clone-email",
66
name: "Clone Marketing Email",
7-
description: "Clone a marketing email in HubSpot. [See the documentation](https://developers.hubspot.com/docs/reference/api/marketing/emails/marketing-emails#post-%2Fmarketing%2Fv3%2Femails%2Fclone)",
8-
version: "0.0.2",
7+
description:
8+
"Clone a marketing email in HubSpot. [See the documentation](https://developers.hubspot.com/docs/reference/api/marketing/emails/marketing-emails#post-%2Fmarketing%2Fv3%2Femails%2Fclone)",
9+
version: "0.0.4",
910
type: "action",
1011
props: {
1112
hubspot,

components/hubspot/actions/clone-site-page/clone-site-page.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import hubspot from "../../hubspot.app.mjs";
33
export default {
44
key: "hubspot-clone-site-page",
55
name: "Clone Site Page",
6-
description: "Clone a site page in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/cms/pages#post-%2Fcms%2Fv3%2Fpages%2Fsite-pages%2Fclone)",
7-
version: "0.0.2",
6+
description:
7+
"Clone a site page in Hubspot. [See the documentation](https://developers.hubspot.com/docs/reference/api/cms/pages#post-%2Fcms%2Fv3%2Fpages%2Fsite-pages%2Fclone)",
8+
version: "0.0.4",
89
type: "action",
910
props: {
1011
hubspot,
@@ -29,7 +30,10 @@ export default {
2930
},
3031
});
3132

32-
$.export("$summary", `Successfully cloned site page with ID: ${response.id}`);
33+
$.export(
34+
"$summary",
35+
`Successfully cloned site page with ID: ${response.id}`,
36+
);
3337

3438
return response;
3539
},

components/hubspot/actions/create-associations/create-associations.mjs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import hubspot from "../../hubspot.app.mjs";
44
export default {
55
key: "hubspot-create-associations",
66
name: "Create Associations",
7-
description: "Create associations between objects. [See the documentation](https://developers.hubspot.com/docs/api/crm/associations#endpoint?spec=POST-/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create)",
8-
version: "1.0.7",
7+
description:
8+
"Create associations between objects. [See the documentation](https://developers.hubspot.com/docs/api/crm/associations#endpoint?spec=POST-/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create)",
9+
version: "1.0.9",
910
type: "action",
1011
props: {
1112
hubspot,
@@ -41,7 +42,8 @@ export default {
4142
}),
4243
],
4344
label: "To Object Type",
44-
description: "Type of the objects the from object is being associated with",
45+
description:
46+
"Type of the objects the from object is being associated with",
4547
},
4648
associationType: {
4749
propDefinition: [
@@ -62,30 +64,34 @@ export default {
6264
}),
6365
],
6466
label: "To Objects",
65-
description: "Id's of the objects the from object is being associated with",
67+
description:
68+
"Id's of the objects the from object is being associated with",
6669
},
6770
},
6871
methods: {
6972
async getAssociationCategory({
70-
$, fromObjectType, toObjectType, associationType,
73+
$,
74+
fromObjectType,
75+
toObjectType,
76+
associationType,
7177
}) {
7278
const { results } = await this.hubspot.getAssociationTypes({
7379
$,
7480
fromObjectType,
7581
toObjectType,
7682
associationType,
7783
});
78-
const association = results.find(({ typeId }) => typeId === this.associationType);
84+
const association = results.find(
85+
({ typeId }) => typeId === this.associationType,
86+
);
7987
return association.category;
8088
},
8189
},
8290
async run({ $ }) {
8391
const {
84-
fromObjectType,
85-
fromObjectId,
86-
toObjectType,
87-
associationType,
88-
} = this;
92+
fromObjectType, fromObjectId, toObjectType, associationType,
93+
} =
94+
this;
8995
let toObjectIds;
9096
if (Array.isArray(this.toObjectIds)) {
9197
toObjectIds = this.toObjectIds;
@@ -125,9 +131,12 @@ export default {
125131
},
126132
});
127133
const l = response.results.length;
128-
$.export("$summary", `Successfully created ${l} association${l === 1
129-
? ""
130-
: "s"}`);
134+
$.export(
135+
"$summary",
136+
`Successfully created ${l} association${l === 1
137+
? ""
138+
: "s"}`,
139+
);
131140
return response;
132141
},
133142
};

0 commit comments

Comments
 (0)