mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Emelia Node): Add Campaign > Duplicate functionality (#3000)
* feat(Emelia Node): Add campaign duplication feature * ⚡ small ui fixes, added credential test, fixed nodelinter issues * ⚡ Improvements * ⚡ Updated wording for Number operations on IF-Node (#3065) * fix(Google Tasks Node): Fix "Show Completed" option and hide title field where not needed (#2741) * 🐛 Google Tasks: Fix showCompleted * ⚡ Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com> * feat(Mocean Node): Add "Delivery Report URL" option and credential tests (#3075) * add dlr url column add dlr url(delivery report URl) column. Allow user set the endpoint to receive the report * update update delivery report url description * ⚡ fixed nodelinter issues, added credential test, replaced icon * ⚡ Improvements Co-authored-by: d3no <d3no520@gmail.com> Co-authored-by: Michael Kret <michael.k@radency.com> * ⚡ Normalize name Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com> Co-authored-by: Tom <19203795+that-one-tom@users.noreply.github.com> Co-authored-by: Ricardo Espinoza <ricardo@n8n.io> Co-authored-by: d3no <d3no520@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -4,8 +4,12 @@ import {
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialsDecrypted,
|
||||
ICredentialTestFunctions,
|
||||
IHookFunctions,
|
||||
INodeCredentialTestResult,
|
||||
INodePropertyOptions,
|
||||
JsonObject,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -51,7 +55,7 @@ export async function emeliaApiRequest(
|
||||
try {
|
||||
return await this.helpers.request!.call(this, options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
throw new NodeApiError(this.getNode(), (error as JsonObject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,5 +95,47 @@ export async function loadResource(
|
||||
name: campaign.name,
|
||||
value: campaign._id,
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
export async function emeliaApiTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data;
|
||||
|
||||
const body = {
|
||||
query: `
|
||||
query all_campaigns {
|
||||
all_campaigns {
|
||||
_id
|
||||
name
|
||||
status
|
||||
createdAt
|
||||
stats {
|
||||
mailsSent
|
||||
}
|
||||
}
|
||||
}`,
|
||||
operationName: 'all_campaigns',
|
||||
};
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
Authorization: credentials?.apiKey,
|
||||
},
|
||||
method: 'POST',
|
||||
body,
|
||||
uri: `https://graphql.emelia.io/graphql`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
try {
|
||||
await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 'Error',
|
||||
message: `Connection details not valid: ${(error as JsonObject).message}`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: 'OK',
|
||||
message: 'Authentication successful!',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user