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
2 changes: 1 addition & 1 deletion components/cockpit/cockpit.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
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.7",
"version": "1.7.8",
"description": "Pipedream Hubspot Components",
"main": "hubspot.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export default {
...common,
key: "hubspot-new-contact-property-change",
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.29",
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",
dedupe: "unique",
type: "source",
props: {
Expand All @@ -21,6 +22,22 @@ export default {
return properties.map((property) => property.name);
},
},
skipFirstRun: {
type: "boolean",
label: "Skip existing contacts when first activated",
description:
"When enabled, this trigger will ignore all existing contacts and only watch for property changes that happen after activation. When disabled, it will process all existing contacts on first run.",
optional: true,
default: false,
},
requirePropertyHistory: {
type: "boolean",
label: "Only trigger on actual property changes",
description:
"When enabled, only fires when a contact property is actually modified. When disabled, may also trigger for newly created contacts even if the property wasn't changed.",
optional: true,
default: true,
},
},
methods: {
...common.methods,
Expand All @@ -43,6 +60,20 @@ export default {
};
},
isRelevant(contact, updatedAfter) {
if (this.requirePropertyHistory) {
const history = contact.propertiesWithHistory?.[this.property];
if (!history || history.length === 0) {
return false;
}

const propertyTimestamp = history[0].timestamp;
const createDate = contact.properties.createdate;

if (propertyTimestamp === createDate) {
return false;
}
}

return this.getTs(contact) > updatedAfter;
},
getParams(after) {
Expand Down Expand Up @@ -95,6 +126,11 @@ export default {
});
},
async processResults(after, params) {
if (this.skipFirstRun && !after) {
this._setAfter(Date.now());
return;
}

const properties = await this.hubspot.getContactProperties();
const propertyNames = properties.map((property) => property.name);
if (!propertyNames.includes(this.property)) {
Expand Down
2 changes: 1 addition & 1 deletion components/kobotoolbox/kobotoolbox.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/misp/misp.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/signl4/signl4.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Loading
Loading