Detect new sync runs by tracking lastProgress — when progress resets or
decreases, counters are zeroed before accumulating. This prevents stale
counts from aborted syncs leaking into subsequent runs.
Addresses Sourcery review feedback on PR #2442.
Track message, chat and contact counts across all history sync batches
using instance-level counters, so the final event reports accurate
totals instead of only the last batch counts.
Addresses Sourcery review feedback on PR #2440.
Reorder webhook emissions (CHATS_SET, MESSAGES_SET) to fire after database
persistence, fixing a race condition where consumers received the event
before data was queryable.
Emit a new MESSAGING_HISTORY_SET event when progress reaches 100%,
allowing consumers to know exactly when history sync is complete and
messages are available in the database.
Register the new event across all transport types (Webhook, WebSocket,
RabbitMQ, NATS, SQS, Kafka, Pusher) and validation schemas.
Two bugs in BusinessStartupService message processing:
1. Execution order: Chatwoot was processed AFTER the bot emit(), but
Baileys channel processes Chatwoot FIRST. This inconsistency meant
the bot could not access chatwootConversationId/chatwootInboxId
when processing messages from the Cloud API.
2. chatwootIds assignment: chatwootInboxId and chatwootConversationId
were both incorrectly set to chatwootSentMessage.id instead of
.inbox_id and .conversation_id respectively.
Fix: reorder to Chatwoot-first (consistent with Baileys) and use the
correct property names from the Chatwoot response object.
When a chatbot session exists with status='closed', the emit() method
returned early, preventing the bot from re-activating on new messages.
Root cause: the guard 'if (session.status === closed) return' was meant
to skip sessions not awaiting user input, but it also prevented new
conversations from starting after a bot flow completed.
Fix: nullify the session instead of returning, so processBot enters the
'!session' branch and creates a fresh session.
Also adds null guards:
- getConversationMessage: return empty string instead of undefined
- findBotByTrigger: handle null/undefined content gracefully
- Remove dokploy-network external network dependency that breaks
docker-compose up on fresh installs without the network pre-created
- Fix evolution-manager frontend crash by adding nginx.conf with
corrected gzip_proxied directive (removes invalid must-revalidate value)
- Add missing POSTGRES_DATABASE, POSTGRES_USERNAME, POSTGRES_PASSWORD
to .env.example (required by docker-compose postgres service)
- Fix DATABASE_CONNECTION_URI hostname from postgres to evolution-postgres
to match the docker-compose service name
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added LID to phone number mapping and resolution logic to handle LID addresses. Implemented caching for LID mappings and added methods to clean and save mappings.