From bb5c13b2f9665d30017be870b14837cdad463cca Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Tue, 25 Nov 2025 13:37:40 -0500 Subject: [PATCH 1/2] new actions --- .../actions/get-tag-by-id/get-tag-by-id.mjs | 31 ++++++++++ .../actions/list-tags/list-tags.mjs | 37 ++++++++++++ .../update-conversation.mjs | 56 +++++++++++++++++++ components/help_scout/common/constants.mjs | 45 +++++++++++++++ components/help_scout/help_scout.app.mjs | 49 ++++++++++++++-- components/help_scout/package.json | 2 +- 6 files changed, 215 insertions(+), 5 deletions(-) create mode 100644 components/help_scout/actions/get-tag-by-id/get-tag-by-id.mjs create mode 100644 components/help_scout/actions/list-tags/list-tags.mjs create mode 100644 components/help_scout/actions/update-conversation/update-conversation.mjs diff --git a/components/help_scout/actions/get-tag-by-id/get-tag-by-id.mjs b/components/help_scout/actions/get-tag-by-id/get-tag-by-id.mjs new file mode 100644 index 0000000000000..cc466129a25c0 --- /dev/null +++ b/components/help_scout/actions/get-tag-by-id/get-tag-by-id.mjs @@ -0,0 +1,31 @@ +import helpScout from "../../help_scout.app.mjs"; + +export default { + key: "help_scout-get-tag-by-id", + name: "Get Tag by ID", + description: "Gets a tag by its ID. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/tags/get/)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + helpScout, + tagId: { + propDefinition: [ + helpScout, + "tagId", + ], + }, + }, + async run({ $ }) { + const response = await this.helpScout.getTag({ + $, + tagId: this.tagId, + }); + $.export("$summary", `Successfully retrieved tag with ID ${this.tagId}`); + return response; + }, +}; diff --git a/components/help_scout/actions/list-tags/list-tags.mjs b/components/help_scout/actions/list-tags/list-tags.mjs new file mode 100644 index 0000000000000..1c280968bdb9e --- /dev/null +++ b/components/help_scout/actions/list-tags/list-tags.mjs @@ -0,0 +1,37 @@ +import helpScout from "../../help_scout.app.mjs"; + +export default { + key: "help_scout-list-tags", + name: "List Tags", + description: "Lists all tags in Help Scout. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/tags/list/)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + helpScout, + page: { + type: "integer", + label: "Page", + description: "The page number to return. Defaults to 1.", + default: 1, + optional: true, + }, + }, + async run({ $ }) { + const response = await this.helpScout.listTags({ + $, + params: { + page: this.page, + }, + }); + const length = response?._embedded?.tags?.length ?? 0; + $.export("$summary", `Successfully retrieved ${length} tag${length === 1 + ? "" + : "s"}`); + return response; + }, +}; diff --git a/components/help_scout/actions/update-conversation/update-conversation.mjs b/components/help_scout/actions/update-conversation/update-conversation.mjs new file mode 100644 index 0000000000000..95f643eb73455 --- /dev/null +++ b/components/help_scout/actions/update-conversation/update-conversation.mjs @@ -0,0 +1,56 @@ +import helpScout from "../../help_scout.app.mjs"; +import { CONVERSATION_OPERATIONS } from "../../common/constants.mjs"; + +export default { + key: "help_scout-update-conversation", + name: "Update Conversation", + description: "Updates a conversation. [See the documentation](https://developer.helpscout.com/mailbox-api/endpoints/conversations/update/)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: true, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + helpScout, + conversationId: { + propDefinition: [ + helpScout, + "conversationId", + ], + }, + operation: { + type: "string", + label: "Operation", + description: "The operation to perform on the conversation", + options: CONVERSATION_OPERATIONS.map(({ label }) => label), + }, + value: { + type: "string", + label: "Value", + description: "The value to use for the operation", + }, + }, + async run({ $ }) { + const operation = CONVERSATION_OPERATIONS.find(({ label }) => label === this.operation); + const value = operation.type === "boolean" + ? this.value === "true" + : operation.type === "number" + ? +this.value + : this.value; + + const response = await this.helpScout.updateConversation({ + conversationId: this.conversationId, + data: { + op: operation.operation, + path: operation.path, + value, + }, + }); + + $.export("$summary", `Successfully updated conversation with ID ${this.conversationId}`); + + return response; + }, +}; diff --git a/components/help_scout/common/constants.mjs b/components/help_scout/common/constants.mjs index 76d42ac05aaa4..2d6be5432b5d3 100644 --- a/components/help_scout/common/constants.mjs +++ b/components/help_scout/common/constants.mjs @@ -14,3 +14,48 @@ export const GENDER_OPTIONS = [ "female", "unknown", ]; + +export const CONVERSATION_OPERATIONS = [ + { + label: "Change subject", + path: "/subject", + operation: "replace", + type: "string", + }, + { + label: "Change customer", + path: "/primaryCustomer.id", + operation: "replace", + type: "number", + }, + { + label: "Publish draft", + path: "/draft", + operation: "replace", + type: "boolean", + }, + { + label: "Move conversation to another inbox", + path: "/mailboxId", + operation: "move", + type: "number", + }, + { + label: "Change conversation status", + path: "/status", + operation: "replace", + type: "string", + }, + { + label: "Change conversation owner", + path: "/assignTo", + operation: "replace", + type: "number", + }, + { + label: "Un-assign conversation", + path: "/assignTo", + operation: "remove", + type: "number", + }, +]; diff --git a/components/help_scout/help_scout.app.mjs b/components/help_scout/help_scout.app.mjs index 4316ce3935458..fac53cadb2572 100644 --- a/components/help_scout/help_scout.app.mjs +++ b/components/help_scout/help_scout.app.mjs @@ -7,7 +7,7 @@ export default { agentId: { type: "string", label: "Agent ID", - description: "ID of the agent to whom the conversation is assigned.", + description: "ID of the agent to whom the conversation is assigned", }, conversationId: { type: "string", @@ -31,7 +31,7 @@ export default { customerId: { type: "string", label: "Customer ID", - description: "The unique identifier of the customer.", + description: "The unique identifier of the customer", async options({ page }) { const { _embedded: { customers } } = await this.listCustomers({ params: { @@ -50,7 +50,7 @@ export default { userId: { type: "string", label: "User ID", - description: "The unique identifier of the user.", + description: "The unique identifier of the user", async options({ page }) { const { _embedded: { users } } = await this.listUsers({ params: { @@ -66,10 +66,28 @@ export default { })); }, }, + tagId: { + type: "string", + label: "Tag ID", + description: "The unique identifier of the tag", + async options({ page }) { + const { _embedded: { tags } } = await this.listTags({ + params: { + page: page + 1, + }, + }); + return tags.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, text: { type: "string", label: "Text", - description: "The content of the note.", + description: "The content of the note", }, }, methods: { @@ -90,6 +108,14 @@ export default { ...opts, }); }, + getTag({ + tagId, ...opts + }) { + return this._makeRequest({ + path: `/tags/${tagId}`, + ...opts, + }); + }, listConversations(opts = {}) { return this._makeRequest({ path: "/conversations", @@ -108,6 +134,12 @@ export default { ...opts, }); }, + listTags(opts = {}) { + return this._makeRequest({ + path: "/tags", + ...opts, + }); + }, createWebhook(opts = {}) { return this._makeRequest({ method: "POST", @@ -162,5 +194,14 @@ export default { ...opts, }); }, + updateConversation({ + conversationId, ...opts + }) { + return this._makeRequest({ + method: "PATCH", + path: `/conversations/${conversationId}`, + ...opts, + }); + }, }, }; diff --git a/components/help_scout/package.json b/components/help_scout/package.json index 8bdb29e6597f8..37d6cc7a5fc1d 100644 --- a/components/help_scout/package.json +++ b/components/help_scout/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/help_scout", - "version": "0.2.0", + "version": "0.3.0", "description": "Pipedream Help Scout Components", "main": "help_scout.app.mjs", "keywords": [ From 5ccd32163390fa386015b291956a94266e0e45ee Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Tue, 25 Nov 2025 13:40:27 -0500 Subject: [PATCH 2/2] versions --- components/help_scout/actions/add-note/add-note.mjs | 2 +- .../help_scout/actions/create-customer/create-customer.mjs | 2 +- .../get-conversation-details/get-conversation-details.mjs | 2 +- .../get-conversation-threads/get-conversation-threads.mjs | 2 +- components/help_scout/actions/send-reply/send-reply.mjs | 2 +- .../conversation-status-updated-instant.mjs | 2 +- .../sources/new-agent-reply-instant/new-agent-reply-instant.mjs | 2 +- .../new-conversation-assigned-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 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/help_scout/actions/add-note/add-note.mjs b/components/help_scout/actions/add-note/add-note.mjs index c185064d0cfa3..00ac71f643b95 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.3", + version: "0.0.4", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/help_scout/actions/create-customer/create-customer.mjs b/components/help_scout/actions/create-customer/create-customer.mjs index c5afa852dfcda..1f0eadccdd531 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.3", + version: "0.0.4", annotations: { destructiveHint: false, openWorldHint: true, 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 e8491118d119e..4cb7d2c45d7c8 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 @@ -4,7 +4,7 @@ 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.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, 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 7ec8ffcd7623a..525db1babefd2 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 @@ -4,7 +4,7 @@ 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.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/help_scout/actions/send-reply/send-reply.mjs b/components/help_scout/actions/send-reply/send-reply.mjs index f546b21780b93..de7b056e3b9cd 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.3", + version: "0.0.4", annotations: { destructiveHint: false, openWorldHint: true, 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 index 4e2bde21dc9bd..bd745c532ff35 100644 --- 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 @@ -6,7 +6,7 @@ export default { 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", + version: "0.0.2", type: "source", dedupe: "unique", methods: { 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 5290c168b7fed..2cf7f953c87b9 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.2", + version: "0.0.3", type: "source", dedupe: "unique", methods: { 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 e5e5f39f2fc49..7cd1a5b1e51e6 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.3", + version: "0.0.4", 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 d44dbef83f992..9d3f3429e71f8 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.3", + version: "0.0.4", 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 3b8f6605d6b0f..5164832ce6444 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.3", + version: "0.0.4", 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 1b142a37b0b7c..2e5d5cb6ff5fd 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.2", + version: "0.0.3", 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 093b2ff62e2e4..3ef09c3ad8a16 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.2", + version: "0.0.3", type: "source", dedupe: "unique", methods: {