iachat/app
Muhsin Keloth cd2c58726f
fix: Ensure message is always present in conversation_created webhook for WhatsApp attachment messages (#12507)
Fixes https://github.com/chatwoot/chatwoot/issues/11753 and
https://github.com/chatwoot/chatwoot/issues/12442

**Problem**
When a WhatsApp conversation started with a media message, the
conversation created webhook would sometimes fire before the message and
its relationships were fully committed to the database. This resulted in
the message being missing
from the webhook payload, breaking external automations that rely on
this field.

**Solution**

Added `ActiveRecord::Base.transaction` wrapper around the core message
processing operations in `Whatsapp::IncomingMessageBaseService` to
ensure atomic execution:

- `set_conversation` (creates conversation)
- `create_messages` (creates message with account_id)
- `clear_message_source_id_from_redis` (cleanup)

Now the webhook only triggers after all related data is fully persisted,
guaranteeing message availability.
2025-09-25 18:19:09 +05:30
..
actions fix: Disable enqueueing Avatar jobs if the URL is invalid (#12035) 2025-07-24 12:56:39 +04:00
assets feat: Hide installation identifier (#11722) 2025-06-17 15:45:40 -07:00
builders feat: Clean up email configuration for from and reply to emails (#12453) 2025-09-24 11:36:53 -07:00
channels fix: Move contact events to account stream rather than individual user stream (#11082) 2025-03-13 17:46:48 -07:00
controllers feat: Auto confirm user email when super admin make changes (#12418) 2025-09-23 20:14:02 +05:30
dashboards feat: Auto confirm user email when super admin make changes (#12418) 2025-09-23 20:14:02 +05:30
dispatchers feat(ee): Add Captain features (#10665) 2025-01-14 16:15:47 -08:00
drops feat: Add the support for custom attributes in message variables (#8511) 2023-12-08 14:13:35 -08:00
fields chore: improve plan-based feature handling with plan hierarchy (#11335) 2025-04-28 14:13:56 -07:00
finders feat: add SKIP_INCOMING_BCC_PROCESSING as internal config (#12484) 2025-09-22 17:52:56 +05:30
helpers fix: Add URL validation and rate limiting for contact avatar sync (#11979) 2025-09-10 20:08:06 +05:30
javascript chore: Update translations (#12519) 2025-09-25 15:59:03 +05:30
jobs fix(delete_object_job): pre-purge heavy associations before destroy to prevent timeout (#12408) 2025-09-11 18:43:36 +05:30
listeners fix: incorrect first response time for reopened conversations (#12058) 2025-08-13 16:39:43 +05:30
mailboxes fix: Use .find_by instead .where().first (#12402) 2025-09-10 10:08:37 +05:30
mailers feat: Clean up email configuration for from and reply to emails (#12453) 2025-09-24 11:36:53 -07:00
models feat: Clean up email configuration for from and reply to emails (#12453) 2025-09-24 11:36:53 -07:00
policies feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
presenters fix: Disable automations on auto-reply emails (#12101) 2025-08-05 13:17:06 +05:30
services fix: Ensure message is always present in conversation_created webhook for WhatsApp attachment messages (#12507) 2025-09-25 18:19:09 +05:30
views feat: SAML feedback changes [CW-5666] (#12511) 2025-09-24 16:07:07 +05:30
workers feat: API Endpoints to update message status (#11387) 2025-04-29 15:33:11 -07:00