Commit Graph

25 Commits

Author SHA1 Message Date
Muhsin Keloth
b1893c7d96 fix: Support location messages in Twilio WhatsApp integration (#11830)
Fixes location messages not appearing in conversations when sent via
Twilio. Location messages were being filtered out due to empty body
content and missing parameter handling.

![CleanShot 2025-06-27 at 20 48
12](https://github.com/user-attachments/assets/b5a75796-6937-49bc-b689-7d04f4ea5d09)
2025-06-30 11:35:32 +05:30
Tanmay Deep Sharma
3c8abd5b30 fix: Twilio authentication handling for WhatsApp attachments (#11536)
# Pull Request Template

## Description

This PR addresses an issue where users were unable to view images sent
via WhatsApp on Chatwoot due to incorrect Twilio authentication
configuration.
https://app.chatwoot.com/app/accounts/1/conversations/50824

The problem stemmed from how authentication was being handled for Twilio
API requests. The user had configured their inbox using api_key_sid, but
the backend logic used only auth_token, leading to failed
authentication. Further investigation showed that some customers might
input api_secret into the auth_token field unintentionally.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality not to work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

- Tested on console with Client(api_key_sid, auth_token, account_sid)
and validated successful authentication for the customer (Twilio channel
ID: 2702).
- Simulated toggling the “Use API Key Authentication” checkbox to ensure
backend behavior matches UI intent
- Verified image rendering by testing with the same image URL that was
previously failing for the user.

## 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
- [x] 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
- [x] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-05-21 18:40:15 +05:30
Tanmay Deep Sharma
e9cda40b71 fix: Twilio multiple attachment fix (#11452) 2025-05-16 08:56:37 +05:30
Sojan Jose
d107d0adec fix: Twilio channel attachment issues (#10167)
We received customer reports that attachments in Twilio messages
required page reloads to appear. This issue occurred because in the old
Twilio builder, we saved the message and attachment in two stages. The
new builders follow a streamlined approach, where both are saved in a
single transaction. This update aligns the Twilio channel with the new
builder format and resolves the issue.

### Testing:

Tests cover the attachment cases, ensuring that all original tests pass
with these changes.
2024-09-25 18:03:28 -07:00
Muhsin Keloth
682a2aea1c chore: Handle twillio Down::ClientError (#8757)
Fixes: https://linear.app/chatwoot/issue/CW-2992/downclienterror-400-bad-request-downclienterror
2024-01-22 15:33:26 +04:00
Muhsin Keloth
52a5a59ddb fix: Handle error if the Twillio attachment download fails to download (#8705) 2024-01-15 19:13:44 +05:30
Muhsin Keloth
7d6085cefd fix: Log twillio attachment error (#8703) 2024-01-15 12:46:58 +05:30
Muhsin Keloth
1577288843 fix: Twilo attachment download fallback to the step where authorization headers are not passed. (#8681)
In the previous release, we enabled "HTTP Basic Authentication" to secure all attachments requiring HTTP authentication. This is particularly important for media files that may contain sensitive data, as recommended by Twilio. However, some users experienced issues because they did not enable this option despite our alerts prompting them to do so.  If the authenticated attachment download call fails, add another call to download the attachment without authentication.
2024-01-11 17:23:31 -08:00
Muhsin Keloth
3ae64822e1 chore: Enforce HTTP Basic Authentication for Twilio medias. (#8396) 2023-11-27 13:24:53 +05:30
Sojan Jose
616371adbb chore: Improve the behavior of lock to single conversation (#7899) 2023-09-14 12:32:57 +05:30
Muhsin Keloth
18e9e771b5 fix: Check body exists before deleting null bytes in Twilio (#7910) 2023-09-13 13:40:26 +05:30
Jordan Brough
4f5c5e9f85 fix: Erase null bytes from incoming Twilio messages (#7901)
We've had some messages come in from a few different phone numbers that had null bytes in them. I don't know how this happens. They don't seem to be malicious.

They currently cause the Postgres gem to raise an error when Chatwoot attempts to save the message body to the database:

ArgumentError (string contains null byte)

Related Rails GitHub issue: rails/rails#26891
2023-09-12 18:07:18 -07:00
Pranav Raj S
f05535c5ad Revert "chore: Improve the behaviour of lock to single conversation (… (#7886) 2023-09-09 09:59:21 +05:30
Sojan Jose
bfd192ebb2 chore: Improve the behaviour of lock to single conversation (#7863) 2023-09-08 11:16:24 +05:30
Sojan Jose
e310230f62 chore: Refactor Contact Inbox Builders (#5617)
- Remove duplicate code and move everything to builders
- fixes: #4680
2022-10-13 15:12:04 -07:00
Jordan Brough
59b31615ed chore: Use "create!" and "save!" bang methods when not checking the result (#5358)
* Use "create!" when not checking for errors on the result
* Use "save!" when not checking the result
2022-09-13 17:40:06 +05:30
Sojan Jose
ea1a27c7d4 fix: Twilio channel selection when MessagingServiceSid is empty (#5040)
- Fixes channel selection logic in incoming_message_service for Twilio messages

ref: #4242
2022-07-14 15:16:07 +02:00
Jordan Brough
49d08a6773 feat: Support Twilio Messaging Services (#4242)
This allows sending and receiving from multiple phone numbers using Twilio messaging services

Fixes: #4204
2022-07-08 18:20:07 +05:30
Sojan Jose
8daf1fe033 chore: Add down gem for Local file downloads (#2765)
- Add down gem to handle downloading files to host machine
- Remove the LocalResource class
- Introduce max limit for contact avatars send via SDK
2021-08-11 16:40:28 +05:30
Sojan Jose
59bee66e63 chore: Handle exceptions on external URL calls (#1334) 2020-10-11 20:22:21 +05:30
Sojan Jose
afb5694ed6 chore: Enable runtime metrics on Heroku (#1178)
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
2020-09-03 15:24:08 +05:30
Sojan Jose
2193de9853 chore: General fixes and clean up (#1169) 2020-08-25 23:04:02 +05:30
Sojan Jose
cc02611007 Chore: Convert Message Sender to polymorphic (#740)
Fixes #680
2020-06-27 21:34:53 +05:30
Pranav Raj S
0cb7333977 Feature: Twilio Whatsapp Integration (#779)
Twilio Whatsapp Integration

Co-authored-by: Sojan <sojan@pepalo.com>
2020-04-30 01:41:13 +05:30
Pranav Raj S
a1a81e3799 Feature: Twilio SMS Channel (#658)
Twilio SMS Channel
Fixes :  #350
2020-04-05 22:11:27 +05:30