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/hubspot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/hubspot",
"version": "1.2.0",
"version": "1.2.1",
"description": "Pipedream Hubspot Components",
"main": "hubspot.app.mjs",
"keywords": [
Expand Down
16 changes: 14 additions & 2 deletions components/hubspot/sources/new-deal-in-stage/new-deal-in-stage.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import common from "../common/common.mjs";
import { DEFAULT_LIMIT } from "../../common/constants.mjs";
import {
DEFAULT_LIMIT, DEFAULT_DEAL_PROPERTIES, API_PATH,
} from "../../common/constants.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "hubspot-new-deal-in-stage",
name: "New Deal In Stage",
description: "Emit new event for each new deal in a stage.",
version: "0.0.26",
version: "0.0.27",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -79,6 +81,7 @@ export default {
direction: "DESCENDING",
},
],
properties: DEFAULT_DEAL_PROPERTIES,
},
object: "deals",
};
Expand All @@ -97,6 +100,9 @@ export default {
for (const deal of results.results) {
const ts = await this.getTs(deal);
if (this.isRelevant(ts, after)) {
if (deal.properties.hubspot_owner_id) {
deal.properties.owner = await this.getOwner(deal.properties.hubspot_owner_id);
}
this.emitEvent(deal, ts);
if (ts > maxTs) {
maxTs = ts;
Expand All @@ -112,6 +118,12 @@ export default {
await this.processDeals(params, after);
}
},
getOwner(ownerId) {
return this.hubspot.makeRequest({
api: API_PATH.CRMV3,
endpoint: `/owners/${ownerId}`,
});
},
},
sampleEmit,
};
31 changes: 25 additions & 6 deletions components/hubspot/sources/new-deal-in-stage/test-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@ export default {
"id": "12388054600",
"properties": {
"amount": "1",
"closedate": "2024-06-24T16:37:59.812Z",
"closedate": "2025-05-07T17:08:33.843Z",
"createdate": "2023-03-03T15:43:17.850Z",
"dealname": "deal1",
"dealstage": "closedwon",
"hs_lastmodifieddate": "2024-06-24T16:38:00.660Z",
"dealname": "deal",
"dealtype": "existingbusiness",
"description": null,
"hs_forecast_amount": "1",
"hs_forecast_probability": null,
"hs_lastmodifieddate": "2025-05-07T17:08:39.305Z",
"hs_manual_forecast_category": null,
"hs_next_step": null,
"hs_object_id": "12388054600",
"pipeline": "default"
"hubspot_owner_id": "41488296",
"hubspot_team_id": null,
"num_associated_contacts": "0",
"owner": {
"id": "41488296",
"email": "",
"type": "PERSON",
"firstName": "",
"lastName": "",
"userId": 9555737,
"userIdIncludingInactive": 9555737,
"createdAt": "2019-12-18T20:08:52.952Z",
"updatedAt": "2025-02-04T16:53:50.082Z",
"archived": false
}
},
"createdAt": "2023-03-03T15:43:17.850Z",
"updatedAt": "2024-06-24T16:38:00.660Z",
"updatedAt": "2025-05-07T17:08:39.305Z",
"archived": false
}
14 changes: 2 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading