Skip to content

Commit fb2b936

Browse files
committed
[ACTION] Hubspot Meetings
1 parent f15cf0d commit fb2b936

File tree

52 files changed

+530
-59
lines changed

Some content is hidden

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

52 files changed

+530
-59
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "hubspot-add-contact-to-list",
55
name: "Add Contact to List",
66
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.15",
7+
version: "0.0.16",
88
type: "action",
99
props: {
1010
hubspot,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "hubspot-batch-create-or-update-contact",
55
name: "Batch Create or Update Contact",
66
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.12",
7+
version: "0.0.13",
88
type: "action",
99
props: {
1010
hubspot,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "hubspot-create-associations",
66
name: "Create Associations",
77
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.1",
8+
version: "1.0.2",
99
type: "action",
1010
props: {
1111
hubspot,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "hubspot-create-communication",
99
name: "Create Communication",
1010
description: "Create a WhatsApp, LinkedIn, or SMS message. [See the documentation](https://developers.hubspot.com/beta-docs/reference/api/crm/engagements/communications/v3#post-%2Fcrm%2Fv3%2Fobjects%2Fcommunications)",
11-
version: "0.0.8",
11+
version: "0.0.9",
1212
type: "action",
1313
props: {
1414
...appProp.props,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "hubspot-create-company",
77
name: "Create Company",
88
description: "Create a company in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies#endpoint?spec=POST-/crm/v3/objects/companies)",
9-
version: "0.0.19",
9+
version: "0.0.20",
1010
type: "action",
1111
methods: {
1212
...common.methods,

components/hubspot/actions/create-custom-object/create-custom-object.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "hubspot-create-custom-object",
77
name: "Create Custom Object",
88
description: "Create a new custom object in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/custom-objects#create-a-custom-object)",
9-
version: "1.0.1",
9+
version: "1.0.2",
1010
type: "action",
1111
props: {
1212
...appProp.props,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "hubspot-create-deal",
77
name: "Create Deal",
88
description: "Create a deal in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals#endpoint?spec=POST-/crm/v3/objects/deals)",
9-
version: "0.0.19",
9+
version: "0.0.20",
1010
type: "action",
1111
props: {
1212
...common.props,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "hubspot-create-engagement",
1010
name: "Create Engagement",
1111
description: "Create a new engagement for a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/engagements)",
12-
version: "0.0.18",
12+
version: "0.0.19",
1313
type: "action",
1414
props: {
1515
...common.props,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
key: "hubspot-create-lead",
1010
name: "Create Lead",
1111
description: "Create a lead in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/leads#create-leads)",
12-
version: "0.0.7",
12+
version: "0.0.8",
1313
type: "action",
1414
props: {
1515
...appProp.props,
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/* eslint-disable no-unused-vars */
2+
import common from "../common/common-create.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
4+
import {
5+
ASSOCIATION_CATEGORY, OBJECT_TYPE,
6+
} from "../../common/constants.mjs";
7+
8+
export default {
9+
...common,
10+
key: "hubspot-create-meeting",
11+
name: "Create Meeting",
12+
description: "Creates a new meeting with optional associations to other objects. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/meetings#post-%2Fcrm%2Fv3%2Fobjects%2Fmeetings)",
13+
version: "0.0.1",
14+
type: "action",
15+
props: {
16+
...common.props,
17+
toObjectType: {
18+
propDefinition: [
19+
common.props.hubspot,
20+
"objectType",
21+
],
22+
label: "Associated Object Type",
23+
description: "Type of object the meeting is being associated with",
24+
},
25+
toObjectId: {
26+
propDefinition: [
27+
common.props.hubspot,
28+
"objectId",
29+
(c) => ({
30+
objectType: c.toObjectType,
31+
}),
32+
],
33+
label: "Associated Object",
34+
description: "ID of object the meeting is being associated with",
35+
optional: true,
36+
},
37+
associationType: {
38+
propDefinition: [
39+
common.props.hubspot,
40+
"associationType",
41+
(c) => ({
42+
fromObjectType: "meetings",
43+
toObjectType: c.toObjectType,
44+
}),
45+
],
46+
description: "A unique identifier to indicate the association type between the meeting and the other object",
47+
optional: true,
48+
},
49+
objectProperties: {
50+
type: "object",
51+
label: "Meeting Properties",
52+
description: "Enter the meeting properties as a JSON object. Required properties: hs_meeting_title, hs_meeting_body, hs_meeting_start_time, hs_meeting_end_time. Optional: hs_meeting_status",
53+
},
54+
},
55+
methods: {
56+
...common.methods,
57+
getObjectType() {
58+
return OBJECT_TYPE.MEETING;
59+
},
60+
isRelevantProperty(property) {
61+
return common.methods.isRelevantProperty(property);
62+
},
63+
createMeeting(properties, associations, $) {
64+
return this.hubspot.createMeeting({
65+
data: {
66+
properties,
67+
associations,
68+
},
69+
$,
70+
});
71+
},
72+
},
73+
async run({ $ }) {
74+
const {
75+
hubspot,
76+
toObjectType,
77+
toObjectId,
78+
associationType,
79+
objectProperties,
80+
...otherProperties
81+
} = this;
82+
83+
if ((toObjectId && !associationType) || (!toObjectId && associationType)) {
84+
throw new ConfigurationError("Both `toObjectId` and `associationType` must be entered");
85+
}
86+
87+
const properties = objectProperties
88+
? typeof objectProperties === "string"
89+
? JSON.parse(objectProperties)
90+
: objectProperties
91+
: otherProperties;
92+
93+
const associations = toObjectId
94+
? [
95+
{
96+
to: {
97+
id: toObjectId,
98+
},
99+
types: [
100+
{
101+
associationTypeId: associationType,
102+
associationCategory: ASSOCIATION_CATEGORY.HUBSPOT_DEFINED,
103+
},
104+
],
105+
},
106+
]
107+
: undefined;
108+
109+
const meeting = await this.createMeeting(properties, associations, $);
110+
111+
$.export("$summary", `Successfully created meeting "${properties.hs_meeting_title}"`);
112+
113+
return meeting;
114+
},
115+
};

0 commit comments

Comments
 (0)