Skip to content

Commit 8a07555

Browse files
committed
Merge branch 'master' into 18029-actionhubspot-cms-and-marketing-api
2 parents 2a4398a + af4fc64 commit 8a07555

File tree

58 files changed

+2746
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2746
-18
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "apify_oauth",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/apify_oauth",
3+
"version": "0.0.1",
4+
"description": "Pipedream Apify (OAuth) Components",
5+
"main": "apify_oauth.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"apify_oauth"
9+
],
10+
"homepage": "https://pipedream.com/apps/apify_oauth",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "booking_experts",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/booking_experts",
3+
"version": "0.0.1",
4+
"description": "Pipedream Booking Experts Components",
5+
"main": "booking_experts.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"booking_experts"
9+
],
10+
"homepage": "https://pipedream.com/apps/booking_experts",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "bridge_interactive_platform",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/bridge_interactive_platform",
3+
"version": "0.0.1",
4+
"description": "Pipedream Bridge Interactive Platform Components",
5+
"main": "bridge_interactive_platform.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"bridge_interactive_platform"
9+
],
10+
"homepage": "https://pipedream.com/apps/bridge_interactive_platform",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { DEFAULT_EMAIL_PROPERTIES } from "../../common/constants.mjs";
2+
import hubspot from "../../hubspot.app.mjs";
3+
4+
export default {
5+
key: "hubspot-get-associated-emails",
6+
name: "Get Associated Emails",
7+
description: "Retrieves emails associated with a specific object (contact, company, or deal). [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/search)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
hubspot,
12+
objectType: {
13+
propDefinition: [
14+
hubspot,
15+
"objectType",
16+
() => ({
17+
includeCustom: true,
18+
}),
19+
],
20+
label: "Associated Object Type",
21+
description: "The type of the object the emails are associated with",
22+
},
23+
objectId: {
24+
type: "string",
25+
label: "Object ID",
26+
description: "The ID of the object to get associated emails for",
27+
propDefinition: [
28+
hubspot,
29+
"objectIds",
30+
({ objectType }) => ({
31+
objectType,
32+
}),
33+
],
34+
},
35+
additionalProperties: {
36+
type: "string[]",
37+
label: "Additional Properties",
38+
description: "Additional properties to retrieve for the emails",
39+
optional: true,
40+
},
41+
limit: {
42+
type: "integer",
43+
label: "Limit",
44+
description: "Maximum number of emails to retrieve",
45+
optional: true,
46+
default: 20,
47+
min: 1,
48+
max: 100,
49+
},
50+
},
51+
async run({ $ }) {
52+
const properties = [
53+
...DEFAULT_EMAIL_PROPERTIES,
54+
...(this.additionalProperties || []),
55+
];
56+
57+
const {
58+
objectType, objectId, limit,
59+
} = this;
60+
61+
const { results } = await this.hubspot.getAssociations({
62+
$,
63+
objectType,
64+
objectId,
65+
toObjectType: "emails",
66+
params: {
67+
limit,
68+
},
69+
});
70+
71+
if (!results?.length > 0) {
72+
$.export("$summary", "No emails found with this association");
73+
return [];
74+
}
75+
76+
const emailIds = results.map((association) => ({
77+
id: association.toObjectId,
78+
}));
79+
80+
const { results: emails } = await this.hubspot.batchGetObjects({
81+
$,
82+
objectType: "emails",
83+
data: {
84+
properties,
85+
inputs: emailIds,
86+
},
87+
});
88+
89+
// Sort emails by timestamp in descending order (most recent first)
90+
emails?.sort((a, b) => {
91+
const timestampA = new Date(a.properties?.hs_timestamp || 0).getTime();
92+
const timestampB = new Date(b.properties?.hs_timestamp || 0).getTime();
93+
return timestampB - timestampA;
94+
}) || [];
95+
96+
const summary = `Successfully retrieved ${emails.length} email(s)`;
97+
98+
$.export("$summary", summary);
99+
100+
return emails;
101+
},
102+
};

components/hubspot/common/constants.mjs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ const DEFAULT_LEAD_PROPERTIES = [
173173
"hs_associated_company_name",
174174
];
175175

176+
const DEFAULT_EMAIL_PROPERTIES = [
177+
"hs_timestamp",
178+
"hs_email_direction",
179+
"hs_email_html",
180+
"hs_email_status",
181+
"hs_email_subject",
182+
"hs_email_text",
183+
"hs_attachment_ids",
184+
"hs_email_headers",
185+
];
186+
176187
const DEFAULT_MEETING_PROPERTIES = [
177188
"hs_timestamp",
178189
"hubspot_owner_id",
@@ -375,13 +386,17 @@ export {
375386
DEFAULT_COMPANY_PROPERTIES,
376387
DEFAULT_CONTACT_PROPERTIES,
377388
DEFAULT_DEAL_PROPERTIES,
389+
DEFAULT_EMAIL_PROPERTIES,
378390
DEFAULT_LEAD_PROPERTIES,
379391
DEFAULT_LIMIT,
380392
DEFAULT_LINE_ITEM_PROPERTIES,
381393
DEFAULT_MEETING_PROPERTIES,
382394
DEFAULT_PRODUCT_PROPERTIES,
383395
DEFAULT_TICKET_PROPERTIES,
384-
ENGAGEMENT_TYPE_OPTIONS, HUBSPOT_OWNER, LANGUAGE_OPTIONS, OBJECT_TYPE,
396+
ENGAGEMENT_TYPE_OPTIONS,
397+
HUBSPOT_OWNER,
398+
LANGUAGE_OPTIONS,
399+
OBJECT_TYPE,
385400
OBJECT_TYPES,
386401
SEARCHABLE_OBJECT_TYPES,
387402
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-ad",
5+
name: "Get Accumulation/Distribution Line (AD)",
6+
description: "Calculate Accumulation/Distribution Line technical indicator to measure volume flow and confirm price trends. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-ad)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
limit: {
24+
propDefinition: [
25+
mboum,
26+
"limit",
27+
],
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.mboum.getAD({
32+
$,
33+
params: {
34+
ticker: this.ticker,
35+
interval: this.interval,
36+
limit: this.limit,
37+
},
38+
});
39+
40+
$.export("$summary", `Successfully calculated A/D Line for ${this.ticker} on ${this.interval} intervals`);
41+
return response;
42+
},
43+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import mboum from "../../mboum.app.mjs";
2+
3+
export default {
4+
key: "mboum-get-adosc",
5+
name: "Get Accumulation/Distribution Oscillator (ADOSC)",
6+
description: "Calculate Accumulation/Distribution Oscillator technical indicator to measure the momentum of volume flow. [See the documentation](https://docs.mboum.com/#stocks-options-small-stylecolor-f8f2f2background-fa256fpadding-1px-4pxborder-radius-3pxhotsmall-GETapi-v1-markets-indicators-adosc)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mboum,
11+
ticker: {
12+
propDefinition: [
13+
mboum,
14+
"ticker",
15+
],
16+
},
17+
interval: {
18+
propDefinition: [
19+
mboum,
20+
"interval",
21+
],
22+
},
23+
seriesType: {
24+
propDefinition: [
25+
mboum,
26+
"seriesType",
27+
],
28+
},
29+
fastPeriod: {
30+
type: "integer",
31+
label: "Fast Period",
32+
description: "Fast period for ADOSC calculation",
33+
optional: true,
34+
},
35+
slowPeriod: {
36+
type: "integer",
37+
label: "Slow Period",
38+
description: "Slow period for ADOSC calculation",
39+
optional: true,
40+
},
41+
limit: {
42+
propDefinition: [
43+
mboum,
44+
"limit",
45+
],
46+
},
47+
},
48+
async run({ $ }) {
49+
const response = await this.mboum.getADOSC({
50+
$,
51+
params: {
52+
ticker: this.ticker,
53+
interval: this.interval,
54+
series_type: this.seriesType,
55+
fast_period: this.fastPeriod,
56+
slow_period: this.slowPeriod,
57+
limit: this.limit,
58+
},
59+
});
60+
61+
$.export("$summary", `Successfully calculated ADOSC(${this.fastPeriod},${this.slowPeriod}) for ${this.ticker} on ${this.interval} intervals`);
62+
return response;
63+
},
64+
};

0 commit comments

Comments
 (0)