feat(Gmail Node): Add support for creating drafts using an alias (#8728)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
@@ -197,6 +197,27 @@ export class GmailV2 implements INodeType {
|
||||
|
||||
return returnData;
|
||||
},
|
||||
|
||||
async getGmailAliases(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const { sendAs } = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/gmail/v1/users/me/settings/sendAs',
|
||||
);
|
||||
|
||||
for (const alias of sendAs || []) {
|
||||
const displayName = alias.isDefault
|
||||
? `${alias.sendAsEmail} (Default)`
|
||||
: alias.sendAsEmail;
|
||||
returnData.push({
|
||||
name: displayName,
|
||||
value: alias.sendAsEmail,
|
||||
});
|
||||
}
|
||||
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -528,6 +549,7 @@ export class GmailV2 implements INodeType {
|
||||
let cc = '';
|
||||
let bcc = '';
|
||||
let replyTo = '';
|
||||
let fromAlias = '';
|
||||
let threadId = null;
|
||||
|
||||
if (options.sendTo) {
|
||||
@@ -546,6 +568,10 @@ export class GmailV2 implements INodeType {
|
||||
replyTo = prepareEmailsInput.call(this, options.replyTo as string, 'ReplyTo', i);
|
||||
}
|
||||
|
||||
if (options.fromAlias) {
|
||||
fromAlias = options.fromAlias as string;
|
||||
}
|
||||
|
||||
if (options.threadId && typeof options.threadId === 'string') {
|
||||
threadId = options.threadId;
|
||||
}
|
||||
@@ -567,6 +593,7 @@ export class GmailV2 implements INodeType {
|
||||
}
|
||||
|
||||
const email: IEmail = {
|
||||
from: fromAlias,
|
||||
to,
|
||||
cc,
|
||||
bcc,
|
||||
|
||||
Reference in New Issue
Block a user