Skip to content

Commit b6ab84b

Browse files
committed
[Components] Hep Scout - Added new triggers
1 parent e12786e commit b6ab84b

File tree

12 files changed

+247
-12
lines changed

12 files changed

+247
-12
lines changed

components/help_scout/package.json

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

components/help_scout/sources/common/base.mjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ export default {
3232
getExtraData() {
3333
return {};
3434
},
35+
getMetadata(body) {
36+
const ts = Date.parse(new Date());
37+
return {
38+
id: `${body.id}-${ts}`,
39+
summary: this.getSummary(body),
40+
ts: ts,
41+
};
42+
},
3543
},
3644
hooks: {
3745
async activate() {
@@ -70,12 +78,7 @@ export default {
7078
}
7179
}
7280

73-
const ts = Date.parse(new Date());
74-
this.$emit(body, {
75-
id: body.id,
76-
summary: this.getSummary(body),
77-
ts: ts,
78-
});
81+
this.$emit(body, this.getMetadata(body));
7982

8083
return this.http.respond({
8184
status: 200,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "help_scout-new-agent-reply-instant",
6+
name: "New Agent Reply (Instant)",
7+
description: "Emit new event when an agent replies to a conversation.",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
methods: {
12+
...common.methods,
13+
getEventType() {
14+
return [
15+
"convo.agent.reply.created",
16+
];
17+
},
18+
getSummary(body) {
19+
const agentName = body.assignee
20+
? `${body.assignee.firstName} ${body.assignee.lastName}`
21+
: "Agent";
22+
return `New agent reply from ${agentName} in conversation: ${body.subject}`;
23+
},
24+
},
25+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
export default {
2+
"id": 1755285700,
3+
"type": "reply",
4+
"folderId": 98775,
5+
"mailboxId": 76544,
6+
"number": 2571,
7+
"status": "active",
8+
"state": "published",
9+
"subject": "Need help with my account",
10+
"preview": "Hello John, I've reviewed the additional information you sent...",
11+
"createdAt": "2025-04-24T13:45:23Z",
12+
"modifiedAt": "2025-04-24T14:35:45Z",
13+
"closedAt": null,
14+
"closedBy": null,
15+
"threadCount": 5,
16+
"source": {
17+
"type": "email",
18+
"via": "agent"
19+
},
20+
"tags": [
21+
"account",
22+
"customer"
23+
],
24+
"primaryCustomer": {
25+
"id": 298473,
26+
"email": "[email protected]",
27+
"firstName": "John",
28+
"lastName": "Doe"
29+
},
30+
"assignee": {
31+
"id": 149254,
32+
"email": "[email protected]",
33+
"firstName": "Support",
34+
"lastName": "Agent"
35+
},
36+
"cc": [],
37+
"bcc": [],
38+
"threads": [
39+
{
40+
"id": 98254745,
41+
"type": "reply",
42+
"status": "active",
43+
"state": "published",
44+
"author": {
45+
"id": 149254,
46+
"email": "[email protected]",
47+
"type": "user",
48+
"firstName": "Support",
49+
"lastName": "Agent"
50+
},
51+
"text": "Hello John, I've reviewed the additional information you sent and have updated your account accordingly. Your account settings should now be working as expected. Let me know if you have any other questions!",
52+
"createdAt": "2025-04-24T14:35:45Z"
53+
}
54+
]
55+
};

components/help_scout/sources/new-conversation-assigned-instant/new-conversation-assigned-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "help_scout-new-conversation-assigned-instant",
77
name: "New Conversation Assigned (Instant)",
88
description: "Emit new event when a conversation is assigned to an agent. [See the documentation](https://developer.helpscout.com/)",
9-
version: "0.0.1",
9+
version: "0.0.2",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {

components/help_scout/sources/new-conversation-created-instant/new-conversation-created-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "help_scout-new-conversation-created-instant",
77
name: "New Conversation Created (Instant)",
88
description: "Emit new event when a new conversation is created.",
9-
version: "0.0.1",
9+
version: "0.0.2",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {

components/help_scout/sources/new-customer-instant/new-customer-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "help_scout-new-customer-instant",
77
name: "New Customer Added (Instant)",
88
description: "Emit new event when a new customer is added.",
9-
version: "0.0.1",
9+
version: "0.0.2",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "help_scout-new-customer-reply-instant",
6+
name: "New Customer Reply (Instant)",
7+
description: "Emit new event when a customer replies to a conversation.",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
methods: {
12+
...common.methods,
13+
getEventType() {
14+
return [
15+
"convo.customer.reply.created",
16+
];
17+
},
18+
getSummary(body) {
19+
return `New customer reply from ${body.primaryCustomer?.email} in conversation: ${body.subject}`;
20+
},
21+
},
22+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
export default {
2+
"id": 1755285686,
3+
"type": "customer",
4+
"folderId": 98775,
5+
"mailboxId": 76544,
6+
"number": 2571,
7+
"status": "active",
8+
"state": "published",
9+
"subject": "Need help with my account",
10+
"preview": "Hi, I've submitted additional information as requested...",
11+
"createdAt": "2025-04-24T13:45:23Z",
12+
"modifiedAt": "2025-04-24T14:30:12Z",
13+
"closedAt": null,
14+
"closedBy": null,
15+
"threadCount": 4,
16+
"source": {
17+
"type": "email",
18+
"via": "customer"
19+
},
20+
"tags": [
21+
"account",
22+
"customer"
23+
],
24+
"primaryCustomer": {
25+
"id": 298473,
26+
"email": "[email protected]",
27+
"firstName": "John",
28+
"lastName": "Doe"
29+
},
30+
"assignee": {
31+
"id": 149254,
32+
"email": "[email protected]",
33+
"firstName": "Support",
34+
"lastName": "Agent"
35+
},
36+
"cc": [],
37+
"bcc": [],
38+
"threads": [
39+
{
40+
"id": 98254732,
41+
"type": "customer",
42+
"status": "active",
43+
"state": "published",
44+
"author": {
45+
"id": 298473,
46+
"email": "[email protected]",
47+
"type": "customer",
48+
"firstName": "John",
49+
"lastName": "Doe"
50+
},
51+
"text": "Hi, I've submitted additional information as requested. Please let me know if you need anything else.",
52+
"createdAt": "2025-04-24T14:30:12Z"
53+
}
54+
]
55+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "help_scout-new-note-created-instant",
6+
name: "New Note Created (Instant)",
7+
description: "Emit new event when a note is added to a conversation.",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
methods: {
12+
...common.methods,
13+
getEventType() {
14+
return [
15+
"convo.note.created",
16+
];
17+
},
18+
getSummary(body) {
19+
return `New note created in conversation: ${body.subject}`;
20+
},
21+
},
22+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
export default {
2+
"id": 1755285724,
3+
"type": "note",
4+
"folderId": 98775,
5+
"mailboxId": 76544,
6+
"number": 2571,
7+
"status": "active",
8+
"state": "published",
9+
"subject": "Need help with my account",
10+
"preview": "Internal note: Customer has been having issues since last week...",
11+
"createdAt": "2025-04-24T13:45:23Z",
12+
"modifiedAt": "2025-04-24T14:40:10Z",
13+
"closedAt": null,
14+
"closedBy": null,
15+
"threadCount": 6,
16+
"source": {
17+
"type": "web",
18+
"via": "note"
19+
},
20+
"tags": [
21+
"account",
22+
"customer"
23+
],
24+
"primaryCustomer": {
25+
"id": 298473,
26+
"email": "[email protected]",
27+
"firstName": "John",
28+
"lastName": "Doe"
29+
},
30+
"assignee": {
31+
"id": 149254,
32+
"email": "[email protected]",
33+
"firstName": "Support",
34+
"lastName": "Agent"
35+
},
36+
"cc": [],
37+
"bcc": [],
38+
"threads": [
39+
{
40+
"id": 98254760,
41+
"type": "note",
42+
"status": "active",
43+
"state": "published",
44+
"author": {
45+
"id": 149254,
46+
"email": "[email protected]",
47+
"type": "user",
48+
"firstName": "Support",
49+
"lastName": "Agent"
50+
},
51+
"text": "Internal note: Customer has been having issues since last week. I've checked with the product team and this should be resolved with the next update. Don't mention the upcoming update to the customer yet.",
52+
"createdAt": "2025-04-24T14:40:10Z"
53+
}
54+
]
55+
};

pnpm-lock.yaml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)