Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -574,6 +579,7 @@ export class GmailV2 implements INodeType {
const body = {
message: {
raw: await encodeEmail(email),
threadId: threadId || undefined,
},
};

Expand Down
Loading