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
-
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
- 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
- Fixed
-
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
-
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
-
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
What's Changed
- fix(chat): apply where filters correctly in findContacts endpoint by @FaelN1 in #2120
- fix: "Media upload failed on all hosts" utilizando proxy by @JefersonRamos in #2141
- Fix merge by @gomessguii in #2155
- fix: Integration Chatwoot and Baileys services by @KokeroO in #2158
- fix: fetchChats e chat - Painel de mensagens no Manager by @moothz in #2160
- feat(whatsapp): corrigir Business (base64/filename/caption), remoteJid by @ricaelchiquetti in #2161
- fix: Erro ao enviar mensagem para grupos (remoteJid failed constraint) by @moothz in #2162
- Feat/update and delete meta templates by @ricaelchiquetti in #2163
- Durante o processo de logout de uma instância, as chaves associadas a… by @JefersonRamos in #2191
- fix(baileys): resolve incoming message events not working after reconnection by @muriloleal13 in #2186
- fix(chatwoot): corrige erro de duplicação na importação de contatos by @RaFaeL-Cunha in #2203
- Fix: Chatwoot service fails when processing read message by @victoreduardo in #2219
- feature: handle with interactive button message for pix by @victoreduardo in #2220
- Fix: Using all IPs including x-forwarded-for when checking if the requester has access to metrics by @victoreduardo in #2241
- Bugfix/media upload failed on all hosts by @JefersonRamos in #2240
- Fix: @lid problems, messages events and chatwoot integration errors by @Vitordotpy in #2275
- fix: unify remoteJid filtering using OR with remoteJidAlt by @rodps in #2249
- Fix Typebot message routing for @lid JIDs by @lucascampuus in #2264
- fix: handle messageContextInfo in media upload to prevent MinIO errors by @kay0ramon in #2273
- feat: add wildcard "*" to allow all hosts to connect via websocket by @micaelmz in #2280
- fix(prisma): add unique constraint to Chat model in Postgres by @msantosjader in #2247
- Feature/quote message n8n by @jamesjhonatan123 in #2238
- feat(events): add isLatest and progress to messages.set event by @alexandrereyes in #2260
- fix: respect DATABASE_SAVE_DATA_CONTACTS in contact updates by @gabrielmouallem in #2250
- fix(baileys): prevent message loss from WhatsApp stub placeholders by @muriloleal13 in #2259
New Contributors
- @JefersonRamos made their first contribution in #2141
- @muriloleal13 made their first contribution in #2186
- @RaFaeL-Cunha made their first contribution in #2203
- @rodps made their first contribution in #2249
- @lucascampuus made their first contribution in #2264
- @kay0ramon made their first contribution in #2273
- @micaelmz made their first contribution in #2280
- @msantosjader made their first contribution in #2247
- @jamesjhonatan123 made their first contribution in #2238
- @alexandrereyes made their first contribution in #2260
- @gabrielmouallem made their first contribution in #2250
Full Changelog: 2.3.6...2.3.7