Skip to content

Commit 2dd0b32

Browse files
Nicolas-nwbJoffcom
andauthored
feat(Gmail Node): Add thread option for draft emails (#8729)
Co-authored-by: Jonathan Bennetts <[email protected]>
1 parent 756012b commit 2dd0b32

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ export const draftFields: INodeProperties[] = [
151151
default: '',
152152
description: 'The email address that the reply message is sent to',
153153
},
154+
{
155+
displayName: 'Thread ID',
156+
name: 'threadId',
157+
type: 'string',
158+
placeholder: '18cc573e2431878f',
159+
default: '',
160+
description: 'The identifier of the thread to attach the draft',
161+
},
154162
{
155163
displayName: 'Attachments',
156164
name: 'attachmentsUi',

packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ export class GmailV2 implements INodeType {
528528
let cc = '';
529529
let bcc = '';
530530
let replyTo = '';
531+
let threadId = null;
531532

532533
if (options.sendTo) {
533534
to += prepareEmailsInput.call(this, options.sendTo as string, 'To', i);
@@ -545,6 +546,10 @@ export class GmailV2 implements INodeType {
545546
replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i);
546547
}
547548

549+
if (options.threadId && typeof options.threadId === 'string') {
550+
threadId = options.threadId;
551+
}
552+
548553
let attachments: IDataObject[] = [];
549554
if (options.attachmentsUi) {
550555
attachments = await prepareEmailAttachments.call(
@@ -574,6 +579,7 @@ export class GmailV2 implements INodeType {
574579
const body = {
575580
message: {
576581
raw: await encodeEmail(email),
582+
threadId: threadId || undefined,
577583
},
578584
};
579585

0 commit comments

Comments
 (0)