From 4c5f008e26f17d48295500946c81633e6eb6f3a8 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 14 Jul 2025 18:38:26 -0300 Subject: [PATCH 1/8] Adding new webhook source --- .../conversation-status-updated-instant.mjs | 24 +++ .../test-event.mjs | 144 ++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 components/help_scout/sources/conversation-status-updated-instant/conversation-status-updated-instant.mjs create mode 100644 components/help_scout/sources/conversation-status-updated-instant/test-event.mjs diff --git a/components/help_scout/sources/conversation-status-updated-instant/conversation-status-updated-instant.mjs b/components/help_scout/sources/conversation-status-updated-instant/conversation-status-updated-instant.mjs new file mode 100644 index 0000000000000..4e2bde21dc9bd --- /dev/null +++ b/components/help_scout/sources/conversation-status-updated-instant/conversation-status-updated-instant.mjs @@ -0,0 +1,24 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "help_scout-conversation-status-updated-instant", + name: "Conversation Status Updated (Instant)", + description: "Emit new event when a conversation has its status updated. [See the documentation](https://developer.helpscout.com/webhooks/)", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getEventType() { + return [ + "convo.status", + ]; + }, + getSummary(body) { + return `Conversation status updated: ${body.subject} (${body.status})`; + }, + }, + sampleEmit, +}; diff --git a/components/help_scout/sources/conversation-status-updated-instant/test-event.mjs b/components/help_scout/sources/conversation-status-updated-instant/test-event.mjs new file mode 100644 index 0000000000000..c687a5be01392 --- /dev/null +++ b/components/help_scout/sources/conversation-status-updated-instant/test-event.mjs @@ -0,0 +1,144 @@ +export default { + "id": 291938, + "type": "email", + "folderId": "1234", + "isDraft": "false", + "number": 349, + "owner": { + "id": 1234, + "firstName": "Jack", + "lastName": "Sprout", + "email": "jack.sprout@gmail.com", + "phone": null, + "type": "user" + }, + "mailbox": { + "id": 1234, + "name": "My Mailbox" + }, + "customer": { + "id": 29418, + "firstName": "Vernon", + "lastName": "Bear", + "email": "vbear@mywork.com", + "phone": "800-555-1212", + "type": "customer" + }, + "threadCount": 4, + "status": "closed", + "subject": "I need help!", + "preview": "Hello, I tried to download the file off your site...", + "createdBy": { + "id": 29418, + "firstName": "Vernon", + "lastName": "Bear", + "email": "vbear@mywork.com", + "phone": null, + "type": "customer" + }, + "createdAt": "2012-07-23T12:34:12Z", + "modifiedAt": "2012-07-24T20:18:33Z", + "closedAt": "2012-07-24T20:18:33Z", + "closedBy": { + "id": 1234, + "firstName": "Jack", + "lastName": "Sprout", + "email": "jack.sprout@gmail.com", + "phone": null, + "type": "user" + }, + "source": { + "type": "email", + "via": "customer" + }, + "cc": [ + "cc1@somewhere.com", + "cc2@somewhere.com" + ], + "bcc": [ + "bcc1@somewhere.com", + "bcc2@somewhere.com" + ], + "tags": [ + "tag1", + "tag2" + ], + "customFields": [ + { + "fieldId": 1, + "name": "Team", + "value": "Development" + }, + { + "fieldId": 2, + "name": "Customer Disposition", + "value": "Happy" + } + ], + "threads": [ + { + "id": 88171881, + "assignedTo": { + "id": 1234, + "firstName": "Jack", + "lastName": "Sprout", + "email": "jack.sprout@gmail.com", + "phone": null, + "type": "user" + }, + "status": "closed", + "createdAt": "2012-07-23T12:34:12Z", + "createdBy": { + "id": 1234, + "firstName": "Jack", + "lastName": "Sprout", + "email": "jack.sprout@gmail.com", + "phone": null, + "type": "user" + }, + "source": { + "type": "web", + "via": "user" + }, + "type": "message", + "state": "published", + "customer": { + "id": 29418, + "firstName": "Vernon", + "lastName": "Bear", + "email": "vbear@mywork.com", + "phone": "800-555-1212", + "type": "customer" + }, + "fromMailbox": null, + "body": "This is what I have to say. Thank you.", + "to": [ + "customer@somewhere.com" + ], + "cc": [ + "cc1@somewhere.com", + "cc2@somewhere.com" + ], + "bcc": [ + "bcc1@somewhere.com", + "bcc2@somewhere.com" + ], + "attachments": [ + { + "id": 12391, + "mimeType": "image/jpeg", + "filename": "logo.jpg", + "size": 22, + "width": 160, + "height": 160, + "url": "https://secure.helpscout.net/some-url/logo.jpg" + } + ], + "tags": [ + "tag1", + "tag2", + "tag3" + ] + } + ] + } \ No newline at end of file From 132005761daf9396855f80c2879864cb17e8de82 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 14 Jul 2025 18:41:40 -0300 Subject: [PATCH 2/8] package version bump --- components/help_scout/package.json | 5 ++--- pnpm-lock.yaml | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/components/help_scout/package.json b/components/help_scout/package.json index ed1987eec647f..15cae0438f24e 100644 --- a/components/help_scout/package.json +++ b/components/help_scout/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/help_scout", - "version": "0.1.1", + "version": "0.2.0", "description": "Pipedream Help Scout Components", "main": "help_scout.app.mjs", "keywords": [ @@ -13,8 +13,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "crypto": "^1.0.1" } } - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7dc58b4a8d686..c88a577febea4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6125,8 +6125,8 @@ importers: components/help_scout: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 crypto: specifier: ^1.0.1 version: 1.0.1 From ede3f24b34436fa3177a19b03220385ab3d9e9f2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 14 Jul 2025 19:20:06 -0300 Subject: [PATCH 3/8] Adding new actions --- .../get-conversation-details.mjs | 36 +++++++++++++++++++ .../get-conversation-threads.mjs | 27 ++++++++++++++ components/help_scout/help_scout.app.mjs | 16 +++++++++ 3 files changed, 79 insertions(+) create mode 100644 components/help_scout/actions/get-conversation-details/get-conversation-details.mjs create mode 100644 components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs diff --git a/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs b/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs new file mode 100644 index 0000000000000..e8f9b476a3503 --- /dev/null +++ b/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs @@ -0,0 +1,36 @@ +import helpScout from "../../help_scout.app.mjs"; + +export default { + key: "help_scout-get-conversation-details", + name: "Get Conversation Details", + description: "Retrieves the details of a specific conversation. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/get/)", + version: "0.0.1", + type: "action", + props: { + helpScout, + conversationId: { + propDefinition: [ + helpScout, + "conversationId", + ], + }, + embed: { + type: "boolean", + label: "Embed", + description: "If true, the response will include the threads of the conversation.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.helpScout.getConversation({ + $, + conversationId: this.conversationId, + params: { + embed: this.embed, + }, + }); + + $.export("$summary", `Successfully retrieved conversation details (ID: ${this.conversationId})`); + return response; + }, +}; diff --git a/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs b/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs new file mode 100644 index 0000000000000..863e8c909e40e --- /dev/null +++ b/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs @@ -0,0 +1,27 @@ +import helpScout from "../../help_scout.app.mjs"; + +export default { + key: "help_scout-get-conversation-threads", + name: "Get Conversation Threads", + description: "Retrieves the threads of a specific conversation. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/threads/list/)", + version: "0.0.1", + type: "action", + props: { + helpScout, + conversationId: { + propDefinition: [ + helpScout, + "conversationId", + ], + }, + }, + async run({ $ }) { + const response = (await this.helpScout.getConversationThreads({ + $, + conversationId: this.conversationId, + }))?._embedded?.threads; + + $.export("$summary", `Successfully retrieved ${response?.length || 0} threads for conversation ID: ${this.conversationId}`); + return response; + }, +}; diff --git a/components/help_scout/help_scout.app.mjs b/components/help_scout/help_scout.app.mjs index 4b8b4ad42e146..4316ce3935458 100644 --- a/components/help_scout/help_scout.app.mjs +++ b/components/help_scout/help_scout.app.mjs @@ -146,5 +146,21 @@ export default { ...opts, }); }, + getConversation({ + conversationId, ...opts + }) { + return this._makeRequest({ + path: `/conversations/${conversationId}`, + ...opts, + }); + }, + getConversationThreads({ + conversationId, ...opts + }) { + return this._makeRequest({ + path: `/conversations/${conversationId}/threads`, + ...opts, + }); + }, }, }; From 9d23d21fd9270c3221888d410fbe89d6f206be0c Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 16 Jul 2025 14:35:34 -0300 Subject: [PATCH 4/8] Version bumps --- components/help_scout/actions/add-note/add-note.mjs | 2 +- .../help_scout/actions/create-customer/create-customer.mjs | 2 +- components/help_scout/actions/send-reply/send-reply.mjs | 2 +- .../sources/new-agent-reply-instant/new-agent-reply-instant.mjs | 2 +- .../new-conversation-created-instant.mjs | 2 +- .../sources/new-customer-instant/new-customer-instant.mjs | 2 +- .../new-customer-reply-instant/new-customer-reply-instant.mjs | 2 +- .../new-note-created-instant/new-note-created-instant.mjs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/help_scout/actions/add-note/add-note.mjs b/components/help_scout/actions/add-note/add-note.mjs index ebb02f2770e0b..0dfbc569e269f 100644 --- a/components/help_scout/actions/add-note/add-note.mjs +++ b/components/help_scout/actions/add-note/add-note.mjs @@ -4,7 +4,7 @@ export default { key: "help_scout-add-note", name: "Add Note to Conversation", description: "Adds a note to an existing conversation in Help Scout. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/threads/note/)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { helpScout, diff --git a/components/help_scout/actions/create-customer/create-customer.mjs b/components/help_scout/actions/create-customer/create-customer.mjs index cec309bb7c831..f022ec674eddb 100644 --- a/components/help_scout/actions/create-customer/create-customer.mjs +++ b/components/help_scout/actions/create-customer/create-customer.mjs @@ -13,7 +13,7 @@ export default { key: "help_scout-create-customer", name: "Create Customer", description: "Creates a new customer record in Help Scout. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/customers/create/)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { helpScout, diff --git a/components/help_scout/actions/send-reply/send-reply.mjs b/components/help_scout/actions/send-reply/send-reply.mjs index 61673ae81a8b5..b2ec90055c5d4 100644 --- a/components/help_scout/actions/send-reply/send-reply.mjs +++ b/components/help_scout/actions/send-reply/send-reply.mjs @@ -4,7 +4,7 @@ export default { key: "help_scout-send-reply", name: "Send Reply", description: "Sends a reply to a conversation. Be careful as this sends an actual email to the customer. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/threads/reply/)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { helpScout, 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 index 8cf8cf8268a4a..5290c168b7fed 100644 --- 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 @@ -5,7 +5,7 @@ export default { 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", + 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 46058b38784bf..d44dbef83f992 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.2", + version: "0.0.3", 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 e158bc37d0314..3b8f6605d6b0f 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.2", + version: "0.0.3", 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 index 20c1b553e739c..1b142a37b0b7c 100644 --- 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 @@ -5,7 +5,7 @@ export default { 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", + version: "0.0.2", type: "source", dedupe: "unique", methods: { 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 index f4e1cc7faf080..093b2ff62e2e4 100644 --- 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 @@ -5,7 +5,7 @@ export default { 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", + version: "0.0.2", type: "source", dedupe: "unique", methods: { From a68c532eeaae19b6e3cfb6bfa352ca232023378c Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 16 Jul 2025 14:43:25 -0300 Subject: [PATCH 5/8] version bump --- .../new-conversation-assigned-instant.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7eba050711103..e5e5f39f2fc49 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.2", + version: "0.0.3", type: "source", dedupe: "unique", methods: { From 2320d5bd626c8904728f38f1309d2c9905f09978 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 17 Jul 2025 16:23:33 -0300 Subject: [PATCH 6/8] Adding page prop to 'get conversation threads' --- .../get-conversation-threads.mjs | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs b/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs index 863e8c909e40e..7eaa987e087df 100644 --- a/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs +++ b/components/help_scout/actions/get-conversation-threads/get-conversation-threads.mjs @@ -14,14 +14,31 @@ export default { "conversationId", ], }, + page: { + type: "integer", + label: "Page", + description: "Page number to retrieve. By default, the 25 most recent threads are retrieved (page 1)", + optional: true, + default: 1, + min: 1, + }, }, async run({ $ }) { - const response = (await this.helpScout.getConversationThreads({ + const response = await this.helpScout.getConversationThreads({ $, conversationId: this.conversationId, - }))?._embedded?.threads; + params: { + page: this.page, + }, + }); + + const threads = response?._embedded?.threads; + const pageInfo = response?.page; - $.export("$summary", `Successfully retrieved ${response?.length || 0} threads for conversation ID: ${this.conversationId}`); - return response; + $.export("$summary", `Successfully retrieved ${threads?.length || 0} threads for conversation ID: ${this.conversationId} (Page ${pageInfo?.number + 1 || this.page} of ${pageInfo?.totalPages || "unknown"})`); + return { + threads, + pagination: pageInfo, + }; }, }; From c8a069c38a8d2e80994802785f2babe59f416bf1 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 18 Jul 2025 16:40:05 -0300 Subject: [PATCH 7/8] pnpm --- pnpm-lock.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae0af9ea5cf69..eb766a5db4d60 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11493,8 +11493,7 @@ importers: components/rewardful: {} - components/rewiser: - specifiers: {} + components/rewiser: {} components/rex: dependencies: @@ -37258,6 +37257,8 @@ 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: From 54d8b9ace5f010f9aa4a82074849d7c5cf97f0e2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 18 Jul 2025 16:48:48 -0300 Subject: [PATCH 8/8] Adjusting embed parameter --- .../get-conversation-details/get-conversation-details.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs b/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs index e8f9b476a3503..85e26b22ce627 100644 --- a/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs +++ b/components/help_scout/actions/get-conversation-details/get-conversation-details.mjs @@ -26,7 +26,9 @@ export default { $, conversationId: this.conversationId, params: { - embed: this.embed, + embed: this.embed + ? "threads" + : undefined, }, });