Skip to content

Commit fbc56f0

Browse files
Hubspot - limit on first run (#18290)
* limit number of returned contacts in the first run * package.json
1 parent e3d9866 commit fbc56f0

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

components/hubspot/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/hubspot",
3-
"version": "1.6.2",
3+
"version": "1.6.3",
44
"description": "Pipedream Hubspot Components",
55
"main": "hubspot.app.mjs",
66
"keywords": [

components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "hubspot-new-or-updated-contact",
1111
name: "New or Updated Contact",
1212
description: "Emit new event for each new or updated contact in Hubspot.",
13-
version: "0.0.14",
13+
version: "0.0.15",
1414
dedupe: "unique",
1515
type: "source",
1616
props: {
@@ -96,16 +96,21 @@ export default {
9696
}
9797
return true;
9898
},
99-
getParams() {
99+
getParams(after) {
100100
const { properties = [] } = this;
101-
return {
101+
const dateProperty = this.newOnly
102+
? "createdate"
103+
: "lastmodifieddate";
104+
const isFirstRun = !this.db.get("after");
105+
106+
const params = {
102107
data: {
103-
limit: DEFAULT_LIMIT,
108+
limit: isFirstRun
109+
? 100
110+
: DEFAULT_LIMIT,
104111
sorts: [
105112
{
106-
propertyName: this.newOnly
107-
? "createdate"
108-
: "lastmodifieddate",
113+
propertyName: dateProperty,
109114
direction: "DESCENDING",
110115
},
111116
],
@@ -116,6 +121,22 @@ export default {
116121
},
117122
object: "contacts",
118123
};
124+
125+
if (after) {
126+
params.data.filterGroups = [
127+
{
128+
filters: [
129+
{
130+
propertyName: dateProperty,
131+
operator: "GT",
132+
value: after,
133+
},
134+
],
135+
},
136+
];
137+
}
138+
139+
return params;
119140
},
120141
async processResults(after, params) {
121142
await this.searchCRM(params, after);

0 commit comments

Comments
 (0)