mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
✨ Add mail-send operation to SendGrid node (#1526)
* ⚡ Add mail description * ⚡ Add mail:send functionality * 🔨 Refactor sandbox into additional options * 🔨 Refactor MIME type as options * ⚡ Implement send_at functionality * ⚡ Add headers to additional options * ⚡ Implement attachments * 🔥 Remove logging * ⚡ Improvements * ⚡ Fix default operation * 🔨 Fix HTML option * 🔨 Fix subject in dynamic template email Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function sendGridApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, endpoint: string, method: string, body: any = {}, qs: IDataObject = {}, uri?: string | undefined): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function sendGridApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, endpoint: string, method: string, body: any = {}, qs: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('sendGridApi') as IDataObject;
|
||||
|
||||
const host = 'api.sendgrid.com/v3';
|
||||
@@ -25,7 +25,7 @@ export async function sendGridApiRequest(this: IHookFunctions | IExecuteFunction
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri || `https://${host}${endpoint}`,
|
||||
uri: `https://${host}${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@@ -33,6 +33,10 @@ export async function sendGridApiRequest(this: IHookFunctions | IExecuteFunction
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (Object.keys(option).length !== 0) {
|
||||
Object.assign(options, option);
|
||||
}
|
||||
|
||||
try {
|
||||
//@ts-ignore
|
||||
return await this.helpers.request!(options);
|
||||
|
||||
Reference in New Issue
Block a user