Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
Merge main into fix/baileys-chatmodify-keys
Yudhi Armyndharisabe924a17baf
diff --cc CHANGELOG.mdindex 2e1b86cfd,991e89208..66af2eef8--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -31,8 -45,36 +45,38 @@@ and this project adheres to [Semantic V- Refuse media exports and file counts when local directories cannot be fully enumerated.- Normalize CRLF line endings in SDK contract parsers so Windows checkouts do not produce false contract mismatches (#1885).- Exclude local repository metadata from Java SDK Maven Central bundles built with Maven 3.10 (#1879).- - Index Baileys clear, delete, archive and unread changes by the same chat jid as their message key, and send an own group message's key without its participant, so the phone applies a clear or delete instead of ignoring it (#1891).- - Key Baileys chat writes and read receipts to the gateway's stored newest message of a chat with no message since the session started, and archive or mark unread a chat with no known message at all; clear and delete still decline then (#1891).+ - Answer 400 for a template or bulk message whose rendered text would pass `TEMPLATE_RENDER_MAX_CHARS`, instead of exhausting memory.+ - Refuse a bulk media item that would render past the media size limit.+ - Refuse Socket.IO connections to the root namespace, which stayed connected outside the handshake and per-key socket limits; only `/events` accepts clients.+ - Bound a silent Redis connection in the rate-limit store with a socket timeout, so only the first request waits out a timeout.+ - Store the label of a clicked button as the message body; it was returned to the caller but not saved.+ - Leave opt-in events such as `message.receipt` out of the failure redrive batch of a webhook that only subscribes to `*`, where they stayed at the head of every batch.+ - Delete a session's messages, webhook outbox events and webhook delivery failures in batches, with a new index on outbox events by session, so removing a session with a large history does not hold the database in one statement.+ - Answer 503 instead of 500 when WhatsApp answers a Baileys send or status post with a throttle (429) or timeout (408) code, and free the idempotency key of a throttled send.+ - Match a built-in search chat or sender filter against every stored form of the id (`@c.us`, `@s.whatsapp.net`, lid), and a group message's author for the sender.+ - Probe a whatsapp-web.js session that awaits operator action, so the watchdog tells a live page from a dead one.+ - Answer 409 instead of 500 for a whatsapp-web.js send or status post that races a session teardown.+ - Reload the dashboard chat list at most once at a time per session when live events arrive in a burst.+ - Keep storage export entry names identical to the stored keys; a backslash, a doubled slash or a leading `name:` segment used to rewrite them.+ - Leave S3 folder placeholders (keys ending in `/`) out of the storage export.+ - Keep the chat media and status media orphan sweeps from overlapping when a pass outlasts its interval.+ - Answer 400 naming `url` for a media conversion `url` that is not an absolute http(s) address, instead of the blocked-address message.+ - Stop an automation rule edit from undoing an overlapping edit or bringing back a rule deleted meanwhile.+ - Make one direct attempt per further stranded webhook outbox row once its receiver has failed in the same sweep, so an unreachable receiver does not hold the sweep for a full retry schedule per row.+ - Keep a session start that worked when the database fails a read after the engine came up, which made the retry answer "already started".+ - Answer a session delete normally when handing back its claim fails after the delete committed.+ - Clear a logged-out session's phone before the status write, so a failed write cannot leave it in the boot auto-start query.+ - Fail the unfinished bulk batches of a session whose delete fails after it began closing the session, instead of leaving them processing.+ - Log a failed wipe of the stored messages and chat states when a Baileys session is unlinked.+ - Answer the number check with the phone id (`<phone>@c.us`) on whatsapp-web.js for a contact migrated to LID addressing, as Baileys does.+ - Read a list of lid allowlist entries from the database in one query instead of one per unseen entry first.+ - Keep a plugin hook handler that outlives the hook timeout inside the re-entrancy guard, so its late sends no longer re-fire the event and dispatch the handler again.+ - Complete a data import on PostgreSQL when clearing a large messages table outlasts the statement timeout.+ - Create the built-in PostgreSQL container with the saved `DATABASE_PASSWORD`, so a custom password saved with the built-in database no longer fails the next boot.+ - Serialize a plugin upload with an uninstall or update of the same plugin id.+ - Show hours for a session active within the last day on the Sessions page, as the Dashboard does.++- Index Baileys clear, delete, archive and unread changes by the same chat jid as their message key, and send an own group message's key without its participant, so the phone applies a clear or delete instead of ignoring it (#1891). Thanks @rjsebening.++- Key Baileys chat writes and read receipts to the gateway's stored newest message of a chat with no message since the session started, and archive or mark unread a chat with no known message at all; clear and delete still decline then (#1891). Thanks @rjsebening.## [0.25.0] - 2026-10-15diff --cc src/engine/adapters/baileys-contacts.tsindex b9fd09840,fbf609434..2b5ad454b--- a/src/engine/adapters/baileys-contacts.ts+++ b/src/engine/adapters/baileys-contacts.ts@@@ -1,13 -1,8 +1,13 @@@import type { WAMessage, WAMessageKey, WASocket } from '@whiskeysockets/baileys';-import { ChatSummary, Contact, MediaInput } from '../interfaces/whatsapp-engine.interface';+import {+ ChatSummary,+ Contact,+ MediaInput,+ type StoredChatMessageLookup,+} from '../interfaces/whatsapp-engine.interface';import { assertReadableImage, resolveMediaBuffer } from './baileys-messaging';import { type createLogger } from '../../common/services/logger.service';- import { BAILEYS_QUERY_BUDGET_MS, withQueryDeadline } from './baileys-query-deadline';+ import { BAILEYS_QUERY_BUDGET_MS, confirmedWrite, withQueryDeadline } from './baileys-query-deadline';import { EngineTransportError } from '../../common/errors/engine-transport.error';import { RecipientUnreachableError } from '../../common/errors/recipient-unreachable.error';import { LidNotMappedError } from '../../common/errors/lid-not-mapped.error';