iachat/app/services
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
..
account fix: account email validation during signup (#11307) 2025-05-20 20:45:39 -07:00
auto_assignment chore: Update typo in inbox_round_robin_service (#9590) 2024-06-06 18:49:53 -07:00
automation_rules feat: Add support for labels in automations (#11658) 2025-09-18 14:17:54 +05:30
base chore: Add cache to improve widget performance (#11163) 2025-03-24 16:04:49 -07:00
contacts feat: Use resolved contacts as base relation for filtering (#12520) 2025-09-25 15:26:44 +05:30
conversations feat: Add support for search_conversations in copilot (#11520) 2025-05-20 19:22:17 -07:00
crm feat: save timezone from leadsquared API (#11583) 2025-05-28 09:46:59 +05:30
data_import fix: downcase email before finding (#8921) 2024-02-21 18:51:00 +05:30
email_templates chore: Fix emails being sent with the wrong translations (#2236) 2021-06-08 22:45:01 +05:30
facebook feat: hide CSAT survey URLs from agents in dashboard (#11622) 2025-06-11 23:39:47 +05:30
geocoder fix: ip-lookup database lazy loading for all environments (#8052) 2024-10-22 23:18:30 -07:00
google feat: add Google Email fetch and OAuth token refresh service (#9603) 2024-06-11 14:22:03 +05:30
imap feat: add Google Email fetch and OAuth token refresh service (#9603) 2024-06-11 14:22:03 +05:30
instagram fix: Creates contact when Instagram returns No matching Instagram user (#11496) 2025-07-28 13:49:13 +04:00
internal feat: add job to remove stale contacts and contact_inboxes (#11186) 2025-03-28 12:18:39 +05:30
labels fix: Update associations when a label is updated (#3046) 2021-09-21 10:16:32 +05:30
line fix: Ensure messages go to correct conversation when receive multi user in 1 LINE webhook (#12322) 2025-09-22 17:05:25 +05:30
linear feat: Add activity messages for linear actions (#11654) 2025-06-13 11:57:11 +05:30
liquid feat: Add liquid processing for SMS campaigns (#10981) 2025-06-11 13:16:44 -04:00
llm_formatter feat: captain should be able to access private notes (#11768) 2025-06-24 19:00:20 -07:00
macros feat: Add webhook event support for macros (#11235) 2025-04-02 20:26:55 -07:00
message_templates fix: Disable automations on auto-reply emails (#12101) 2025-08-05 13:17:06 +05:30
messages feat: Add the ability to mention team in private message (#11758) 2025-07-02 19:57:59 +05:30
mfa feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
microsoft feat: add Google Email fetch and OAuth token refresh service (#9603) 2024-06-11 14:22:03 +05:30
notification chore: Handle WebPush rate limiting in push notification service (#12184) 2025-08-13 13:32:22 +05:30
sms fix: Error shouldn't halt the campaign for entire audience (#11980) 2025-08-11 12:03:48 +05:30
telegram feat: Enable lock to single thread settings for Telegram (#12367) 2025-09-24 11:35:14 +05:30
twilio feat: Add twilio content templates (#12277) 2025-08-29 16:13:25 +05:30
twitter feat: hide CSAT survey URLs from agents in dashboard (#11622) 2025-06-11 23:39:47 +05:30
whatsapp fix: Ensure message is always present in conversation_created webhook for WhatsApp attachment messages (#12507) 2025-09-25 18:19:09 +05:30
widget feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
account_deletion_service.rb feat: automate account deletion (#11406) 2025-05-23 12:58:13 +05:30
action_service.rb chore: Add open conversation option (#11828) 2025-07-02 10:01:50 +05:30
base_refresh_oauth_token_service.rb feat: add Google Email fetch and OAuth token refresh service (#9603) 2024-06-11 14:22:03 +05:30
base_token_service.rb feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
csat_survey_service.rb fix: Send CSAT survey only when agent can reply in conversation (#11637) 2025-06-11 22:45:32 +05:30
filter_service.rb chore: Ability to filter conversations with priority (#10967) 2025-03-03 16:38:22 +05:30
ip_lookup_service.rb feat(poc): Disable widget based on country (#6658) 2023-03-14 09:09:57 -07:00
search_service.rb feat(ee): Setup advanced, performant message search (#12193) 2025-08-28 10:10:28 +05:30