diff --git a/extensions/ringcentral/src/monitor.ts b/extensions/ringcentral/src/monitor.ts index c1320e0fb..3b54cddd6 100644 --- a/extensions/ringcentral/src/monitor.ts +++ b/extensions/ringcentral/src/monitor.ts @@ -162,10 +162,15 @@ async function processMessageWithPipeline(params: { const rawBody = messageText || (hasMedia ? "" : ""); if (!rawBody) return; - // Skip messages from self (bot) - if (ownerId && senderId === ownerId) { - logVerbose(core, runtime, "skip self-authored message"); - return; + // In JWT mode (selfOnly), only accept messages from the JWT user themselves + // This is because the bot uses the JWT user's identity, so we're essentially + // having a conversation with ourselves (the AI assistant) + const selfOnly = account.config.selfOnly !== false; // default true + if (selfOnly && ownerId) { + if (senderId !== ownerId) { + logVerbose(core, runtime, `ignore message from non-owner: ${senderId} (selfOnly mode)`); + return; + } } // Fetch chat info to determine type diff --git a/extensions/ringcentral/src/types.ts b/extensions/ringcentral/src/types.ts index c870a3c0d..adf017997 100644 --- a/extensions/ringcentral/src/types.ts +++ b/extensions/ringcentral/src/types.ts @@ -115,6 +115,7 @@ export type RingCentralAccountConfig = { allowBots?: boolean; botExtensionId?: string; replyToMode?: "off" | "all"; + selfOnly?: boolean; // JWT mode: only accept messages from the JWT user (default: true) }; export type RingCentralConfig = RingCentralAccountConfig & {