diff --git a/components/hubspot/package.json b/components/hubspot/package.json index ac21534642986..32767ff0acf5e 100644 --- a/components/hubspot/package.json +++ b/components/hubspot/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/hubspot", - "version": "1.6.2", + "version": "1.6.3", "description": "Pipedream Hubspot Components", "main": "hubspot.app.mjs", "keywords": [ diff --git a/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs b/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs index 8ed95cbb4f4bd..7f42462e73315 100644 --- a/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs +++ b/components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs @@ -10,7 +10,7 @@ export default { 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.14", + version: "0.0.15", dedupe: "unique", type: "source", props: { @@ -96,16 +96,21 @@ export default { } return true; }, - getParams() { + getParams(after) { const { properties = [] } = this; - return { + const dateProperty = this.newOnly + ? "createdate" + : "lastmodifieddate"; + const isFirstRun = !this.db.get("after"); + + const params = { data: { - limit: DEFAULT_LIMIT, + limit: isFirstRun + ? 100 + : DEFAULT_LIMIT, sorts: [ { - propertyName: this.newOnly - ? "createdate" - : "lastmodifieddate", + propertyName: dateProperty, direction: "DESCENDING", }, ], @@ -116,6 +121,22 @@ export default { }, object: "contacts", }; + + if (after) { + params.data.filterGroups = [ + { + filters: [ + { + propertyName: dateProperty, + operator: "GT", + value: after, + }, + ], + }, + ]; + } + + return params; }, async processResults(after, params) { await this.searchCRM(params, after);