Commit Graph

3756 Commits

Author SHA1 Message Date
gabrieljablonski
027eb8de0b chore: add todo about denormalized brazilian phone numbers 2025-05-10 01:01:27 -03:00
Cayo P. R. Oliveira
322f0d1922
feat: use message is unsupported content attribute (#44)
* refactor: simplify message_type method using a hash for message types

* refactor: streamline message handling and update unsupported message logic

* refactor: simplify create_message method by inlining sender_type and message_type assignments

* refactor: simplify message_type method for improved readability and performance

* feat: allow is_recorded_audio as boolean

* chore: refactor create message + attach media logic

* fix: unsupported message templates

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-05-09 10:52:07 -03:00
gabrieljablonski
16637c03c6 feat: add support for file mimetypes and update attachment filename generation 2025-05-08 22:23:54 -03:00
gabrieljablonski
d4915e864f fix: create message with attachment in a single step 2025-05-08 21:36:06 -03:00
Cayo P. R. Oliveira
c6e505e924
feat: mark message as read (#43)
* feat: implement send_read_messages method for WhatsApp channel

* feat: implement messages_read event handling and dispatch for conversations

* feat: enhance messages_read handling to include last_seen_at and conversation context

* feat: update last_seen handling to reference agent_last_seen_at for messages read event

* chore: fix rebase

* feat: update error handling

* feat: update send_read_messages to mark received messages as not sent by the user

* test: controller spec

* test: channel listener

* test: channel and provider

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-05-08 11:07:57 -03:00
Gabriel Jablonski
19ad42a580
feat: dispatch to channel listener on availability change (#42) 2025-05-06 20:01:05 -03:00
Gabriel Jablonski
0f4587c740
Merge branch 'fazer-ai/main' into chore/merge-upstream 2025-05-06 16:50:51 -03:00
Cayo P. R. Oliveira
8d5a6bc4b5
feat: add flag to edited messages and content history tracking (#35)
* fix: handle protocol messages in IncomingMessageBaileysService and ignore it

* fix: ignore protocol messages before create conversation and contact

* feat: add flag to edited messages and content history tracking

* refactor: update message model to use edit_history instead of content_history for tracking edits

* refactor: update message model to track previous content instead of edit history

* test: fix message content update test to correctly track original content

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-05-06 16:40:09 -03:00
Muhsin Keloth
164f4ec90e
fix: Undefined local variable or method error for an instance of Instagram MessageText (#11421)
Fixes https://chatwoot-p3.sentry.io/issues/6557025930?project=6382945
2025-05-06 15:49:43 +05:30
Sivin Varghese
945fa5fd16
chore: Update message bubble orientation (#11348)
# Pull Request Template

## Description

This PR includes,

### Changes

1. **Message Orientation**:  
- Updated the bubble orientation of Bot, Agent, and Private Note
messages to align from **left** to **right**.

2. **Activity Message bubble Styling**:  
- Adjusted **padding** and **border-radius** for activity message
bubbles for better alignment and appearance.

| **Before**  | **After** |
| ------------- | ------------- |
| <img width="559" alt="image"
src="https://github.com/user-attachments/assets/18258ae0-0d8e-4447-a005-9b6643b71f81"
/> | <img width="559" alt="image"
src="https://github.com/user-attachments/assets/425785d8-17f9-4629-8301-f19f23aef201"
/> |




---


Fixes
[CW-4263](https://linear.app/chatwoot/issue/CW-4263/v410-messages-history-incoming-and-outgoing-renders-in-one-line),
https://github.com/chatwoot/chatwoot/issues/11340

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Loom video

https://www.loom.com/share/117bbb1dda98451883c9bb17f7cf016b?sid=05eae4d4-af11-4a41-a1d6-dc4e7e2cb281


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] 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
- [ ] 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>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Pranav <pranav@chatwoot.com>
2025-05-06 13:21:52 +05:30
Sivin Varghese
6ced918549
feat: Update conversation basic filter (#11415)
# Pull Request Template

## Description

This PR updates the basic filter UI for conversations.

## Type of change

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

## How Has This Been Tested?

### Loom video

https://www.loom.com/share/df69a023a39c4dfca2c12b1ee42a0b2e?sid=977e802e-2865-46f1-ae8e-f89ab5eabc2a


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] 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
- [ ] 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: Pranav <pranav@chatwoot.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-05-06 12:44:23 +05:30
Pranav
cbdbf7900e
fix: Update the character count for instructions (#11419)
- Increase the Captain instruction size to 20k instead of 2k
- Fix a display issue in the Captain playground and i18n issue in
Captain form.
2025-05-05 19:41:38 -07:00
Pranav
7cf051aba0
fix: Show campaigns only if the feature is enabled (#11420)
If the feature is disabled (manually or due to plan changes), the
customer cannot disable the existing campaigns. This PR would fix that.

Fixes
https://linear.app/chatwoot/issue/CW-3691/fix-disable-campaigns-on-plan-downgrade
2025-05-05 19:41:28 -07:00
Sivin Varghese
6b42305f59
fix: Show agent bot name and avatar correctly in messages (#11394)
This PR fixes an issue where messages from the agent bot were incorrectly displayed as "BOT" with a missing avatar. It now correctly shows the agent bot’s name and avatar URL in the message list.
2025-05-05 16:26:30 -07:00
Pranav
bfed849d6a
fix: Fix missing translations in copilot (#11411)
This PR does the following:

- Missing translations to the i18n file.
- Test the change with Malayalam (ml) translation. 
- Fixes overflow by setting the width to 100%

_Note_: The prompt text is also set for translation. This is
intentional, there is no change in the behaviour.

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-05-04 18:06:24 -07:00
Gabriel Jablonski
62ef2113d5
feat: toggle typing status on channel provider (#39)
* feat: toggle typing status on channel provider

* refactor: general refactorings

* fix: check if channel implements method

* test: channel listener specs

* test: channel spec

* test: baileys service spec
2025-05-03 00:39:39 -03:00
gabrieljablonski
81d62d94f1 fix: nil reference to metadata 2025-05-02 22:19:20 -03:00
gabrieljablonski
add11d29c1 chore: drop FRONTEND_URL_EXTERNAL var 2025-05-02 20:44:10 -03:00
Gabriel Jablonski
af4ca9d974
Merge branch 'fazer-ai/main' into chore/merge-upstream 2025-05-02 19:55:54 -03:00
Gabriel Jablonski
b764f3997d
feat: mark recorded audio messages (#36)
* feat: mark recorded audio

* refactor: cleaner logic for message builder metadata

* test: message builder specs

* test: baileys service specs

* fix: correct method call for checking attachment filename in process_metadata
2025-05-02 19:51:43 -03:00
Vishnu Narayanan
f3a807c6f0
chore: enable stale contact removal job on chatwoot cloud (#11390)
- enable stale contact/contact inboxes removal job on chatwoot cloud
2025-05-02 13:36:30 +05:30
Chatwoot Bot
55316ea0a0
chore: Update translations (#11404) 2025-05-01 16:10:29 -07:00
Shivam Mishra
3630277d00
fix: Update flag from countries.js (#11401) 2025-05-01 09:03:36 -07:00
Cayo P. R. Oliveira
a52a4cf8ce
fix: ignore protocolMessages (#34)
* fix: handle protocol messages in IncomingMessageBaileysService and ignore it

* fix: ignore protocol messages before create conversation and contact

* chore: update test description for contact inbox and message creation

* chore: simplify protocol message check in handle_message method
2025-04-30 21:33:53 -03:00
Chatwoot Bot
251abd02b0
chore: Update translations (#11400) 2025-04-30 15:34:11 -07:00
gabrieljablonski
1e679146f7 fix: fromMe field based on message type 2025-04-29 21:57:32 -03:00
gabrieljablonski
391407eedf fix: content attributes handling on message builder 2025-04-29 21:43:30 -03:00
Cayo P. R. Oliveira
8e913236e5
feat: baileys messages reactions (#33)
* fix: update send_message method to handle  baileys-api send-message changes

* chore: simplify update of is_unsupported

* feat: add support for message reactions in WhatsApp Baileys service

* chore: update context description for unsupported message in send_message spec

* feat: enhance incoming messages Baileys service to support message reactions and external source ID handling

* fix: correct typo in comment for is_reaction attribute in Message model

* chore: simplify message handling by removing external source ID checks and unused methods

* fix: update comment to reflect necessary change for source_id in set_contact method

* fix: refactor message handling for reactions and simplify jid generation

* fix: add comment to clarify behavior of find_message_by_source_id method

* fix: update unsupported message handling

* chore: specs for reaction messages

* fix: simplify message update handling by removing redundant validation method

* fix: update reaction message handling to use in_reply_to_external_id and fix spec

* fix: enhance message handling for unsupported types and update specs

* fix: update reaction message handling to set is_reaction flag and enhance specs

* fix: update specs for send message in reaction

* revert: remove mb0 from input

* fix: streamline jid generation in send_message_request

* refactor: specs

* refactor: move content attributes to helper

* test: spec for empty reaction

* refactor: streamline references to replied message

* test: refactor spec

* test: refactor spec

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-04-29 20:57:36 -03:00
Cayo P. R. Oliveira
8dc893d322
fix: baileys send message with jid (#32)
* fix: update send_message method to handle  baileys-api send-message changes

* chore: simplify update of is_unsupported

* refactor: remove useless helper

* fix: update send_message method to handle unsupported message content

* chore: handle unsupported message content in send_message method and update message status

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-04-29 20:52:09 -03:00
Pranav
fb6409508b
feat: Allow customizing the responses, flows in Captain (#11385)
- Ability to provide custom instructions to captain

<img width="1107" alt="Screenshot 2025-04-28 at 6 11 43 PM"
src="https://github.com/user-attachments/assets/f94cbccc-b4d8-48fd-b6b9-55524129bc50"
/>
2025-04-29 15:42:15 -07:00
Sojan Jose
970e76ace8
feat: API Endpoints to update message status (#11387)
- Added an api endpoint for update message status ( available only for
api inboxes )
- Moved message status management to a service. 
- Handles case where read status arrive before delivered 

fixes: #10314 , #9962
2025-04-29 15:33:11 -07:00
Shivam Mishra
fa4c1fadba
feat: use numbers when fetching from the API (#11391) 2025-04-29 18:12:16 +05:30
Shivam Mishra
59bae616cf
feat: add UI for contact notes (#11358)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-04-29 16:08:20 +05:30
Shivam Mishra
1a2e6dc4ee
feat: integrate LeadSquared CRM (#11284) 2025-04-29 09:14:00 +05:30
Sojan Jose
c63b583f90
chore: improve plan-based feature handling with plan hierarchy (#11335)
- Refactor HandleStripeEventService to better manage features by plan
- Add constants for features available in each plan tier (Startup,
Business, Enterprise)
- Add channel_instagram to Startup plan features
- Improve downgrade handling to properly disable higher-tier features
- Clean up and optimize tests for maintainability
- Add comprehensive test coverage for plan upgrades and downgrades

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-04-28 14:13:56 -07:00
gabrieljablonski
fd8e099f4d fix: compact message content in send_message method and add test for empty caption 2025-04-25 23:27:08 -03:00
gabrieljablonski
540f67aef6 Merge branch 'fazer-ai/main' into chore/merge-upstream 2025-04-25 16:57:00 -03:00
Cayo P. R. Oliveira
8fc14186e0
feat: process Baileys attachments, fix contact name creation, and handle unsupported messages (#26)
* fix: return not_found status for missing messages in WhatsApp webhook

* feat: enhance message handling to support image attachments

* chore: Handle incoming whatsapp baileys service attachments and implement specs for images and videos

* fix: add file_content_type method to incoming baileys messages

* chore: specs for stickers, audio and files

* fix: handle media attachment errors

* chore: convert file_content_type to string when attaching media

* fix: add handling for attachment not found error in incoming message service

* chore: refactor file_content_type method and simplify filename method

* chore: update media attachment tests

* feat: baileys unsupported message alert (#27)

* feat: create alert message for unsupported message types

* chore: fail message when try send not supported type in baileys

* chore: add tests for unsupported message handling in Baileys service

* chore: correct spelling

* chore: NIT in spec name

* chore: remove unnecessary message reload in unsupported message type test

* feat: baileys support to send attachments (#28)

* feat: enhance message sending logic with support for attachments and interactive messages

* fix: update message format to use messageContent for text messages

* feat: attachment message sending

* fix: use strict encoding for attachment file download

* chore: streamline message sending logic and remove unused error classes

* chore: remove type from message sending logic

* chore: update message sending specs

* chore: raise MessageNotSentError instead of updating message status to failed

* chore: change baileys contact name preferences (#30)

* refactor: improve contact name handling and extraction from JID

* test: enhance message handling to update contact names based on pushName and verifiedBizName

* chore: update contact name condition to match phone number from JID

* chore: correct method name typo

* chore: correct variable names for phone number consistency in tests

* chore: update message payload structure and improve error handling in send_message

* test: re-add testing for error handling

* feat: enhance contact name handling and add self-message detection

* fix: ensure presence check for verified business name in contact name retrieval

* test: improve specs

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>

* fix: try to disconnect baileys before destroy inbox (#29)

* fix: ensure proper disconnection of Baileys provider on channel destruction

* test: add callback tests for disconnecting channel provider in Whatsapp spec

* refactor: simplify condition for disconnecting Baileys provider on channel destruction

* refactor: enhance disconnect_channel_provider specs for Baileys provider

* test: verify channel destruction does not call disconnect_channel_provider

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>
2025-04-25 16:39:17 -03:00
Sivin Varghese
ef6949e32d
fix: Hover issue with Linear issue popup (#11376) 2025-04-25 10:14:23 +05:30
Sivin Varghese
9194984091
fix: Alignment issue with logo in standard type bubble (#11364) 2025-04-24 21:57:52 +05:30
David Kubeš
ecc95478b9
feat: widget opened and closed events (#11240)
Fixes #9272

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-04-24 17:01:39 +05:30
Sivin Varghese
73f768e0bf
fix: Handle slug validation errors in Help Center (#11368)
# Pull Request Template

## Description

This PR fixes an issue with slug validation in the Help Center portal
settings. Previously, users were able to create or update slugs with
invalid characters such as spaces, slashes, and special symbols, which
cause help center to crash.

With this update, slug creation and updates are now properly validated.
Only slugs that match the allowed pattern will be accepted. No spaces,
underscores, slashes, or special characters are allowed.

Examples: **user**, **user-guide**

---

Fixes
https://linear.app/chatwoot/issue/CW-4273/add-validation-for-help-centre-slugs

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Loom video

https://www.loom.com/share/a2ca5e2104984f28b29539293ffed33a?sid=e5064cb8-6220-4c43-99da-242c25d32027


## 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
2025-04-24 16:58:05 +05:30
Muhsin Keloth
76bec9a3ff
fix: Add missing 'hc' path segment after custom domain in article URLs (#11353) 2025-04-22 21:53:50 +05:30
Muhsin Keloth
e3bacd27d8
feat: Add custom domain to article URL if custom domain exists for the portal (#11349)
Portals can have custom domains. When inserting or previewing articles,
we consider the frontend URL. This PR fixes article URL generation to
properly include the portal's custom domain.
2025-04-22 20:54:09 +05:30
Sivin Varghese
9c711bab74
fix: Inconsistent widget bubble focus outline shape (#11345)
# Pull Request Template

## Description

This PR resolves the issue where the focus outline for the standard
bubble type appears as a square in Safari, while it appears circular in
Chrome.

Fixes
[CW-4252](https://linear.app/chatwoot/issue/CW-4252/v41-circle-around-campaign-pop-up-warped),
https://github.com/chatwoot/chatwoot/issues/11327

**Cause**
In Chrome, the focus outline for the standard bubble type is circular,
but in Safari, it appears square. This is due to a 20px margin on the
SVG inside the bubble.

**Solution**
The `20px` margin was removed from the SVG, fixing the focus outline to
appear circular in Safari browser.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Loom Video

https://www.loom.com/share/cc4244f369f84b98afaef539b79abcfe?sid=e957df16-1a53-4349-8bdc-705b2ed82d45

### Screenshots
**Before** 

https://www.loom.com/share/e858417722c64df6801ea87e4b89779f?sid=81a0acec-c5f0-4daa-832c-1f23289e2352
<img width="100" alt="image"
src="https://github.com/user-attachments/assets/19c6b62c-96da-485b-9fe8-223065415369"
/>

**After**

https://www.loom.com/share/3946546382884a33a8fef89f81faf7c2?sid=feeaf18c-2b3d-4d4f-bcdf-70335b456dd1
<img width="100" alt="image"
src="https://github.com/user-attachments/assets/0e83d9e3-3153-47ef-9f2d-0a2f7270935c"
/>




## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] 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
- [ ] 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
2025-04-21 16:53:52 -07:00
Muhsin Keloth
0a394e16ca
chore: Audit message characters across all channels (#11343)
- Audited message characters across all channels.
- Replaced `isAInstagramChannel` with `isAnInstagramChannel`
2025-04-21 14:46:51 +05:30
Muhsin Keloth
1531772365
chore: Migrated Instagram inbox warning style issues (#11332)
**Before**
![CleanShot 2025-04-17 at 22 53
28@2x](https://github.com/user-attachments/assets/00841dd1-ca1f-47b3-9972-6c9100bd2291)

![CleanShot 2025-04-17 at 22 53
46@2x](https://github.com/user-attachments/assets/648a4770-3aea-4b84-9456-6941744a4d65)


**After**
![CleanShot 2025-04-17 at 22 50
40@2x](https://github.com/user-attachments/assets/d37250fd-5400-4548-82f4-ab0c3b417b3a)
![CleanShot 2025-04-17 at 22 50
47@2x](https://github.com/user-attachments/assets/ca611297-8dd0-4bd9-b6b6-02660c252aa9)

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
2025-04-21 14:17:39 +05:30
Sivin Varghese
c24a6dc74c
fix: Prevent CC/BCC field reset on chat activity actions (#11342)
# Pull Request Template

## Description

This PR fixes the CC/BCC field reset issue on activity action.
Fixes
[CW-4256](https://linear.app/chatwoot/issue/CW-4256/emails-added-in-cc-and-bcc-disappears-when-you-click-on-assign-to-me),
#5234

### Cause of the Issue
Previously, the CC and BCC fields in the reply box were being reset
whenever a conversation activity occurred (such as assignment, status
change, etc.). This happened because watchers on the current chat
messages array and current chat object would trigger
`setCCAndToEmailsFromLastChat` even when the last message was an
activity or system message, not a real email.

### Solution

- The updated logic ensures that the CC and BCC fields are only set
under the following conditions:
   **1**. Switching to a new conversation.
**2**. In the same conversation, only if the last message is not an
activity (i.e., only for actual emails).

- It uses the `lastEmail` computed property, which filters out private
and activity messages, ensuring only real email context changes update
the fields.
- This prevents user-entered `CC/BCC` values from being cleared after
system events (e.g., assignments or status changes), while still
updating the fields correctly when relevant messages are received.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Loom video
**Before**

https://www.loom.com/share/2ec50dd1c0ed4eaf9170465274bea41e?sid=cc8b88cb-fd39-473a-8df3-78a242c8407b

**After**

https://www.loom.com/share/17fd2d96d5d84a049dcbf20d401d2ada?sid=8949ad48-7769-49d2-92c5-267da8c60d6e



## 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
- [ ] 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
2025-04-21 13:48:56 +05:30
mnsbr
aeef091084
fix: correct typo in CampaignConversationBuilder (#11336)
## Description

Fixed a typo in the `CampaignConversationBuilder` class.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

Verified that the typo fix does not affect functionality by running the
existing test suite.

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] New and existing unit tests pass locally with my changes

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-04-21 11:57:38 +05:30
Muhsin Keloth
97895db85e
chore: Disable warnings old Instagram inbox for messenger conversations (#11329)
We have added warnings for existing Instagram messenger inboxes via
https://github.com/chatwoot/chatwoot/pull/11303. However, an issue arose
where warnings were incorrectly displaying for messenger conversations.
This PR resolves that issue.
2025-04-17 15:47:56 +05:30