diff --git a/components/help_scout/package.json b/components/help_scout/package.json index 2cbc959a07578..ed1987eec647f 100644 --- a/components/help_scout/package.json +++ b/components/help_scout/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/help_scout", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Help Scout Components", "main": "help_scout.app.mjs", "keywords": [ diff --git a/components/help_scout/sources/common/base.mjs b/components/help_scout/sources/common/base.mjs index 90329148e98d3..4c81f42d2c519 100644 --- a/components/help_scout/sources/common/base.mjs +++ b/components/help_scout/sources/common/base.mjs @@ -32,6 +32,14 @@ export default { getExtraData() { return {}; }, + getMetadata(body) { + const ts = Date.parse(new Date()); + return { + id: `${body.id}-${ts}`, + summary: this.getSummary(body), + ts: ts, + }; + }, }, hooks: { async activate() { @@ -70,12 +78,7 @@ export default { } } - const ts = Date.parse(new Date()); - this.$emit(body, { - id: body.id, - summary: this.getSummary(body), - ts: ts, - }); + this.$emit(body, this.getMetadata(body)); return this.http.respond({ status: 200, diff --git a/components/help_scout/sources/new-agent-reply-instant/new-agent-reply-instant.mjs b/components/help_scout/sources/new-agent-reply-instant/new-agent-reply-instant.mjs new file mode 100644 index 0000000000000..8cf8cf8268a4a --- /dev/null +++ b/components/help_scout/sources/new-agent-reply-instant/new-agent-reply-instant.mjs @@ -0,0 +1,25 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "help_scout-new-agent-reply-instant", + name: "New Agent Reply (Instant)", + description: "Emit new event when an agent replies to a conversation.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "convo.agent.reply.created", + ]; + }, + getSummary(body) { + const agentName = body.assignee + ? `${body.assignee.firstName} ${body.assignee.lastName}` + : "Agent"; + return `New agent reply from ${agentName} in conversation: ${body.subject}`; + }, + }, +}; diff --git a/components/help_scout/sources/new-agent-reply-instant/test-event.mjs b/components/help_scout/sources/new-agent-reply-instant/test-event.mjs new file mode 100644 index 0000000000000..33885a4aa9f42 --- /dev/null +++ b/components/help_scout/sources/new-agent-reply-instant/test-event.mjs @@ -0,0 +1,55 @@ +export default { + "id": 1755285700, + "type": "reply", + "folderId": 98775, + "mailboxId": 76544, + "number": 2571, + "status": "active", + "state": "published", + "subject": "Need help with my account", + "preview": "Hello John, I've reviewed the additional information you sent...", + "createdAt": "2025-04-24T13:45:23Z", + "modifiedAt": "2025-04-24T14:35:45Z", + "closedAt": null, + "closedBy": null, + "threadCount": 5, + "source": { + "type": "email", + "via": "agent" + }, + "tags": [ + "account", + "customer" + ], + "primaryCustomer": { + "id": 298473, + "email": "customer@example.com", + "firstName": "John", + "lastName": "Doe" + }, + "assignee": { + "id": 149254, + "email": "agent@company.com", + "firstName": "Support", + "lastName": "Agent" + }, + "cc": [], + "bcc": [], + "threads": [ + { + "id": 98254745, + "type": "reply", + "status": "active", + "state": "published", + "author": { + "id": 149254, + "email": "agent@company.com", + "type": "user", + "firstName": "Support", + "lastName": "Agent" + }, + "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!", + "createdAt": "2025-04-24T14:35:45Z" + } + ] +}; \ No newline at end of file diff --git a/components/help_scout/sources/new-conversation-assigned-instant/new-conversation-assigned-instant.mjs b/components/help_scout/sources/new-conversation-assigned-instant/new-conversation-assigned-instant.mjs index 947d6252fa4e8..7eba050711103 100644 --- a/components/help_scout/sources/new-conversation-assigned-instant/new-conversation-assigned-instant.mjs +++ b/components/help_scout/sources/new-conversation-assigned-instant/new-conversation-assigned-instant.mjs @@ -6,7 +6,7 @@ export default { key: "help_scout-new-conversation-assigned-instant", name: "New Conversation Assigned (Instant)", description: "Emit new event when a conversation is assigned to an agent. [See the documentation](https://developer.helpscout.com/)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/help_scout/sources/new-conversation-created-instant/new-conversation-created-instant.mjs b/components/help_scout/sources/new-conversation-created-instant/new-conversation-created-instant.mjs index 37f0b97e12d52..46058b38784bf 100644 --- a/components/help_scout/sources/new-conversation-created-instant/new-conversation-created-instant.mjs +++ b/components/help_scout/sources/new-conversation-created-instant/new-conversation-created-instant.mjs @@ -6,7 +6,7 @@ export default { key: "help_scout-new-conversation-created-instant", name: "New Conversation Created (Instant)", description: "Emit new event when a new conversation is created.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/help_scout/sources/new-customer-instant/new-customer-instant.mjs b/components/help_scout/sources/new-customer-instant/new-customer-instant.mjs index 766f7a78b6863..e158bc37d0314 100644 --- a/components/help_scout/sources/new-customer-instant/new-customer-instant.mjs +++ b/components/help_scout/sources/new-customer-instant/new-customer-instant.mjs @@ -6,7 +6,7 @@ export default { key: "help_scout-new-customer-instant", name: "New Customer Added (Instant)", description: "Emit new event when a new customer is added.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/help_scout/sources/new-customer-reply-instant/new-customer-reply-instant.mjs b/components/help_scout/sources/new-customer-reply-instant/new-customer-reply-instant.mjs new file mode 100644 index 0000000000000..20c1b553e739c --- /dev/null +++ b/components/help_scout/sources/new-customer-reply-instant/new-customer-reply-instant.mjs @@ -0,0 +1,22 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "help_scout-new-customer-reply-instant", + name: "New Customer Reply (Instant)", + description: "Emit new event when a customer replies to a conversation.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "convo.customer.reply.created", + ]; + }, + getSummary(body) { + return `New customer reply from ${body.primaryCustomer?.email} in conversation: ${body.subject}`; + }, + }, +}; diff --git a/components/help_scout/sources/new-customer-reply-instant/test-event.mjs b/components/help_scout/sources/new-customer-reply-instant/test-event.mjs new file mode 100644 index 0000000000000..7c20542339472 --- /dev/null +++ b/components/help_scout/sources/new-customer-reply-instant/test-event.mjs @@ -0,0 +1,55 @@ +export default { + "id": 1755285686, + "type": "customer", + "folderId": 98775, + "mailboxId": 76544, + "number": 2571, + "status": "active", + "state": "published", + "subject": "Need help with my account", + "preview": "Hi, I've submitted additional information as requested...", + "createdAt": "2025-04-24T13:45:23Z", + "modifiedAt": "2025-04-24T14:30:12Z", + "closedAt": null, + "closedBy": null, + "threadCount": 4, + "source": { + "type": "email", + "via": "customer" + }, + "tags": [ + "account", + "customer" + ], + "primaryCustomer": { + "id": 298473, + "email": "customer@example.com", + "firstName": "John", + "lastName": "Doe" + }, + "assignee": { + "id": 149254, + "email": "agent@company.com", + "firstName": "Support", + "lastName": "Agent" + }, + "cc": [], + "bcc": [], + "threads": [ + { + "id": 98254732, + "type": "customer", + "status": "active", + "state": "published", + "author": { + "id": 298473, + "email": "customer@example.com", + "type": "customer", + "firstName": "John", + "lastName": "Doe" + }, + "text": "Hi, I've submitted additional information as requested. Please let me know if you need anything else.", + "createdAt": "2025-04-24T14:30:12Z" + } + ] +}; \ No newline at end of file diff --git a/components/help_scout/sources/new-note-created-instant/new-note-created-instant.mjs b/components/help_scout/sources/new-note-created-instant/new-note-created-instant.mjs new file mode 100644 index 0000000000000..f4e1cc7faf080 --- /dev/null +++ b/components/help_scout/sources/new-note-created-instant/new-note-created-instant.mjs @@ -0,0 +1,22 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "help_scout-new-note-created-instant", + name: "New Note Created (Instant)", + description: "Emit new event when a note is added to a conversation.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "convo.note.created", + ]; + }, + getSummary(body) { + return `New note created in conversation: ${body.subject}`; + }, + }, +}; diff --git a/components/help_scout/sources/new-note-created-instant/test-event.mjs b/components/help_scout/sources/new-note-created-instant/test-event.mjs new file mode 100644 index 0000000000000..441e2830a4089 --- /dev/null +++ b/components/help_scout/sources/new-note-created-instant/test-event.mjs @@ -0,0 +1,55 @@ +export default { + "id": 1755285724, + "type": "note", + "folderId": 98775, + "mailboxId": 76544, + "number": 2571, + "status": "active", + "state": "published", + "subject": "Need help with my account", + "preview": "Internal note: Customer has been having issues since last week...", + "createdAt": "2025-04-24T13:45:23Z", + "modifiedAt": "2025-04-24T14:40:10Z", + "closedAt": null, + "closedBy": null, + "threadCount": 6, + "source": { + "type": "web", + "via": "note" + }, + "tags": [ + "account", + "customer" + ], + "primaryCustomer": { + "id": 298473, + "email": "customer@example.com", + "firstName": "John", + "lastName": "Doe" + }, + "assignee": { + "id": 149254, + "email": "agent@company.com", + "firstName": "Support", + "lastName": "Agent" + }, + "cc": [], + "bcc": [], + "threads": [ + { + "id": 98254760, + "type": "note", + "status": "active", + "state": "published", + "author": { + "id": 149254, + "email": "agent@company.com", + "type": "user", + "firstName": "Support", + "lastName": "Agent" + }, + "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.", + "createdAt": "2025-04-24T14:40:10Z" + } + ] +}; \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 030af1c6b33e0..885683ec5e7ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34731,8 +34731,6 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) - transitivePeerDependencies: - - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: