* fix(whatsapp): add idempotent message sending to prevent duplicates on timeout retry
When sending media messages via Baileys, Net::ReadTimeout causes Sidekiq to
retry the job, potentially sending the same message multiple times. This adds
a chatwootMessageId parameter to the Baileys API request, enabling server-side
deduplication via Redis. Also increases HTTP timeout to 120s and channel lock
to 130s to reduce false timeouts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address review feedback
- Use error.class.name assertions for parallel/reloading safety
- Assert reconnect endpoint was not called on 409 (stronger assertion)
* fix: address review feedback (round 2)
- Only release channel lock in ensure if it was actually acquired (prevents
clearing another worker's lock on timeout)
- Assert chatwootMessageId in reproduction spec body matcher
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: correct structure of lastMessages in message content
* fix: update send_message to store external_created_at timestamp with result from request
* fix: filter incoming messages for unread conversation logic
* fix: improve extraction of message timestamp in send_message method
* feat: enhance message timestamp extraction and update logic in send_message method
* refactor: send_message to improve error handling and update external_created_at timestamp
* chore: move message timestamp extraction to helper
* fix: use message timestamp extract on incoming
* fix: update unread_conversation to handle last message correctly for Baileys provider
---------
Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>