mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Some improvements to Customer.io Node
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
get,
|
||||
} from 'lodash';
|
||||
|
||||
export async function customerIoApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, baseApi? : string, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function customerIoApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, baseApi?: string, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('customerIoApi');
|
||||
|
||||
if (credentials === undefined) {
|
||||
@@ -38,14 +38,14 @@ export async function customerIoApiRequest(this: IHookFunctions | IExecuteFuncti
|
||||
if (baseApi === 'tracking') {
|
||||
options.uri = `https://track.customer.io/api/v1${endpoint}`;
|
||||
const basicAuthKey = Buffer.from(`${credentials.trackingSiteId}:${credentials.trackingApiKey}`).toString('base64');
|
||||
Object.assign(options.headers, {'Authorization': `Basic ${basicAuthKey}`});
|
||||
Object.assign(options.headers, { 'Authorization': `Basic ${basicAuthKey}` });
|
||||
} else if (baseApi === 'api') {
|
||||
options.uri = `https://api.customer.io/v1/api${endpoint}`;
|
||||
const basicAuthKey = Buffer.from(`${credentials.trackingSiteId}:${credentials.trackingApiKey}`).toString('base64');
|
||||
Object.assign(options.headers, {'Authorization': `Basic ${basicAuthKey}`});
|
||||
Object.assign(options.headers, { 'Authorization': `Basic ${basicAuthKey}` });
|
||||
} else if (baseApi === 'beta') {
|
||||
options.uri = `https://beta-api.customer.io/v1/api${endpoint}`;
|
||||
Object.assign(options.headers, {'Authorization': `Bearer ${credentials.appApiKey as string}`});
|
||||
Object.assign(options.headers, { 'Authorization': `Bearer ${credentials.appApiKey as string}` });
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user