1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-17 16:08:12 +03:00

feat(Gmail Node): Add thread option for draft emails (#8729)

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
Nicolas-nwb 2024-04-25 12:56:53 +02:00 committed by GitHub
parent 756012b052
commit 2dd0b329ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -151,6 +151,14 @@ export const draftFields: INodeProperties[] = [
default: '',
description: 'The email address that the reply message is sent to',
},
{
displayName: 'Thread ID',
name: 'threadId',
type: 'string',
placeholder: '18cc573e2431878f',
default: '',
description: 'The identifier of the thread to attach the draft',
},
{
displayName: 'Attachments',
name: 'attachmentsUi',

View File

@ -528,6 +528,7 @@ export class GmailV2 implements INodeType {
let cc = '';
let bcc = '';
let replyTo = '';
let threadId = null;
if (options.sendTo) {
to += prepareEmailsInput.call(this, options.sendTo as string, 'To', i);
@ -545,6 +546,10 @@ export class GmailV2 implements INodeType {
replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i);
}
if (options.threadId && typeof options.threadId === 'string') {
threadId = options.threadId;
}
let attachments: IDataObject[] = [];
if (options.attachmentsUi) {
attachments = await prepareEmailAttachments.call(
@ -574,6 +579,7 @@ export class GmailV2 implements INodeType {
const body = {
message: {
raw: await encodeEmail(email),
threadId: threadId || undefined,
},
};