diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e34044..72fbf08b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ - Added DTOs and validation schemas for template management - Enhanced template lifecycle management capabilities +* **Events API**: Add isLatest and progress to messages.set event + - Allows consumers to know when history sync is complete (isLatest=true) + - Track sync progress percentage through webhooks + - Added extra field to EmitData type for additional payload properties + - Updated all event controllers (webhook, rabbitmq, sqs, websocket, pusher, kafka, nats) + +* **N8N Integration**: Add quotedMessage to payload in sendMessageToBot + - Support for quoted messages in N8N chatbot integration + - Enhanced message context information + +* **WebSocket**: Add wildcard "*" to allow all hosts to connect via websocket + - More flexible host configuration for WebSocket connections + - Improved host validation logic in WebsocketController + +* **Pix Support**: Handle interactive button message for pix + - Support for interactive Pix button messages + - Enhanced payment flow integration + ### Fixed * **Baileys Message Processor**: Fix incoming message events not working after reconnection @@ -60,11 +78,76 @@ - Fixed integration issues between Chatwoot and Baileys services - Improved message handling and delivery +* **Baileys Message Loss**: Prevent message loss from WhatsApp stub placeholders + - Fixed messages being lost and not saved to database, especially for channels/newsletters (@lid) + - Detects WhatsApp stubs through messageStubParameters containing 'Message absent from node' + - Prevents adding stubs to duplicate message cache + - Allows real message to be processed when it arrives after decryption + - Maintains stub discard to avoid saving empty placeholders + +* **Database Contacts**: Respect DATABASE_SAVE_DATA_CONTACTS in contact updates + - Added missing conditional checks for DATABASE_SAVE_DATA_CONTACTS configuration + - Fixed profile picture updates attempting to save when database save is disabled + - Fixed unawaited promise in contacts.upsert handler + +* **Prisma/PostgreSQL**: Add unique constraint to Chat model + - Generated migration to add unique index on instanceId and remoteJid + - Added deduplication step before creating index to prevent constraint violations + - Prevents chat duplication in database + +* **MinIO Upload**: Handle messageContextInfo in media upload to prevent MinIO errors + - Prevents errors when uploading media with messageContextInfo metadata + - Improved error handling for media storage operations + +* **Typebot**: Fix message routing for @lid JIDs + - Typebot now responds to messages from JIDs ending with @lid + - Maintains complete JID for @lid instead of extracting only number + - Fixed condition: `remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0]` + - Handles both @s.whatsapp.net and @lid message formats + +* **Message Filtering**: Unify remoteJid filtering using OR with remoteJidAlt + - Improved message filtering with alternative JID support + - Better handling of messages with different JID formats + +* **@lid Integration**: Multiple fixes for @lid problems, message events and chatwoot errors + - Reorganized imports and improved message handling in BaileysStartupService + - Enhanced remoteJid processing to handle @lid cases + - Improved jid normalization and type safety in Chatwoot integration + - Streamlined message handling logic and cache management + - Refactored message handling and polling updates with decryption logic for poll votes + - Improved event processing flow for various message types + +* **Chatwoot Contacts**: Fix contact duplication error on import + - Resolved 'ON CONFLICT DO UPDATE command cannot affect row a second time' error + - Removed attempt to update identifier field in conflict (part of constraint) + - Changed to update only updated_at field: `updated_at = NOW()` + - Allows duplicate contacts to be updated correctly without errors + +* **Chatwoot Service**: Fix async handling in update_last_seen method + - Added missing await for chatwootRequest in read message processing + - Prevents service failure when processing read messages + +* **Metrics Access**: Fix IP validation including x-forwarded-for + - Uses all IPs including x-forwarded-for header when checking metrics access + - Improved security and access control for metrics endpoint + +### Dependencies + +* **Baileys**: Updated to version 7.0.0-rc.9 + - Latest release candidate with multiple improvements and bug fixes + +* **AWS SDK**: Updated packages to version 3.936.0 + - Enhanced functionality and compatibility + - Performance improvements + ### 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 +* **BaileysStartupService**: Fix indentation and remove unnecessary blank lines +* **Event Controllers**: Guard extra spread and prevent core field override in all event controllers +* **Import Organization**: Reorganize imports for better code structure and maintainability # 2.3.6 (2025-10-21)