mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08: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:
parent
756012b052
commit
2dd0b329ca
|
@ -151,6 +151,14 @@ export const draftFields: INodeProperties[] = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The email address that the reply message is sent to',
|
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',
|
displayName: 'Attachments',
|
||||||
name: 'attachmentsUi',
|
name: 'attachmentsUi',
|
||||||
|
|
|
@ -528,6 +528,7 @@ export class GmailV2 implements INodeType {
|
||||||
let cc = '';
|
let cc = '';
|
||||||
let bcc = '';
|
let bcc = '';
|
||||||
let replyTo = '';
|
let replyTo = '';
|
||||||
|
let threadId = null;
|
||||||
|
|
||||||
if (options.sendTo) {
|
if (options.sendTo) {
|
||||||
to += prepareEmailsInput.call(this, options.sendTo as string, 'To', i);
|
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);
|
replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.threadId && typeof options.threadId === 'string') {
|
||||||
|
threadId = options.threadId;
|
||||||
|
}
|
||||||
|
|
||||||
let attachments: IDataObject[] = [];
|
let attachments: IDataObject[] = [];
|
||||||
if (options.attachmentsUi) {
|
if (options.attachmentsUi) {
|
||||||
attachments = await prepareEmailAttachments.call(
|
attachments = await prepareEmailAttachments.call(
|
||||||
|
@ -574,6 +579,7 @@ export class GmailV2 implements INodeType {
|
||||||
const body = {
|
const body = {
|
||||||
message: {
|
message: {
|
||||||
raw: await encodeEmail(email),
|
raw: await encodeEmail(email),
|
||||||
|
threadId: threadId || undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue