Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs: say per-chat order stops at the start of webhook dispatch

Yudhi Armyndharis70b505426ee5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index faa958ac5..02d4a335c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -85,7 +85,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- With `AUTO_START_SESSIONS=true`, a session stopped with `POST /api/sessions/:sessionId/stop` or `POST /api/sessions/:sessionId/force-kill` stays down across restarts and is not adopted by another node until `POST /api/sessions/:sessionId/start`.
- Two gateway processes sharing one `NODE_ID` (by default the hostname, as with host networking or pm2 cluster mode) log a `duplicate_node_id` error while either holds a session; give each process its own `NODE_ID`.
- An inbound message, or one the account sent outside the API, is inserted once more after a transient database error (a SQLite lock, a dropped connection, a PostgreSQL pool timeout or connection limit), instead of reaching webhooks with no stored row.
-- Messages in one chat are stored, emitted over the WebSocket and queued for webhooks in arrival order, even when a plugin's `message:received` or `message:sent` handler is slower on an earlier one.
+- Messages in one chat are stored, emitted over the WebSocket and handed to webhook dispatch in arrival order, even when a plugin's `message:received` or `message:sent` handler is slower on an earlier one. Webhook deliveries themselves can still arrive out of order.
- A delivery ack, reaction, edit or deletion that arrives before its message is stored is applied once the message is stored.
- The lid-to-phone cache no longer keeps an empty reverse entry for every phone it evicted or re-mapped, so its memory stays within the cache bound.
- Webhook custom header values with characters outside Latin-1 are rejected with `400`; they were accepted and made every delivery to that webhook fail.
diff --git a/docs/19-plugin-architecture.md b/docs/19-plugin-architecture.md
index 1c302c31d..4ce1abf36 100644
--- a/docs/19-plugin-architecture.md
+++ b/docs/19-plugin-architecture.md
@@ -522,10 +522,10 @@ also applies the per-session activation gate.
Chains for different messages run concurrently, so a handler can see one chat's messages out of order.
The gateway still stores and emits each chat's messages in arrival order: the `message:received` and
`message:sent` chains run concurrently, but the row insert, the websocket event, `message:persisted` and
-the webhook enqueue wait for every earlier message of the same chat. A slow handler therefore delays that
-chat's later messages, by at most its 5 s hook timeout (`SANDBOX_HOOK_TIMEOUT_MS`) for a sandboxed
-plugin. Webhook HTTP deliveries still run concurrently, so a receiver that needs order should sort by
-`timestamp`.
+the start of webhook dispatch wait for every earlier message of the same chat. A slow handler therefore
+delays that chat's later messages, by at most its 5 s hook timeout (`SANDBOX_HOOK_TIMEOUT_MS`) for a
+sandboxed plugin. Webhook dispatch itself is not ordered: its queue jobs and HTTP deliveries run
+concurrently, so a receiver that needs order should sort by the message's `data.timestamp`.
## 19.6 Plugin Loader