mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Add Reply To parameter to Mailjet node (#1732)
* ⚡ Add Reply To parameter * ⚡ Add svg logo
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { OptionsWithUri } from 'request';
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IDataObject, IHookFunctions, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function mailjetApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const emailApiCredentials = this.getCredentials('mailjetEmailApi');
|
||||
@@ -16,7 +24,7 @@ export async function mailjetApiRequest(this: IExecuteFunctions | IExecuteSingle
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ||`https://api.mailjet.com${resource}`,
|
||||
uri: uri || `https://api.mailjet.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
@@ -25,12 +33,10 @@ export async function mailjetApiRequest(this: IExecuteFunctions | IExecuteSingle
|
||||
}
|
||||
if (emailApiCredentials !== undefined) {
|
||||
const base64Credentials = Buffer.from(`${emailApiCredentials.apiKey}:${emailApiCredentials.secretKey}`).toString('base64');
|
||||
//@ts-ignore
|
||||
options.headers['Authorization'] = `Basic ${base64Credentials}`;
|
||||
options.headers!['Authorization'] = `Basic ${base64Credentials}`;
|
||||
} else {
|
||||
const smsApiCredentials = this.getCredentials('mailjetSmsApi');
|
||||
//@ts-ignore
|
||||
options.headers['Authorization'] = `Bearer ${smsApiCredentials.token}`;
|
||||
options.headers!['Authorization'] = `Bearer ${smsApiCredentials!.token}`;
|
||||
}
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
@@ -57,3 +63,20 @@ export async function mailjetApiRequestAllItems(this: IExecuteFunctions | IHookF
|
||||
);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export interface IMessage {
|
||||
From?: { Email?: string, Name?: string };
|
||||
Subject?: string;
|
||||
To?: IDataObject[];
|
||||
Cc?: IDataObject[];
|
||||
Bcc?: IDataObject[];
|
||||
Variables?: IDataObject;
|
||||
TemplateLanguage?: boolean;
|
||||
TemplateID?: number;
|
||||
HTMLPart?: string;
|
||||
TextPart?: string;
|
||||
TrackOpens?: string;
|
||||
ReplyTo?: IDataObject;
|
||||
TrackClicks?: string;
|
||||
Priority?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user