Skip to main content

gateway

@codebolt/plugin-sdk


Variable: gateway

const gateway: {
offMessageToChannel: (callback: (message: ChannelMessage) => void) => void;
offReply: (callback: (reply: GatewayReply) => void) => void;
onMessageToChannel: (callback: (message: ChannelMessage) => void) => void;
onReply: (callback: (reply: GatewayReply) => void) => void;
registerChannel: (request: RegisterChannelRequest) => Promise<RegisterChannelResponse>;
routeMessage: (message: PluginGatewayMessage) => Promise<GatewayRouteResponse>;
unregisterChannel: () => Promise<void>;
};

Defined in: CodeBolt/packages/pluginSdk/src/modules/gateway.ts:158

Type Declaration

NameTypeDescriptionDefined in
offMessageToChannel()(callback: (message: ChannelMessage) => void) => voidRemove a previously registered messageToChannel callback.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:245
offReply()(callback: (reply: GatewayReply) => void) => voidRemove a previously registered reply callback.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:192
onMessageToChannel()(callback: (message: ChannelMessage) => void) => voidRegister a callback for proactive messages from the application. When the server wants to send a notification/message to a platform user, it pushes a gateway.messageToChannel event which triggers this callback.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:237
onReply()(callback: (reply: GatewayReply) => void) => voidRegister a callback for agent replies. When an agent sends a response on a gateway-managed thread, the server pushes a gateway.reply message which triggers this callback.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:184
registerChannel()(request: RegisterChannelRequest) => Promise<RegisterChannelResponse>Register this plugin as a channel in the ChannelStore so it appears in the Routing Rules view. Should be called once during plugin startup.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:204
routeMessage()(message: PluginGatewayMessage) => Promise<GatewayRouteResponse>Route an incoming platform message to the RoutingGateway. The server resolves the thread, finds/spawns the agent, and delivers the message.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:166
unregisterChannel()() => Promise<void>Unregister this plugin's channel from the ChannelStore. Should be called during plugin shutdown.CodeBolt/packages/pluginSdk/src/modules/gateway.ts:219