AWebhookApplication

Abstract base class for any webhook-aware Application. Subclass it instead of implementing IWebhookApplication directly — AWebhookApplication extends ABasicApplication, implements IWebhookApplication, and accepts a WebhookManager injection so the SDK can answer the platform's syncSubscribeWebhook / syncUnsubscribeWebhook / syncListWebhookEvents calls without extra glue.

import AWebhookApplication from '@orchesty/nodejs-sdk/dist/lib/Application/Base/AWebhookApplication';

Inheritance #

AApplication -> ABasicApplication -> AWebhookApplication (implements IWebhookApplication)

container.setApplication(...) automatically injects the WebhookManager into any AWebhookApplication it sees, so the sync action endpoints work out of the box.

Methods you implement #

Inherited from AApplication / ABasicApplication: getName, getPublicName, getDescription, getFormStack, getRequestDto, isAuthorized, getAuthorizationType.

AWebhookApplication adds the five abstract members of IWebhookApplication:

MethodReturnsPurpose
getWebhookSubscriptions()WebhookSubscription[]Catalogue of supported events shown in the editor's webhook picker.
getWebhookSubscribeRequestDto(install, subscription, url)RequestDtoHTTP request that registers a webhook with the third-party API.
getWebhookUnsubscribeRequestDto(install, webhook)RequestDtoHTTP request that removes a webhook by id.
processWebhookSubscribeResponse(response, install)stringParses the third-party response and returns the external webhook id.
processWebhookUnsubscribeResponse(response)booleanConfirms the unsubscribe succeeded.

You should also override getApplicationType() to return ApplicationTypeEnum.WEBHOOK so the platform routes inbound events to the topology entry node instead of treating the topology as cron-driven.

Sync actions provided #

Three sync actions become available without you wiring them yourself:

ActionBodyPurpose
syncListWebhookEvents{}Returns the catalog populated by getWebhookSubscriptions() (consumed by the editor's webhook picker).
syncSubscribeWebhook{ name, topology, node, parameters? }Registers the webhook upstream and writes the live Webhook record.
syncUnsubscribeWebhook{ name?, topology?, node? }Removes a single registration matching the filter.

The topology and node from the request body always win over any deprecated values held by the WebhookSubscription, so the SDK never has to invent names.

Example #

import AWebhookApplication from '@orchesty/nodejs-sdk/dist/lib/Application/Base/AWebhookApplication';
import WebhookSubscription from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Webhook/WebhookSubscription';
import { ApplicationTypeEnum } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/ApplicationTypeEnum';

export default class MyApp extends AWebhookApplication {
    public getName(): string { return 'my-app'; }
    public getPublicName(): string { return 'My App'; }
    public getDescription(): string { return 'Webhook example.'; }
    public getApplicationType(): ApplicationTypeEnum { return ApplicationTypeEnum.WEBHOOK; }

    public getWebhookSubscriptions(): WebhookSubscription[] {
        return [
            WebhookSubscription.create('order.created', { source: 'my-app' }, 'Fired when a new order is placed'),
            WebhookSubscription.create('order.updated', {}, 'Fired on order status / item changes'),
            WebhookSubscription.create('ping'),
        ];
    }

    // ... getWebhookSubscribeRequestDto / processWebhookSubscribeResponse
    // ... getWebhookUnsubscribeRequestDto / processWebhookUnsubscribeResponse
    // ... auth methods inherited from ABasicApplication
}

For the full lifecycle — picker, Subscribe / Unsubscribe modal, cascade on enable / disable, orphan banner — see Patterns: Webhooks.

See also #

© 2025 Orchesty Solutions. All rights reserved.