first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.dhl",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Miscellaneous"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/dhl/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.dhl/"
}
]
},
"alias": ["Shipping"]
}
+159
View File
@@ -0,0 +1,159 @@
import {
type IExecuteFunctions,
type ICredentialDataDecryptedObject,
type ICredentialsDecrypted,
type ICredentialTestFunctions,
type IDataObject,
type INodeCredentialTestResult,
type INodeExecutionData,
type INodeType,
type INodeTypeDescription,
NodeConnectionTypes,
} from 'n8n-workflow';
import { dhlApiRequest, validateCredentials } from './GenericFunctions';
export class Dhl implements INodeType {
description: INodeTypeDescription = {
displayName: 'DHL',
name: 'dhl',
icon: 'file:dhl.svg',
group: ['input'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume DHL API',
defaults: {
name: 'DHL',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'dhlApi',
required: true,
testedBy: 'dhlApiCredentialTest',
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
noDataExpression: true,
type: 'hidden',
options: [
{
name: 'Shipment',
value: 'shipment',
},
],
default: 'shipment',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['shipment'],
},
},
options: [
{
name: 'Get Tracking Details',
value: 'get',
action: 'Get tracking details for a shipment',
},
],
default: 'get',
},
{
displayName: 'Tracking Number',
name: 'trackingNumber',
type: 'string',
required: true,
default: '',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
default: {},
options: [
{
displayName: "Recipient's Postal Code",
name: 'recipientPostalCode',
type: 'string',
default: '',
description:
"DHL will return more detailed information on the shipment when you provide the Recipient's Postal Code - it acts as a verification step",
},
],
},
],
};
methods = {
credentialTest: {
async dhlApiCredentialTest(
this: ICredentialTestFunctions,
credential: ICredentialsDecrypted,
): Promise<INodeCredentialTestResult> {
try {
await validateCredentials.call(this, credential.data as ICredentialDataDecryptedObject);
} catch (error) {
if (error.statusCode === 401) {
return {
status: 'Error',
message: 'The API Key included in the request is invalid',
};
}
}
return {
status: 'OK',
message: 'Connection successful!',
};
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: IDataObject[] = [];
let qs: IDataObject = {};
let responseData;
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
for (let i = 0; i < items.length; i++) {
try {
if (resource === 'shipment') {
if (operation === 'get') {
const trackingNumber = this.getNodeParameter('trackingNumber', i) as string;
const options = this.getNodeParameter('options', i);
qs = {
trackingNumber,
};
Object.assign(qs, options);
responseData = await dhlApiRequest.call(this, 'GET', '/track/shipments', {}, qs);
returnData.push(...(responseData.shipments as IDataObject[]));
}
}
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.description });
continue;
}
throw error;
}
}
return [this.helpers.returnJsonArray(returnData)];
}
}
@@ -0,0 +1,71 @@
import type {
ICredentialDataDecryptedObject,
ICredentialTestFunctions,
IDataObject,
IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
IRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function dhlApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
path: string,
body: any = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
const credentials = await this.getCredentials<{ apiKey: string }>('dhlApi');
let options: IRequestOptions = {
headers: {
'DHL-API-Key': credentials.apiKey,
},
method,
qs,
body,
uri: uri || `https://api-eu.dhl.com${path}`,
json: true,
};
options = Object.assign({}, options, option);
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function validateCredentials(
this: ICredentialTestFunctions,
decryptedCredentials: ICredentialDataDecryptedObject,
): Promise<any> {
const credentials = decryptedCredentials;
const { apiKey } = credentials as {
apiKey: string;
};
const options: IRequestOptions = {
headers: {
'DHL-API-Key': apiKey,
},
qs: {
trackingNumber: 123,
},
method: 'GET',
uri: 'https://api-eu.dhl.com/track/shipments',
json: true,
};
return await this.helpers.request(options);
}
@@ -0,0 +1,152 @@
{
"type": "object",
"properties": {
"destination": {
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"countryCode": {
"type": "string"
}
}
}
}
},
"details": {
"type": "object",
"properties": {
"pieceIds": {
"type": "array",
"items": {
"type": "string"
}
},
"product": {
"type": "object",
"properties": {
"productName": {
"type": "string"
}
}
},
"proofOfDeliverySignedAvailable": {
"type": "boolean"
},
"totalNumberOfPieces": {
"type": "integer"
},
"weight": {
"type": "object",
"properties": {
"unitText": {
"type": "string"
}
}
}
}
},
"events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"location": {
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"addressLocality": {
"type": "string"
}
}
}
}
},
"remark": {
"type": "string"
},
"status": {
"type": "string"
},
"statusCode": {
"type": "string"
},
"statusDetailed": {
"type": "string"
},
"timestamp": {
"type": "string"
}
}
}
},
"id": {
"type": "string"
},
"origin": {
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"countryCode": {
"type": "string"
}
}
}
}
},
"returnFlag": {
"type": "boolean"
},
"service": {
"type": "string"
},
"serviceUrl": {
"type": "string"
},
"status": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"location": {
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"addressLocality": {
"type": "string"
}
}
}
}
},
"remark": {
"type": "string"
},
"status": {
"type": "string"
},
"statusCode": {
"type": "string"
},
"statusDetailed": {
"type": "string"
},
"timestamp": {
"type": "string"
}
}
}
},
"version": 1
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 60 60"><path d="M56 60H4c-2.2 0-4-1.8-4-4V4c0-2.2 1.8-4 4-4h52c2.2 0 4 1.8 4 4v52c0 2.2-1.8 4-4 4" style="fill:#fc0"/><path d="M16.2 32.3H6v2h8.7zm2.7-3.7H6v2h11.4zm17.2-.7c-.5.7-1.3 1.8-1.8 2.5-.3.3-.7 1 .8 1h7.8s1.3-1.8 2.4-3.2c1.5-2 .1-6.2-5.2-6.2H19.2l-3.6 4.9h20c1 0 1 .4.5 1M6 38h6l1.5-2H6zm34.2 0H54v-2H41.6zm6.9-9.4-1.5 2H54v-2zm-5.5 4.5H29.3c-1.5 0-1.1-.6-.8-1 .5-.7 1.4-1.8 1.8-2.5.5-.7.8-1-.2-1h-9L14.2 38h17.7c5.2 0 8.4-3.2 9.7-4.9m1.3 1.2H54v-2h-9.6z" style="fill:#d40511"/></svg>

After

Width:  |  Height:  |  Size: 567 B