mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(HelpScout Node): Fix issue with thread types not working correctly (#10084)
This commit is contained in:
@@ -459,6 +459,13 @@ export class HelpScout implements INodeType {
|
|||||||
const text = this.getNodeParameter('text', i) as string;
|
const text = this.getNodeParameter('text', i) as string;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||||
const attachments = this.getNodeParameter('attachmentsUi', i) as IDataObject;
|
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 = {
|
const body: IThread = {
|
||||||
text,
|
text,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
@@ -527,7 +534,7 @@ export class HelpScout implements INodeType {
|
|||||||
responseData = await helpscoutApiRequest.call(
|
responseData = await helpscoutApiRequest.call(
|
||||||
this,
|
this,
|
||||||
'POST',
|
'POST',
|
||||||
`/v2/conversations/${conversationId}/chats`,
|
`/v2/conversations/${conversationId}/${threadType}`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
|
|||||||
Reference in New Issue
Block a user