Node.js SDK Overview

The Orchesty Node.js SDK enables you to build custom applications, connectors, and batch processing nodes using TypeScript or JavaScript. It provides a comprehensive framework for API integration, OAuth2 authentication, data transformation, and workflow orchestration.

What Can You Build? #

Applications #

Applications handle authentication and provide configuration for API integrations:

Connectors #

Connectors perform specific actions in your integration workflows:

Core Concepts #

Data Transfer Objects #

Learn how data flows through your integrations:

Configuration & Forms #

Create user-friendly configuration interfaces:

Application Management #

Manage user credentials and application state:

Quick Start #

1. Install the SDK #

npm install @orchesty/nodejs-sdk

2. Create a Basic Application #

import { ABasicApplication } from '@orchesty/nodejs-sdk';
import { FormStack, Form, Field, FieldType, CoreFormsEnum } from '@orchesty/nodejs-sdk';

export default class MyAPIApplication extends ABasicApplication {
    public getName(): string {
        return 'my-api';
    }

    public getPublicName(): string {
        return 'My API';
    }

    public getDescription(): string {
        return 'Integration with My API service';
    }

    public getFormStack(): FormStack {
        const apiKeyField = new Field(FieldType.PASSWORD, 'api_key', 'API Key');
        const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, 'Authorization');
        form.addField(apiKeyField);
        
        const formStack = new FormStack();
        formStack.addForm(form);
        return formStack;
    }

    public getRequestDto(dto, applicationInstall, method, url, data): RequestDto {
        const settings = applicationInstall.getSettings();
        const apiKey = settings[CoreFormsEnum.AUTHORIZATION_FORM]['api_key'];
        
        const requestDto = new RequestDto(url, method, dto, data);
        requestDto.setHeaders({
            'Authorization': `Bearer ${apiKey}`,
            'Content-Type': 'application/json'
        });
        
        return requestDto;
    }
}

3. Create a Connector #

import AConnector from '@orchesty/nodejs-sdk';
import { ProcessDto, RequestDto, HttpMethods } from '@orchesty/nodejs-sdk';

export default class FetchDataConnector extends AConnector {
    public getName(): string {
        return 'fetch-data';
    }

    public async processAction(dto: ProcessDto): Promise<ProcessDto> {
        // Get application credentials
        const appInstall = await this.getApplicationInstallFromProcess(dto);
        
        // Make API request using your application
        const requestDto = await this.getApplication().getRequestDto(
            dto,
            appInstall,
            HttpMethods.GET,
            'https://api.example.com/data'
        );
        
        const responseDto = await this.getSender().send(requestDto);
        
        // Set output data
        dto.setJsonData(JSON.parse(responseDto.getBody()));
        
        return dto;
    }
}

4. Register Your Components #

import DIContainer from '@orchesty/nodejs-sdk';

const container = new DIContainer();

// Register application
const myApp = new MyAPIApplication();
container.setApplication(myApp);

// Register connector
const connector = new FetchDataConnector();
container.setConnector(connector);

Documentation Structure #

For Application Developers #

  1. Start with ABasicApplication or AOAuth2Application
  2. Learn about FormStack and Field for configuration
  3. Understand ApplicationInstall for credential management

For Connector Developers #

  1. Begin with AConnector basics
  2. Master ProcessDto for data handling
  3. Learn RequestDto for API calls

For Batch Processing #

  1. Explore ABatchNode for batch operations
  2. Work with BatchProcessDto for batch data

Common Patterns #

Pattern: API Integration #

  1. Create an application class extending ABasicApplication or AOAuth2Application
  2. Define configuration forms with FormStack
  3. Implement getRequestDto() to add authentication
  4. Create connectors extending AConnector for specific actions

Pattern: Data Transformation #

  1. Create a connector extending AConnector
  2. Read input with dto.getJsonData()
  3. Transform the data
  4. Set output with dto.setJsonData()

Pattern: Error Handling #

  1. Wrap API calls in try/catch
  2. Use dto.setStopProcess() for errors
  3. Return the DTO with error status

SDK Resources #

Getting Help #

See Also #

© 2025 Orchesty Solutions. All rights reserved.