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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/hubspot/hubspot.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,5 +1614,37 @@ export default {
...opts,
});
},
async getContactWithAllProperties({
contactId, ...opts
}) {
const properties = await this.getContactProperties();
const allPropertyNames = properties.map((prop) => prop.name);

return this.makeRequest({
api: API_PATH.CRMV3,
endpoint: `/objects/contacts/${contactId}`,
params: {
properties: allPropertyNames.join(","),
},
...opts,
});
},
Comment on lines +1617 to +1631
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one being called anywhere? It seems only the batch method is being used

async batchGetContactsWithAllProperties({
contactIds, ...opts
}) {
const properties = await this.getContactProperties();
const allPropertyNames = properties.map((prop) => prop.name);

return this.batchGetObjects({
objectType: "contacts",
data: {
inputs: contactIds.map((id) => ({
id,
})),
properties: allPropertyNames,
},
...opts,
});
},
},
};
2 changes: 1 addition & 1 deletion components/hubspot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/hubspot",
"version": "1.7.12",
"version": "1.7.14",
"description": "Pipedream Hubspot Components",
"main": "hubspot.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export default {
...common,
key: "hubspot-delete-blog-article",
name: "Deleted Blog Posts",

Check warning on line 7 in components/hubspot/sources/delete-blog-article/delete-blog-article.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event for each deleted blog post.",
version: "0.0.34",
version: "0.0.35",
dedupe: "unique",
type: "source",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-company-property-change",
name: "New Company Property Change",
description: "Emit new event when a specified property is provided or updated on a company. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies)",
version: "0.0.27",
version: "0.0.28",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
name: "New Contact Added to List",
description:
"Emit new event when a contact is added to a HubSpot list. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/lists#get-%2Fcrm%2Fv3%2Flists%2F%7Blistid%7D%2Fmemberships%2Fjoin-order)",
version: "0.0.6",
version: "0.0.7",
type: "source",
dedupe: "unique",
props: {
...common.props,
info: {

Check warning on line 20 in components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.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

Check warning on line 20 in components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.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
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_CONTACT_PROPERTIES.join(", ")}\``,
Expand Down Expand Up @@ -55,6 +55,14 @@
label: "Additional contact properties to retrieve",
optional: true,
},
fetchAllProperties: {
type: "boolean",
label: "Fetch all contact properties",
description:
"When enabled, fetches all available contact properties instead of just default and selected properties. This provides complete contact data but may increase API usage.",
optional: true,
default: false,
},
},
methods: {
...common.methods,
Expand Down Expand Up @@ -95,6 +103,40 @@
async getContactDetails(contactIds) {
if (!contactIds.length) return {};

if (this.fetchAllProperties) {
const chunks = [];
const chunkSize = 100;
for (let i = 0; i < contactIds.length; i += chunkSize) {
chunks.push(contactIds.slice(i, i + chunkSize));
}

const contactMap = {};

try {
for (const chunk of chunks) {
try {
const { results } = await this.hubspot.batchGetContactsWithAllProperties({
contactIds: chunk,
});

results.forEach((contact) => {
contactMap[contact.id] = contact;
});
} catch (error) {
console.warn(
`Error fetching contact details for chunk of ${chunk.length} contacts:`,
error,
);
}
}

return contactMap;
} catch (error) {
console.warn("Error processing contact details:", error);
return {};
}
}

const { properties = [] } = this;
const allProperties = [
...DEFAULT_CONTACT_PROPERTIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Contact Property Change",
description:
"Emit new event when a specified property is provided or updated on a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
version: "0.0.30",
version: "0.0.31",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -38,6 +38,14 @@ export default {
optional: true,
default: true,
},
fetchAllProperties: {
type: "boolean",
label: "Fetch all contact properties",
description:
"When enabled, fetches all available contact properties instead of just the watched property. This provides complete contact data but may increase API usage.",
optional: true,
default: false,
},
},
methods: {
...common.methods,
Expand Down Expand Up @@ -111,7 +119,38 @@ export default {
}
return params;
},
batchGetContacts(inputs) {
async batchGetContacts(inputs) {
if (this.fetchAllProperties) {
const { results } = await this.hubspot.batchGetContactsWithAllProperties({
contactIds: inputs.map((input) => input.id),
});

const { results: contactsWithHistory } = await this.hubspot.batchGetObjects({
objectType: "contacts",
data: {
properties: [
this.property,
],
propertiesWithHistory: [
this.property,
],
inputs,
},
});

const mergedResults = results.map((contact) => {
const contactWithHistory = contactsWithHistory.find((c) => c.id === contact.id);
return {
...contact,
propertiesWithHistory: contactWithHistory?.propertiesWithHistory || {},
};
});

return {
results: mergedResults,
};
}

return this.hubspot.batchGetObjects({
objectType: "contacts",
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Custom Object Property Change",
description:
"Emit new event when a specified property is provided or updated on a custom object.",
version: "0.0.19",
version: "0.0.20",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
key: "hubspot-new-deal-in-stage",
name: "New Deal In Stage",
description: "Emit new event for each new deal in a stage.",
version: "0.1.0",
version: "0.1.1",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-deal-property-change",
name: "New Deal Property Change",
description: "Emit new event when a specified property is provided or updated on a deal. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals)",
version: "0.0.28",
version: "0.0.30",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-email-event",
name: "New Email Event",
description: "Emit new event for each new Hubspot email event.",
version: "0.0.37",
version: "0.0.38",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-new-email-subscriptions-timeline",
name: "New Email Subscriptions Timeline",
description: "Emit new event when a new email timeline subscription is added for the portal.",
version: "0.0.34",
version: "0.0.35",
dedupe: "unique",
type: "source",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-engagement",
name: "New Engagement",
description: "Emit new event for each new engagement created. This action returns a maximum of 5000 records at a time, make sure you set a correct time range so you don't miss any events",
version: "0.0.39",
version: "0.0.40",
dedupe: "unique",
type: "source",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-event/new-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-event",
name: "New Events",
description: "Emit new event for each new Hubspot event. Note: Only available for Marketing Hub Enterprise, Sales Hub Enterprise, Service Hub Enterprise, or CMS Hub Enterprise accounts",
version: "0.0.38",
version: "0.0.39",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-new-form-submission",
name: "New Form Submission",
description: "Emit new event for each new submission of a form.",
version: "0.0.39",
version: "0.0.40",
dedupe: "unique",
type: "source",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-note/new-note.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-note",
name: "New Note Created",
description: "Emit new event for each new note created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/notes#get-%2Fcrm%2Fv3%2Fobjects%2Fnotes)",
version: "1.0.15",
version: "1.0.16",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-blog-article",
name: "New or Updated Blog Post",
description: "Emit new event for each new or updated blog post in Hubspot.",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-company",
name: "New or Updated Company",
description: "Emit new event for each new or updated company in Hubspot.",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-company/new-or-updated-company.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

Check warning on line 18 in components/hubspot/sources/new-or-updated-company/new-or-updated-company.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
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_COMPANY_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-contact",
name: "New or Updated Contact",
description: "Emit new event for each new or updated contact in Hubspot.",
version: "0.0.22",
version: "0.0.23",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.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

Check warning on line 18 in components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.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
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_CONTACT_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-crm-object",
name: "New or Updated CRM Object",
description: "Emit new event each time a CRM Object of the specified object type is updated.",
version: "0.0.34",
version: "0.0.35",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-custom-object",
name: "New or Updated Custom Object",
description: "Emit new event each time a Custom Object of the specified schema is updated.",
version: "0.0.23",
version: "0.0.24",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-deal",
name: "New or Updated Deal",
description: "Emit new event for each new or updated deal in Hubspot",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.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

Check warning on line 18 in components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.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
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_DEAL_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-line-item",
name: "New or Updated Line Item",
description: "Emit new event for each new line item added or updated in Hubspot.",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.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
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_LINE_ITEM_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "hubspot-new-or-updated-product",
name: "New or Updated Product",
description: "Emit new event for each new or updated product in Hubspot.",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Social Media Message",
description:
"Emit new event when a message is posted from HubSpot to the specified social media channel. Note: Only available for Marketing Hub Enterprise accounts",
version: "0.0.34",
version: "0.0.35",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-task/new-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
name: "New Task Created",
description:
"Emit new event for each new task created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/tasks#get-%2Fcrm%2Fv3%2Fobjects%2Ftasks)",
version: "1.0.15",
version: "1.0.16",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Ticket Property Change",
description:
"Emit new event when a specified property is provided or updated on a ticket. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)",
version: "0.0.28",
version: "0.0.29",
dedupe: "unique",
type: "source",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-ticket/new-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "hubspot-new-ticket",
name: "New Ticket",
description: "Emit new event for each new ticket created.",
version: "0.0.34",
version: "0.0.35",
dedupe: "unique",
type: "source",
props: {
Expand Down
Loading