diff --git a/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts b/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts index 818f981..33cae26 100644 --- a/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts +++ b/packages/services/agent-service/src/infrastructure/feishu/feishu-router.service.ts @@ -127,12 +127,12 @@ export class FeishuRouterService implements OnModuleInit, OnModuleDestroy { // WebSocket long-connection client — SDK handles auth, reconnect, ping/pong, ACK this.wsClient = new lark.WSClient({ - appID: this.appId, + appId: this.appId, appSecret: this.appSecret, loggerLevel: lark.LoggerLevel.warn, }); - this.wsClient.start({ + const dispatcher = new lark.EventDispatcher({}).register({ 'im.message.receive_v1': async (data: any) => { try { await this.handleIncomingEvent(data); @@ -142,6 +142,8 @@ export class FeishuRouterService implements OnModuleInit, OnModuleDestroy { }, }); + this.wsClient.start({ eventDispatcher: dispatcher }); + this.cleanupTimer = setInterval(() => this.periodicCleanup(), CLEANUP_INTERVAL_MS); if (this.cleanupTimer.unref) this.cleanupTimer.unref();