mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(HelpScout Node): Fix issue with thread types not working correctly (#10084)
This commit is contained in:
parent
76c290655d
commit
68d3bebfee
|
@ -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 };
|
||||||
|
|
Loading…
Reference in a new issue