diff --git a/CHANGELOG.md b/CHANGELOG.md index 9efa3011..5d8dde1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,71 @@ +# 2.3.7 (2025-11-07) + +### Features + +* **WhatsApp Business Meta Templates**: Add update and delete endpoints for Meta templates + - New endpoints to edit and delete WhatsApp Business templates + - Added DTOs and validation schemas for template management + - Enhanced template lifecycle management capabilities + +### Fixed + +* **Baileys Message Processor**: Fix incoming message events not working after reconnection + - Added cleanup logic in mount() to prevent memory leaks from multiple subscriptions + - Recreate messageSubject if it was completed during logout + - Remount messageProcessor in connectToWhatsapp() to ensure subscription is active + - Fixed issue where onDestroy() calls complete() on RxJS Subject, making it permanently closed + - Ensures old subscriptions are properly cleaned up before creating new ones + +* **Baileys Authentication**: Resolve "waiting for message" state after reconnection + - Fixed Redis keys not being properly removed during instance logout + - Prevented loading of old/invalid cryptographic keys on reconnection + - Fixed blocking state where instances authenticate but cannot send messages + - Ensures new credentials (creds) are properly used after reconnection + +* **OnWhatsapp Cache**: Prevent unique constraint errors and optimize database writes + - Fixed `Unique constraint failed on the fields: (remoteJid)` error when sending to groups + - Refactored query to use OR condition finding by jidOptions or remoteJid + - Added deep comparison to skip unnecessary database updates + - Replaced sequential processing with Promise.allSettled for parallel execution + - Sorted JIDs alphabetically in jidOptions for accurate change detection + - Added normalizeJid helper function for cleaner code + +* **Proxy Integration**: Fix "Media upload failed on all hosts" error when using proxy + - Created makeProxyAgentUndici() for Undici-compatible proxy agents + - Fixed compatibility with Node.js 18+ native fetch() implementation + - Replaced traditional HttpsProxyAgent/SocksProxyAgent with Undici ProxyAgent + - Maintained legacy makeProxyAgent() for Axios compatibility + - Fixed protocol handling in makeProxyAgent to prevent undefined errors + +* **WhatsApp Business API**: Fix base64, filename and caption handling + - Corrected base64 media conversion in Business API + - Fixed filename handling for document messages + - Improved caption processing for media messages + - Enhanced remoteJid validation and processing + +* **Chat Service**: Fix fetchChats and message panel errors + - Fixed cleanMessageData errors in Manager message panel + - Improved chat fetching reliability + - Enhanced message data sanitization + +* **Contact Filtering**: Apply where filters correctly in findContacts endpoint + - Fixed endpoint to process all where clause fields (id, remoteJid, pushName) + - Previously only processed remoteJid field, ignoring other filters + - Added remoteJid field to contactValidateSchema for proper validation + - Maintained multi-tenant isolation with instanceId filtering + - Allows filtering contacts by any supported field instead of returning all contacts + +* **Chatwoot and Baileys Integration**: Multiple integration improvements + - Enhanced code formatting and consistency + - Fixed integration issues between Chatwoot and Baileys services + - Improved message handling and delivery + +### Code Quality & Refactoring + +* **Template Management**: Remove unused template edit/delete DTOs after refactoring +* **Proxy Utilities**: Improve makeProxyAgent for Undici compatibility +* **Code Formatting**: Enhance code formatting and consistency across services + # 2.3.6 (2025-10-21) ### Features