diff --git a/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts b/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts index 86ffb2eda9..d88d25e2c1 100644 --- a/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts @@ -24,6 +24,7 @@ export interface IEmail { to?: string; cc?: string; bcc?: string; + replyTo?: string; inReplyTo?: string; reference?: string; subject: string; @@ -222,6 +223,7 @@ export async function encodeEmail(email: IEmail) { to: email.to, cc: email.cc, bcc: email.bcc, + replyTo: email.replyTo, inReplyTo: email.inReplyTo, references: email.reference, subject: email.subject, @@ -509,7 +511,7 @@ export function unescapeSnippets(items: INodeExecutionData[]) { return result; } -export async function replayToEmail( +export async function replyToEmail( this: IExecuteFunctions, items: INodeExecutionData[], gmailId: string, diff --git a/packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts b/packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts index 25a42d853e..8a87e40d43 100644 --- a/packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts +++ b/packages/nodes-base/nodes/Google/Gmail/v2/DraftDescription.ts @@ -143,6 +143,14 @@ export const draftFields: INodeProperties[] = [ placeholder: 'info@example.com', default: '', }, + { + displayName: 'Send Replies To', + name: 'replyTo', + type: 'string', + placeholder: 'reply@example.com', + default: '', + description: 'The email address that the reply message is sent to', + }, { displayName: 'Attachments', name: 'attachmentsUi', diff --git a/packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts b/packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts index 2d1b0b787a..ca4fcc0b58 100644 --- a/packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts +++ b/packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts @@ -21,7 +21,7 @@ import { prepareEmailBody, prepareEmailsInput, prepareQuery, - replayToEmail, + replyToEmail, simplifyOutput, unescapeSnippets, } from '../GenericFunctions'; @@ -282,6 +282,7 @@ export class GmailV2 implements INodeType { const to = prepareEmailsInput.call(this, sendTo, 'To', i); let cc = ''; let bcc = ''; + let replyTo = ''; if (options.ccList) { cc = prepareEmailsInput.call(this, options.ccList as string, 'CC', i); @@ -291,6 +292,10 @@ export class GmailV2 implements INodeType { bcc = prepareEmailsInput.call(this, options.bccList as string, 'BCC', i); } + if (options.replyTo) { + replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i); + } + let attachments: IDataObject[] = []; if (options.attachmentsUi) { @@ -323,6 +328,7 @@ export class GmailV2 implements INodeType { to, cc, bcc, + replyTo, subject: this.getNodeParameter('subject', i) as string, ...prepareEmailBody.call(this, i), attachments, @@ -340,7 +346,7 @@ export class GmailV2 implements INodeType { const messageIdGmail = this.getNodeParameter('messageId', i) as string; const options = this.getNodeParameter('options', i); - responseData = await replayToEmail.call(this, items, messageIdGmail, options, i); + responseData = await replyToEmail.call(this, items, messageIdGmail, options, i); } if (operation === 'get') { //https://developers.google.com/gmail/api/v1/reference/users/messages/get @@ -514,6 +520,7 @@ export class GmailV2 implements INodeType { let to = ''; let cc = ''; let bcc = ''; + let replyTo = ''; if (options.sendTo) { to += prepareEmailsInput.call(this, options.sendTo as string, 'To', i); @@ -527,6 +534,10 @@ export class GmailV2 implements INodeType { bcc = prepareEmailsInput.call(this, options.bccList as string, 'BCC', i); } + if (options.replyTo) { + replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i); + } + let attachments: IDataObject[] = []; if (options.attachmentsUi) { attachments = await prepareEmailAttachments.call( @@ -547,6 +558,7 @@ export class GmailV2 implements INodeType { to, cc, bcc, + replyTo, subject: this.getNodeParameter('subject', i) as string, ...prepareEmailBody.call(this, i), attachments, @@ -741,7 +753,7 @@ export class GmailV2 implements INodeType { const messageIdGmail = this.getNodeParameter('messageId', i) as string; const options = this.getNodeParameter('options', i); - responseData = await replayToEmail.call(this, items, messageIdGmail, options, i); + responseData = await replyToEmail.call(this, items, messageIdGmail, options, i); } if (operation === 'trash') { //https://developers.google.com/gmail/api/reference/rest/v1/users.threads/trash diff --git a/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts b/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts index d824d66ace..d42296cd2b 100644 --- a/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts +++ b/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts @@ -225,6 +225,19 @@ export const messageFields: INodeProperties[] = [ default: '', description: "The name that will be shown in recipients' inboxes", }, + { + displayName: 'Send Replies To', + name: 'replyTo', + type: 'string', + placeholder: 'reply@example.com', + default: '', + description: 'The email address that the reply message is sent to', + displayOptions: { + hide: { + '/operation': ['reply'], + }, + }, + }, { displayName: 'Reply to Sender Only', name: 'replyToSenderOnly',