From 04b2901e1f70b31683ee3c9eb972c48d81bd7f26 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Tue, 27 Jan 2026 11:36:20 +0400 Subject: [PATCH] feat: Conversation workflows(EE) (#13040) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are expanding Chatwoot’s automation capabilities by introducing **Conversation Workflows**, a dedicated section in settings where teams can configure rules that govern how conversations are closed and what information agents must fill before resolving. This feature helps teams enforce data consistency, collect structured resolution information, and ensure downstream reporting is accurate. Instead of having auto‑resolution buried inside Account Settings, we introduced a new sidebar item: - Auto‑resolve conversations (existing behaviour) - Required attributes on resolution (new) This groups all conversation‑closing logic into a single place. #### Required Attributes on Resolve Admins can now pick which custom conversation attributes must be filled before an agent can resolve a conversation. **How it works** - Admin selects one or more attributes from the list of existing conversation level custom attributes. - These selected attributes become mandatory during resolution. - List all the attributes configured via Required Attributes (Text, Number, Link, Date, List, Checkbox) - When an agent clicks Resolve Conversation: If attributes already have values → the conversation resolves normally. If attributes are missing → a modal appears prompting the agent to fill them. CleanShot 2025-12-10 at 11 42
23@2x #### Custom Attributes Integration On the Custom Attributes page, we will surfaced indicators showing how each attribute is being used. Each attribute will show badges such as: - Resolution → used in the required‑on‑resolve workflow - Pre‑chat form → already existing CleanShot 2025-12-10 at 11 43
42@2x #### Admin Flow - Navigate to Settings → Conversation Workflows. - Under Required attributes on resolve, click Add Required Attribute. - Pick from the dropdown list of conversation attributes. - Save changes. Agents will now be prompted automatically whenever they resolve. CleanShot 2025-12-10 at 11 44 42@2x #### NOTES - The Required Attributes on Resolve modal should only appear when values are missing. - Required attributes must block the resolution action until satisfied. - Bulk‑resolve actions should follow the same rules — any conversation missing attributes cannot be bulk‑resolved, rest will be resolved, show a notification that the resolution cannot be done. - API resolution does not respect the attributes. --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: iamsivin Co-authored-by: Pranav --- app/controllers/api/v1/accounts_controller.rb | 9 +- .../ConversationRequiredEmpty.vue | 17 + .../ConversationRequiredAttributeItem.vue | 56 +++ .../ConversationRequiredAttributes.vue | 186 ++++++++++ .../ConversationResolveAttributesModal.vue | 248 +++++++++++++ .../ConversationWorkflow/constants.js | 8 + .../components-next/input/ChoiceToggle.vue | 45 +++ .../components-next/sidebar/Sidebar.vue | 10 +- .../components-next/textarea/TextArea.vue | 8 +- .../dashboard/components/ChatList.vue | 92 ++++- .../components/buttons/ResolveAction.vue | 74 +++- .../composables/chatlist/useBulkActions.js | 65 +++- .../useConversationRequiredAttributes.spec.js | 348 ++++++++++++++++++ .../useConversationRequiredAttributes.js | 97 +++++ app/javascript/dashboard/featureFlags.js | 2 + .../i18n/locale/en/attributesMgmt.json | 4 + .../dashboard/i18n/locale/en/bulkActions.json | 4 + .../dashboard/i18n/locale/en/general.json | 4 + .../dashboard/i18n/locale/en/settings.json | 55 ++- .../customAttributes/CustomAttributes.vue | 5 +- .../dashboard/settings/account/Index.vue | 9 - .../account/components/AutoResolve.vue | 152 ++++---- .../settings/attributes/CustomAttribute.vue | 176 --------- .../conversationWorkflow.routes.js | 22 ++ .../settings/conversationWorkflow/index.vue | 48 +++ .../dashboard/settings/settings.routes.js | 2 + .../store/modules/conversations/actions.js | 19 +- .../store/modules/conversations/index.js | 16 +- .../specs/conversations/actions.spec.js | 8 +- .../specs/conversations/mutations.spec.js | 10 +- app/models/account.rb | 2 +- app/models/custom_attribute_definition.rb | 10 +- config/features.yml | 4 + .../enterprise/api/v1/accounts_settings.rb | 7 + .../app/models/enterprise/concerns/account.rb | 2 + .../concerns/custom_attribute_definition.rb | 16 + .../billing/handle_stripe_event_service.rb | 2 +- enterprise/config/premium_features.yml | 1 + .../custom_attribute_definition_spec.rb | 0 39 files changed, 1514 insertions(+), 329 deletions(-) create mode 100644 app/javascript/dashboard/components-next/Conversation/ConversationRequiredEmpty.vue create mode 100644 app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributeItem.vue create mode 100644 app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributes.vue create mode 100644 app/javascript/dashboard/components-next/ConversationWorkflow/ConversationResolveAttributesModal.vue create mode 100644 app/javascript/dashboard/components-next/ConversationWorkflow/constants.js create mode 100644 app/javascript/dashboard/components-next/input/ChoiceToggle.vue create mode 100644 app/javascript/dashboard/composables/spec/useConversationRequiredAttributes.spec.js create mode 100644 app/javascript/dashboard/composables/useConversationRequiredAttributes.js delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue create mode 100644 app/javascript/dashboard/routes/dashboard/settings/conversationWorkflow/conversationWorkflow.routes.js create mode 100644 app/javascript/dashboard/routes/dashboard/settings/conversationWorkflow/index.vue create mode 100644 enterprise/app/controllers/enterprise/api/v1/accounts_settings.rb create mode 100644 enterprise/app/models/enterprise/concerns/custom_attribute_definition.rb rename spec/{ => enterprise}/models/custom_attribute_definition_spec.rb (100%) diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 57062a5b2..bcbf80355 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -92,8 +92,11 @@ class Api::V1::AccountsController < Api::BaseController end def settings_params - params.permit(:auto_resolve_after, :auto_resolve_message, :auto_resolve_ignore_waiting, :audio_transcriptions, :auto_resolve_label, - conversation_required_attributes: []) + params.permit(*permitted_settings_attributes) + end + + def permitted_settings_attributes + [:auto_resolve_after, :auto_resolve_message, :auto_resolve_ignore_waiting, :audio_transcriptions, :auto_resolve_label] end def check_signup_enabled @@ -112,3 +115,5 @@ class Api::V1::AccountsController < Api::BaseController } end end + +Api::V1::AccountsController.prepend_mod_with('Api::V1::AccountsSettings') diff --git a/app/javascript/dashboard/components-next/Conversation/ConversationRequiredEmpty.vue b/app/javascript/dashboard/components-next/Conversation/ConversationRequiredEmpty.vue new file mode 100644 index 000000000..36687245e --- /dev/null +++ b/app/javascript/dashboard/components-next/Conversation/ConversationRequiredEmpty.vue @@ -0,0 +1,17 @@ + + + diff --git a/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributeItem.vue b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributeItem.vue new file mode 100644 index 000000000..70b4a7af5 --- /dev/null +++ b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributeItem.vue @@ -0,0 +1,56 @@ + + + diff --git a/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributes.vue b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributes.vue new file mode 100644 index 000000000..e611dd637 --- /dev/null +++ b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationRequiredAttributes.vue @@ -0,0 +1,186 @@ + + + diff --git a/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationResolveAttributesModal.vue b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationResolveAttributesModal.vue new file mode 100644 index 000000000..12e13f11e --- /dev/null +++ b/app/javascript/dashboard/components-next/ConversationWorkflow/ConversationResolveAttributesModal.vue @@ -0,0 +1,248 @@ + + +