Commit Graph

5017 Commits

Author SHA1 Message Date
gabrieljablonski
3e5a42e5bc chore: allow trailing slash on FRONTEND_URL 2025-05-13 17:45:25 -03:00
gabrieljablonski
027eb8de0b chore: add todo about denormalized brazilian phone numbers 2025-05-10 01:01:27 -03:00
gabrieljablonski
7cf3cf96e3 chore: fix docker compose postgres env variable 2025-05-10 01:00:47 -03:00
gabrieljablonski
04137ab932 chore: remove unused keys on BE locale 2025-05-09 12:28:28 -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
gabrieljablonski
eb68ab6a23 chore: update publish image workflow 2025-05-08 13:07:03 -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
gabrieljablonski
339271b93e chore: update workflows to trigger on tags instead of branches 2025-05-06 17:03:53 -03:00
Gabriel Jablonski
f90394fb2c
Merge pull request #41 from fazer-ai/chore/merge-upstream
Chore/merge upstream
2025-05-06 16:51:31 -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
Tanmay Deep Sharma
6e6912aa56
chore: Generate test data for bulk insertion (#11229)
Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
Co-authored-by: Sojan <sojan@pepalo.com>
Co-authored-by: tds-1 <tanmay@qoala.id>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-05-06 11:13:11 +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
312c35fe9a chore: update compose file 2025-05-02 22:09:53 -03:00
gabrieljablonski
add11d29c1 chore: drop FRONTEND_URL_EXTERNAL var 2025-05-02 20:44:10 -03:00
Gabriel Jablonski
1100260620
Merge pull request #38 from fazer-ai/chore/merge-upstream
Chore/merge upstream
2025-05-02 19:59:38 -03:00
gabrieljablonski
413078af19 chore: apply rubocop 2025-05-02 19:57:19 -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
669e60d9ca test: improved spec for reaction message building 2025-04-29 22:18:08 -03: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
gabrieljablonski
5440ab3f13 test: fix broken spec file 2025-04-29 21:43:14 -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
dependabot[bot]
948a118490
chore(deps): Bump net-imap from 0.4.19 to 0.4.20 (#11386)
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.4.19 to
0.4.20.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/ruby/net-imap/releases">net-imap's
releases</a>.</em></p>
<blockquote>
<h2>v0.4.20</h2>
<h2>What's Changed</h2>
<p>This release backports two features to prevent unbounded memory use:
the <code>response_handlers</code> keyword argument to
<code>Net::IMAP.new</code> so response handlers can be added before the
server can send any responses (<a
href="https://redirect.github.com/ruby/net-imap/pull/427">ruby/net-imap#427</a>),
and the <code>max_response_size</code> config attribute (<a
href="https://redirect.github.com/ruby/net-imap/pull/445">ruby/net-imap#445</a>).</p>
<blockquote>
<p>[!NOTE]
The default <code>max_response_size</code> is <code>nil</code>
(unlimited), to avoid backward compatibility issues with secure
connections to trusted servers that are well-behaved. It can be
configured more conservatively to guard against untrusted servers (for
example, connecting to user-provided hostnames). <em>It is the
responsibility of <code>net-imap</code> users to configure their client
appropriately for the server they are connecting to.</em></p>
</blockquote>
<h3>Added</h3>
<ul>
<li> Add <code>response_handlers</code> kwarg to
<code>Net::IMAP.new</code> by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/427">ruby/net-imap#427</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/419">#419</a></li>
</ul>
</li>
<li> Limit max_response_size by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/445">ruby/net-imap#445</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/444">#444</a></li>
</ul>
</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>📚 Backport documentation to v0.4 by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/426">ruby/net-imap#426</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/418">#418</a>, <a
href="https://redirect.github.com/ruby/net-imap/issues/420">#420</a>,
documentation only from <a
href="https://redirect.github.com/ruby/net-imap/issues/416">#416</a>,
and <a
href="https://redirect.github.com/ruby/net-imap/issues/424">#424</a></li>
</ul>
</li>
</ul>
<h3>Other Changes</h3>
<ul>
<li>♻️ Update versioned default configs by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/413">ruby/net-imap#413</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/412">#412</a></li>
</ul>
</li>
<li>♻️ Refactor <code>get_response</code> by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/431">ruby/net-imap#431</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/422">#422</a></li>
</ul>
</li>
<li>♻️ Rational config versions by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/430">ruby/net-imap#430</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/429">#429</a></li>
</ul>
</li>
<li>♻️ Extract ResponseReader from get_response by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/434">ruby/net-imap#434</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/433">#433</a></li>
</ul>
</li>
<li>♻️ Refactoring by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/436">ruby/net-imap#436</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/417">#417</a> and
<a
href="https://redirect.github.com/ruby/net-imap/issues/435">#435</a></li>
</ul>
</li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li> Various test improvements to v0.4 by <a
href="https://github.com/nevans"><code>@​nevans</code></a> in <a
href="https://redirect.github.com/ruby/net-imap/pull/425">ruby/net-imap#425</a>
<ul>
<li>Backports <a
href="https://redirect.github.com/ruby/net-imap/issues/414">#414</a>, <a
href="https://redirect.github.com/ruby/net-imap/issues/415">#415</a>, <a
href="https://redirect.github.com/ruby/net-imap/issues/421">#421</a>,
and <code>assert_pattern</code> from minitest (originally in <a
href="https://redirect.github.com/ruby/net-imap/issues/333">#333</a>)</li>
</ul>
</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/ruby/net-imap/compare/v0.4.19...v0.4.20">https://github.com/ruby/net-imap/compare/v0.4.19...v0.4.20</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5b8f9aece9"><code>5b8f9ae</code></a>
🔖 Bump version to 0.4.20</li>
<li><a
href="8222a369ce"><code>8222a36</code></a>
🔀 Merge pull request <a
href="https://redirect.github.com/ruby/net-imap/issues/445">#445</a>
from ruby/backport/v0.4-max_response_size</li>
<li><a
href="641c4c451e"><code>641c4c4</code></a>
 Fix backport compatibility with ruby 2.7</li>
<li><a
href="19bea631c3"><code>19bea63</code></a>
 Make max_response_size configurable</li>
<li><a
href="ddcaabd4fe"><code>ddcaabd</code></a>
 Limit max response size to 512MiB (hard-coded)</li>
<li><a
href="2ca4dbcaa4"><code>2ca4dbc</code></a>
🔀 Merge pull request <a
href="https://redirect.github.com/ruby/net-imap/issues/436">#436</a>
from ruby/backport/v0.4-refactor-config-and-respons...</li>
<li><a
href="9279f8aa11"><code>9279f8a</code></a>
 Fix backport compatibility with ruby 2.7</li>
<li><a
href="0e27fc1224"><code>0e27fc1</code></a>
♻️ Save ResponseReader ivars: <a
href="https://github.com/buff"><code>@​buff</code></a> &amp; <a
href="https://github.com/literal"><code>@​literal</code></a>_size</li>
<li><a
href="17064cd2f0"><code>17064cd</code></a>
 Fix backport compatibility with ruby 2.7</li>
<li><a
href="e4bb73453c"><code>e4bb734</code></a>
 Fix Config::AttrTypeCoercion for Ractor sharing</li>
<li>Additional commits viewable in <a
href="https://github.com/ruby/net-imap/compare/v0.4.19...v0.4.20">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=net-imap&package-manager=bundler&previous-version=0.4.19&new-version=0.4.20)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/chatwoot/chatwoot/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2025-04-28 20:49:26 -07:00
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
34becba25f chore: use FRONTEND_URL_EXTERNAL env var as default url options host 2025-04-25 23:18:47 -03:00