Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-add-contact-to-list",
name: "Add Contact to List",
description: "Adds a contact to a specific static list. [See the documentation](https://legacydocs.hubspot.com/docs/methods/lists/add_contact_to_list)",
version: "0.0.15",
version: "0.0.16",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-batch-create-or-update-contact",
name: "Batch Create or Update Contact",
description: "Create or update a batch of contacts by its ID or email. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
version: "0.0.12",
version: "0.0.13",
type: "action",
props: {
hubspot,
Expand Down
16 changes: 10 additions & 6 deletions components/hubspot/actions/common/common-get-object.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
DEFAULT_TICKET_PROPERTIES,
DEFAULT_PRODUCT_PROPERTIES,
DEFAULT_LINE_ITEM_PROPERTIES,
DEFAULT_MEETING_PROPERTIES,
OBJECT_TYPE,
} from "../../common/constants.mjs";

export default {
Expand All @@ -20,7 +22,7 @@
},
reloadProps: true,
},
info: {

Check warning on line 25 in components/hubspot/actions/common/common-get-object.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 25 in components/hubspot/actions/common/common-get-object.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "",
Expand Down Expand Up @@ -62,18 +64,20 @@
throw new Error("getObjectType is not implemented");
},
getDefaultProperties(objectType) {
if (objectType === "contact") {
if (objectType === OBJECT_TYPE.CONTACT) {
return DEFAULT_CONTACT_PROPERTIES;
} else if (objectType === "company") {
} else if (objectType === OBJECT_TYPE.COMPANY) {
return DEFAULT_COMPANY_PROPERTIES;
} else if (objectType === "deal") {
} else if (objectType === OBJECT_TYPE.DEAL) {
return DEFAULT_DEAL_PROPERTIES;
} else if (objectType === "ticket") {
} else if (objectType === OBJECT_TYPE.TICKET) {
return DEFAULT_TICKET_PROPERTIES;
} else if (objectType === "product") {
} else if (objectType === OBJECT_TYPE.PRODUCT) {
return DEFAULT_PRODUCT_PROPERTIES;
} else if (objectType === "line_item") {
} else if (objectType === OBJECT_TYPE.LINE_ITEM) {
return DEFAULT_LINE_ITEM_PROPERTIES;
} else if (objectType === OBJECT_TYPE.MEETING) {
return DEFAULT_MEETING_PROPERTIES;
} else {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "hubspot-create-associations",
name: "Create Associations",
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)",
version: "1.0.1",
version: "1.0.2",
type: "action",
props: {
hubspot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-create-communication",
name: "Create Communication",
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)",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
...appProp.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-company",
name: "Create Company",
description: "Create a company in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies#endpoint?spec=POST-/crm/v3/objects/companies)",
version: "0.0.19",
version: "0.0.20",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-custom-object",
name: "Create Custom Object",
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)",
version: "1.0.1",
version: "1.0.2",
type: "action",
props: {
...appProp.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-deal/create-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-deal",
name: "Create Deal",
description: "Create a deal in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals#endpoint?spec=POST-/crm/v3/objects/deals)",
version: "0.0.19",
version: "0.0.20",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "hubspot-create-engagement",
name: "Create Engagement",
description: "Create a new engagement for a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/engagements)",
version: "0.0.18",
version: "0.0.19",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-lead/create-lead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "hubspot-create-lead",
name: "Create Lead",
description: "Create a lead in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/leads#create-leads)",
version: "0.0.7",
version: "0.0.8",
type: "action",
props: {
...appProp.props,
Expand Down
115 changes: 115 additions & 0 deletions components/hubspot/actions/create-meeting/create-meeting.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/* eslint-disable no-unused-vars */
import common from "../common/common-create.mjs";
import { ConfigurationError } from "@pipedream/platform";
import {
ASSOCIATION_CATEGORY, OBJECT_TYPE,
} from "../../common/constants.mjs";

export default {
...common,
key: "hubspot-create-meeting",
name: "Create Meeting",
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)",
version: "0.0.1",
type: "action",
props: {
...common.props,
toObjectType: {
propDefinition: [
common.props.hubspot,
"objectType",
],
label: "Associated Object Type",
description: "Type of object the meeting is being associated with",
},
toObjectId: {
propDefinition: [
common.props.hubspot,
"objectId",
(c) => ({
objectType: c.toObjectType,
}),
],
label: "Associated Object",
description: "ID of object the meeting is being associated with",
optional: true,
},
associationType: {
propDefinition: [
common.props.hubspot,
"associationType",
(c) => ({
fromObjectType: "meetings",
toObjectType: c.toObjectType,
}),
],
description: "A unique identifier to indicate the association type between the meeting and the other object",
optional: true,
},
objectProperties: {
type: "object",
label: "Meeting Properties",
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",
},
},
methods: {
...common.methods,
getObjectType() {
return OBJECT_TYPE.MEETING;
},
isRelevantProperty(property) {
return common.methods.isRelevantProperty(property);
},
createMeeting(properties, associations, $) {
return this.hubspot.createMeeting({
data: {
properties,
associations,
},
$,
});
},
},
async run({ $ }) {
const {
hubspot,
toObjectType,
toObjectId,
associationType,
objectProperties,
...otherProperties
} = this;

if ((toObjectId && !associationType) || (!toObjectId && associationType)) {
throw new ConfigurationError("Both `toObjectId` and `associationType` must be entered");
}

const properties = objectProperties
? typeof objectProperties === "string"
? JSON.parse(objectProperties)
: objectProperties
: otherProperties;

const associations = toObjectId
? [
{
to: {
id: toObjectId,
},
types: [
{
associationTypeId: associationType,
associationCategory: ASSOCIATION_CATEGORY.HUBSPOT_DEFINED,
},
],
},
]
: undefined;

const meeting = await this.createMeeting(properties, associations, $);

$.export("$summary", `Successfully created meeting "${properties.hs_meeting_title}"`);

return meeting;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-or-update-contact",
name: "Create or Update Contact",
description: "Create or update a contact in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts#endpoint?spec=POST-/crm/v3/objects/contacts)",
version: "0.0.17",
version: "0.0.18",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-ticket",
name: "Create Ticket",
description: "Create a ticket in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)",
version: "0.0.10",
version: "0.0.11",
type: "action",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "hubspot-enroll-contact-into-workflow",
name: "Enroll Contact Into Workflow",
description: "Add a contact to a workflow. Note: The Workflows API currently only supports contact-based workflows and is only available for Marketing Hub Enterprise accounts. [See the documentation](https://legacydocs.hubspot.com/docs/methods/workflows/add_contact)",
version: "0.0.15",
version: "0.0.16",
type: "action",
props: {
hubspot,
Expand Down
Loading
Loading