Commit Graph

261 Commits

Author SHA1 Message Date
Muhsin Keloth
d9450fde4a feat: Added Instagram channel migration (#11181)
This PR is part of https://github.com/chatwoot/chatwoot/pull/11054 to
make the review cycle easier.
2025-03-26 11:12:32 +05:30
Pranav
bf5e4a92dd chore: Limit the number of articles retrieved by widget (#11095)
The UI displays only six articles, and this update introduces a per_page
parameter to control the number of articles returned per API call. The
value is capped between 1 and 100, with a default fallback if a lower
number is set.

This change is necessary due to high website traffic, where excessive
payloads are returned without adding value.

**Changes:** 
- Add index to status, account_id, portal_id, views.
- Add per_page param in the API.
- Update the code in the frontend to fetch only 6
2025-03-15 14:10:12 -07:00
Pranav
ecfa6bf6a2 feat: Add support for account abuse detection (#11001)
This PR adds service to automate account abuse detection. Currently
based on the signup name and URL, could potentially add more context
such as usage analysis, message metadata etc.
2025-02-28 15:28:19 -08:00
Sivin Varghese
55d41b112b feat: Show shared contact's name in Telegram channel (#10856)
# Pull Request Template

## Description

This PR adds the ability to see the shared contact name in Telegram
channels.

## Type of change

- [x] New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

**Loom video**

https://www.loom.com/share/cd318056ad4d44d4a1fc4b5d4ad38d60?sid=26d833ae-ded9-4cf0-9af7-81eecfa37f19


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-02-11 19:39:54 +05:30
Pranav
0b4028b95d feat: Add support for the references in FAQs (#10699)
Currently, it’s unclear whether an FAQ item is generated from a
document, derived from a conversation, or added manually.

This PR resolves the issue by providing visibility into the source of
each FAQ. Users can now see whether an FAQ was generated or manually
added and, if applicable, by whom.

- Move the document_id to a polymorphic relation (documentable).
- Updated the APIs to accommodate the change.
- Update the service to add corresponding references. 
- Updated the specs.

<img width="1007" alt="Screenshot 2025-01-15 at 11 27 56 PM"
src="https://github.com/user-attachments/assets/7d58f798-19c0-4407-b3e2-748a919d14af"
/>

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-01-16 15:27:30 +05:30
Pranav
6096932f76 feat: Add a review step for FAQs generated from conversations before using it (#10693)
This PR introduces a review step for generated FAQs, allowing a human to
validate and approve them before use in customer interactions. While
hallucinations are minimal, this step ensures accurate and reliable FAQs
for Captain to use during LLM calls when responding to customers.

- Added a status field for the FAQ
- Allow the filter on the UI.
<img width="1072" alt="Screenshot 2025-01-15 at 6 39 26 PM"
src="https://github.com/user-attachments/assets/81dfc038-31e9-40e6-8a09-586ebc4e8384"
/>
2025-01-16 09:54:34 +05:30
Pranav
d070743383 feat(ee): Add Captain features (#10665)
Migration Guide: https://chwt.app/v4/migration

This PR imports all the work related to Captain into the EE codebase. Captain represents the AI-based features in Chatwoot and includes the following key components:

- Assistant: An assistant has a persona, the product it would be trained on. At the moment, the data at which it is trained is from websites. Future integrations on Notion documents, PDF etc. This PR enables connecting an assistant to an inbox. The assistant would run the conversation every time before transferring it to an agent.
- Copilot for Agents: When an agent is supporting a customer, we will be able to offer additional help to lookup some data or fetch information from integrations etc via copilot.
- Conversation FAQ generator: When a conversation is resolved, the Captain integration would identify questions which were not in the knowledge base.
- CRM memory: Learns from the conversations and identifies important information about the contact.

---------

Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-01-14 16:15:47 -08:00
Pranav
d69571f6f8 fix: Update old data to fix login issues (#10594)
The following lines caused issues for some users, specifically those who
signed up in 2021 when audio alerts were implemented as a flag. The data
type update for the flag was not handled correctly. This PR fixes the
issue by updating it to a compatible value.


9410b3bcbb/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js (L76-L81)
2024-12-17 17:17:11 +05:30
Pranav
d79d9e8b46 fix: Include uncategorized articles in the all article section to allow edit/delete (#10153)
Fixes https://github.com/chatwoot/chatwoot/issues/9935
Fixes https://github.com/chatwoot/chatwoot/issues/8213

The articles were grouped by category, with locale being a derived
attribute from the category. If a category was deleted, the article
wouldn't appear on the dashboard. However, due to a bug, it would show
up in the uncategorized section on the public portal, leaving agents
unable to edit or update the article.

To address this issue, I've added a locale attribute directly to the
article. This attribute is automatically set from the category or the
portal's default locale if not supplied. The API parameters now use this
attribute to filter articles. As a result, the dashboard will display
articles even if they're not associated with a category, improving the
overall workflow.

**Main updates:** 
- Add locale attribute to the Article model. Add db migration to back
fill the data based on the above logic.
- Add a new scope search_by_locale and use it instead of
search_by_category_locale.
- Update the ERB template to include the locale filter.
- Move from `joins` to `left_outer_joins` to include the articles with
no categories.

---------

Co-authored-by: Sojan <sojan@pepalo.com>
2024-09-23 23:39:03 -07:00
Sojan Jose
b61ad6e41a feat: Add APIs to manage custom roles in Chatwoot (#9995)
Co-authored-by: Pranav <pranavrajs@gmail.com>
2024-08-23 17:18:28 +05:30
Sojan Jose
7b83480979 chore: Add indexes to improve reporting performance (#9478)
- Adding a new index on (account_id,created_at,message_type) based on
our performance improvement exercise. This index significantly improves
the page load speeds of messaging reports.
2024-05-15 21:21:15 -07:00
Sojan Jose
8520846b91 chore: Improved indexes for Conversations & Contacts [CW-3300] (#9475)
Based on our recent performant optimisation exercises, We have identified a better indexing strategy for conversations and contacts. The previous index on last_activity_at for conversations significantly slowed down conversation filters. Similarly, the new index on Contacts will allow the page rendering to improve for accounts with many contacts.

fixes: https://linear.app/chatwoot/issue/CW-3300/db-improvements
2024-05-15 16:10:39 -07:00
Pranav
3d31d4dd7f feat: Add widget to help center config (#9235) 2024-04-15 16:46:48 -07:00
Shivam Mishra
9917cb4273 fix: Convert cached_label_list to text (#9143) 2024-03-25 18:47:08 -07:00
Vishnu Narayanan
b017d05ed9 feat: add sla events table (#9126)
* feat: add sla events table

* chore: refactor to EE namespace

* chore: refactor

* chore: fix spec

* chore: add references to account,inbox,sla_policy

* chore: update specs

* chore: update spec to check backfilling id's

* Update spec/enterprise/models/sla_event_spec.rb
2024-03-20 11:59:37 +05:30
Pranav
505ede2761 fix: Change the column identifier from string to text to avoid overflow (#9073)
Fixes: https://linear.app/chatwoot/issue/CW-3118/cannot-subscribe-to-notifications-on-microsoft-edge

Fix the issue with notifications in Microsoft Edge. The Edge push notification payload identifier has more than 255 characters. The API calls were failing due to this. This PR would fix the issue.
2024-03-07 11:13:01 +05:30
Sojan Jose
ae4c8d818f feat: Ability to block contacts permanently (#8922)
Co-authored-by: Pranav <pranav@chatwoot.com>
2024-02-21 14:18:42 -08:00
Vishnu Narayanan
23230e0143 feat: sla-7 ensure applied_sla uniqueness (#8938)
* feat: refactor fetching sla in action service

* chore: modify spec

* chore: ensure applied_sla uniqueness

* chore: review fixes

* feat: add unique index on applied_sla

* chore: fix spec

* chore: add new specs to improve coverage

* chore: improve spec

* Update spec/enterprise/services/enterprise/action_service_spec.rb

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2024-02-20 21:59:49 +05:30
Muhsin Keloth
3b7b06dbec feat: Add meta to notification model (#8941)
* feat: Add meta and description to notification model

* chore: remove description
2024-02-16 14:38:02 +05:30
Vishnu Narayanan
c1d07a5471 feat: Add sidekiq jobs to monitor applied SLAs (#8828)
Fixes: https://linear.app/chatwoot/issue/CW-2983/sidekiq-jobservice-to-monitor-sla-breach

Co-authored-by: Sojan <sojan@pepalo.com>
2024-02-07 21:44:56 +04:00
Pranav Raj S
905ca94f71 chore: Remove unused attribute imap_inbox_synced_at (#8822)
- imap_inbox_synced_at is no longer used; this PR removes all the references to the same.
2024-01-31 11:48:46 +04:00
Muhsin Keloth
485c561b18 feat: Add attributes location and country_code to Contact model (#8803)
feat: Add attributes location and country_code to Contact model
2024-01-29 14:10:14 +05:30
Muhsin Keloth
fa907840c7 feat: Add middle_name and last_name to contact model (#8771)
feat: Add `middle_name` and `last_name`
2024-01-24 16:22:04 +05:30
Muhsin Keloth
143299f138 feat: Add contact_type attribute to contact model (#8768) 2024-01-24 12:26:47 +05:30
Vishnu Narayanan
232369cd5c feat: sla 1 - refactor sla_policies model and add applied_sla model (#8602)
* feat: add models

* chore: refactor sla column names

* chore: remove foreign keys

* chore: fix spec

* chore: refactor models
2024-01-23 23:48:02 +05:30
Surabhi Suman
4b40c61201 feat: Support Regex validation for custom attributes (#7856)
This allows a user to add/update a custom regex and a cue while defining custom attributes(Only applicable for type- text).
While adding/editing custom attributes, the values are validated against the attribute definition regex, and if it is incorrect, a cue message or default error message is shown and restricts invalid values from being saved.

Fixes: #6866
2024-01-23 18:01:57 +04:00
Muhsin Keloth
b5071e61d7 feat: Add last_activity_at field to Notification model (#8585) 2023-12-20 13:02:37 +05:30
Pranav Raj S
00eb5b152a chore(migration): Re-run database migration job for caching. (#8581)
A support request that came to Chatwoot Cloud revealed that the job was timed prematurely. The default timeout for Sidekiq queues was set as 25 minutes in sidekiq.yml file. The cache was not created properly for the accounts with more than 100k conversations.

This change removes the cache logic in the previous migration and creates a new migration with a new job which processes conversations in batch.
2023-12-18 17:29:02 -08:00
Pranav Raj S
890515edfd feat(perf): Cache labels on the conversation model (#8527) 2023-12-11 18:27:55 -08:00
Muhsin Keloth
76711d95ff chore: Change primary actor to Conversation for all the notification types. (#8435) 2023-12-06 10:43:09 +05:30
Muhsin Keloth
449503bb94 feat: Snooze notification API (#8439) 2023-12-04 12:32:35 +05:30
Shivam Mishra
5588d6e344 feat: convert feature_flag to bigint [CW-2767] (#8350)
Co-authored-by: Sojan <sojan@pepalo.com>
2023-11-17 15:50:24 -08:00
Sivin Varghese
35a9acf099 feat: Adds the ability to set an emoji for help center category (#8111) 2023-10-20 13:52:30 +05:30
Sojan Jose
a3d008da06 chore: Ensure null validation for private attribute in messages (#8085) 2023-10-11 13:16:59 +05:30
Pranav Raj S
3a547de909 fix: Update the default status of the hooks to enabled (#7652)
In the recent Slack integration update, we made changes to how hooks are handled. Now, hooks require an additional check to be enabled. By default, new hooks are created in a disabled state, which might lead to issues with the hooks not being executed as expected.

This migration updates the status attribute of hooks to have 'enabled' as the default value, ensuring that new hooks are enabled by default and can function properly.
2023-08-01 12:14:47 -07:00
Shivam Mishra
ff97536095 feat(perf): contact page loading speed (#7629) 2023-07-27 13:32:22 +05:30
Sojan Jose
1d718b92b7 chore: Fix schema disparities (#7554)
- Fixing the schema disparities that crept up during merges
- Also, fix the issue with migrate command regenerating the schema for contacts.rb model
2023-07-19 19:15:43 +03:00
Pranav Raj S
ec65b43993 feat: Add support for API key authentication in Twilio (#7523)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2023-07-14 19:20:54 -07:00
Tejaswini Chile
10dd0ba647 feat: Sentiment Analysis (#7475) 2023-07-12 15:03:31 +05:30
Tejaswini Chile
71837bedf9 feat: Ability to customise the email sender name [CW-1629] (#7345) 2023-07-04 20:46:01 +05:30
Pranav Raj S
93daaea19b feat: Add a sort option for conversations waiting for a reply from an agent (#7364) 2023-06-21 13:20:39 -07:00
Sojan Jose
595e6e79f0 chore: Add sla policy association to conversation (#7360)
Adds the sla policy association to the conversation

Fixes: https://linear.app/chatwoot/issue/CW-1615/applying-an-sla-to-the-conversation
2023-06-21 14:48:50 +05:30
Shivam Mishra
429ec7194f feat: add index to reporting events [CW-1960] (#7294)
* fix: annotation

* feat: add better index for reporting_events
2023-06-12 18:23:42 +05:30
Tejaswini Chile
879a244f93 fix: Automations condition based quoted text (#7272) 2023-06-09 17:00:05 +05:30
Shivam Mishra
44b1047b90 feat(perf): contacts query performance (#7175)
* feat: use more indexable where condition

* feat: add index concurrently

* chore: update schema

* refactor: update index name
2023-05-23 17:22:47 +05:30
Shivam Mishra
c70367bbd7 feat: add migration to fix image signed keys (#7076) 2023-05-15 15:13:26 +05:30
Muhsin Keloth
271263bcc2 feat: SLA CRUD APIs (EE) (#7027)
Fixes: https://linear.app/chatwoot/issue/CW-1613/sla-api

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2023-05-11 22:42:56 +05:30
Muhsin Keloth
c97d6021e0 chore: Add migration to set the default empty string value for contact name (#7052)
Fixes: https://linear.app/chatwoot/issue/CW-1650/issue-with-the-contact-name
2023-05-11 17:35:19 +05:30
Shivam Mishra
d0a1ad746a feat: add index migration (#7050) 2023-05-10 17:55:14 +05:30
Shivam Mishra
662967b5d3 feat(perf): add index to messages created at (#7044)
* feat: add index to messages created at

* feat: run migration
2023-05-10 11:34:49 +05:30