From 68d3bebfeebea9054bbbaebac31c2e3fa34336bb Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 17 Jul 2024 14:57:26 +0100 Subject: [PATCH] fix(HelpScout Node): Fix issue with thread types not working correctly (#10084) --- packages/nodes-base/nodes/HelpScout/HelpScout.node.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts b/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts index 01c9bba387..ef5bed5e12 100644 --- a/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts +++ b/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts @@ -459,6 +459,13 @@ export class HelpScout implements INodeType { const text = this.getNodeParameter('text', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i); const attachments = this.getNodeParameter('attachmentsUi', i) as IDataObject; + let threadType = this.getNodeParameter('type', i) as string; + + // We need to update the types to match the API - Avoids a breaking change + const singular = ['reply', 'customer']; + if (!singular.includes(threadType)) { + threadType = `${threadType}s`; + } const body: IThread = { text, attachments: [], @@ -527,7 +534,7 @@ export class HelpScout implements INodeType { responseData = await helpscoutApiRequest.call( this, 'POST', - `/v2/conversations/${conversationId}/chats`, + `/v2/conversations/${conversationId}/${threadType}`, body, ); responseData = { success: true };