Custom nodes

A custom node is the simplest node type: it receives one message, optionally mutates the payload, and returns it. No external HTTP, no fan-out, no state outside the message itself. Use custom nodes for transformations, filters, decisions, and any local logic that does not belong in a connector.

For background see Concepts: Topologies.

Class to extend #

SDKBase class
Node.jsACommonNode (in @orchesty/nodejs-sdk/dist/lib/Commons/ACommonNode)
PHPCommonNodeAbstract (in Hanaboso\PipesPhpSdk\CustomNode)

Mapper example #

A mapper that converts a Hubspot contact into the canonical shape the rest of your topology expects:

Node.js
// worker/src/Mapper/HubspotContactToCanonical.ts
import ACommonNode from '@orchesty/nodejs-sdk/dist/lib/Commons/ACommonNode';
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';

export default class HubspotContactToCanonical extends ACommonNode {
    public getName(): string {
        return 'hubspot-contact-to-canonical';
    }

    public async processAction(dto: ProcessDto): Promise<ProcessDto> {
        const contact = dto.getJsonData() as {
            id: string;
            properties: { firstname?: string; lastname?: string; email?: string };
        };

        dto.setJsonData({
            externalId: contact.id,
            firstName: contact.properties.firstname ?? '',
            lastName: contact.properties.lastname ?? '',
            email: contact.properties.email ?? '',
        });
        return dto;
    }
}

Filter / branching example #

A filter that drops a message when the contact is missing an email:

Node.js
import { ResultCode } from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';

public async processAction(dto: ProcessDto): Promise<ProcessDto> {
    const data = dto.getJsonData() as { email?: string };
    if (!data.email) {
        dto.setStopProcess(ResultCode.STOP_AND_FAILED, 'Missing email');
    }
    return dto;
}

setStopProcess() ends this branch of the process. Use STOP_AND_OK to stop without error, STOP_AND_FAILED to route to the next failure handler, and the routing options described in Topologies for branching to a named successor.

Register the node #

Node.js
import HubspotContactToCanonical from './Mapper/HubspotContactToCanonical';
container.setNode(new HubspotContactToCanonical());

Custom nodes that don't authenticate against an external service are registered without an Application reference.

See also #

© 2025 Orchesty Solutions. All rights reserved.