diff --git a/src/api/integrations/chatbot/base-chatbot.controller.ts b/src/api/integrations/chatbot/base-chatbot.controller.ts index 05a45beb..3a472cd8 100644 --- a/src/api/integrations/chatbot/base-chatbot.controller.ts +++ b/src/api/integrations/chatbot/base-chatbot.controller.ts @@ -880,6 +880,12 @@ export abstract class BaseChatbotController { - // Check for triggerType 'all' - const findTriggerAll = await botRepository.findFirst({ + // Check for triggerType 'all' or 'none' (both should match any message) + const findTriggerAllOrNone = await botRepository.findFirst({ where: { enabled: true, - triggerType: 'all', + triggerType: { + in: ['all', 'none'], + }, instanceId: instanceId, }, }); - if (findTriggerAll) return findTriggerAll; + if (findTriggerAllOrNone) { + return findTriggerAllOrNone; + } const findTriggerAdvanced = await botRepository.findMany({ where: { @@ -36,7 +40,9 @@ export const findBotByTrigger = async (botRepository: any, content: string, inst }, }); - if (findTriggerEquals) return findTriggerEquals; + if (findTriggerEquals) { + return findTriggerEquals; + } // Check for regex match const findRegex = await botRepository.findMany({