From 344e8d501656463cb0eba51c1689b631c1300471 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Wed, 29 Oct 2025 14:03:43 +0530 Subject: [PATCH] fix: Exclude authentication templates from WhatsApp template selection (#12753) This PR add the changes for excluding the authentication templates from the WhatsApp template selection in the frontend, as these templates are not supported at the moment. Reference: https://www.chatwoot.com/hc/user-guide/articles/1754940076-whatsapp-templates#what-is-not-supported --- .../dashboard/store/modules/inboxes.js | 5 +++ .../modules/specs/inboxes/getters.spec.js | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/app/javascript/dashboard/store/modules/inboxes.js b/app/javascript/dashboard/store/modules/inboxes.js index 9886be679..5d788e8ce 100644 --- a/app/javascript/dashboard/store/modules/inboxes.js +++ b/app/javascript/dashboard/store/modules/inboxes.js @@ -78,6 +78,11 @@ export const getters = { return false; } + // Filter out authentication templates + if (template.category === 'AUTHENTICATION') { + return false; + } + // Filter out interactive templates (LIST, PRODUCT, CATALOG), location templates, and call permission templates const hasUnsupportedComponents = template.components.some( component => diff --git a/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js b/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js index eeb52b1dc..ac2aab26b 100644 --- a/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js +++ b/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js @@ -265,6 +265,39 @@ describe('#getters', () => { expect(result[0].name).toBe('regular_template'); }); + it('filters out authentication templates', () => { + const authenticationTemplates = [ + { + name: 'auth_template', + status: 'approved', + category: 'AUTHENTICATION', + components: [ + { type: 'BODY', text: 'Your verification code is {{1}}' }, + ], + }, + { + name: 'regular_template', + status: 'approved', + category: 'MARKETING', + components: [{ type: 'BODY', text: 'Regular message' }], + }, + ]; + + const state = { + records: [ + { + id: 1, + channel_type: 'Channel::Whatsapp', + message_templates: authenticationTemplates, + }, + ], + }; + + const result = getters.getFilteredWhatsAppTemplates(state)(1); + expect(result).toHaveLength(1); + expect(result[0].name).toBe('regular_template'); + }); + it('returns valid templates from fixture data', () => { const state = { records: [