Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(config): forward the autoreply cap from compose and correct two docs

Yudhi Armyndharis2b37fa5bad6f
diff --git a/.env.example b/.env.example
index c7949fa3e..a530aa69a 100644
--- a/.env.example
+++ b/.env.example
@@ -400,7 +400,9 @@ WEBHOOK_SSRF_PROTECT=true
# NODE_ID= # defaults to the hostname; must be STABLE across restarts
# SESSION_LEASE_TTL_MS=60000 # how long a claim survives unrenewed (default 60s) —
# # also the worst-case failover delay after an unclean exit
-# SESSION_LEASE_HEARTBEAT_MS=20000 # renewal cadence (default 20s)
+# SESSION_LEASE_HEARTBEAT_MS=20000 # renewal cadence (default 20s) — MUST be strictly less
+ # than half SESSION_LEASE_TTL_MS, so one late or failed
+ # renewal still lands inside the lease; boot FAILS otherwise
# SESSION_TAKEOVER_SWEEP_MS=30000 # how often a node adopts sessions whose holder's lease
# lapsed (crashed peer / this node's previous container
# identity); follows AUTO_START_SESSIONS
diff --git a/docker-compose.yml b/docker-compose.yml
index 38ecfb64b..138a40be4 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -169,6 +169,9 @@ services:
- SESSION_LEASE_HEARTBEAT_MS=${SESSION_LEASE_HEARTBEAT_MS:-}
- SESSION_TAKEOVER_SWEEP_MS=${SESSION_TAKEOVER_SWEEP_MS:-}
- SESSION_PROXY_TIMEOUT_MS=${SESSION_PROXY_TIMEOUT_MS:-}
+ # Autoreply rules per session (0 = unlimited). Blank forwards to the app default (32); an
+ # unforwarded key could not be set from .env at all, which is the whole point of this list.
+ - AUTOMATION_MAX_PER_SESSION=${AUTOMATION_MAX_PER_SESSION:-}
# Storage. Blank-forwarded (see Database note) so a dashboard local↔S3 switch applies; a real
# host value pins. Credentials use the canonical S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY names the
# app and dashboard write; the legacy S3_ACCESS_KEY / S3_SECRET_KEY are ALSO forwarded (and read
diff --git a/docs/06-api-specification.md b/docs/06-api-specification.md
index a10760b57..935b898bb 100644
--- a/docs/06-api-specification.md
+++ b/docs/06-api-specification.md
@@ -6125,7 +6125,7 @@ These are the events OpenWA actually emits. A webhook is registered with an `eve
> **Large media is not inlined into webhook payloads.** A `media` blob whose decoded size exceeds `WEBHOOK_MEDIA_INLINE_MAX_BYTES` (default **1 MiB**; `0` = never inline) is replaced — before the payload is fanned out to your webhook — with the marker form `media: { mimetype, filename?, omitted: true, sizeBytes }`, the same shape the engine emits for capped inbound media. Media at or under the cap stays inline unchanged. Additionally, if the serialized body still exceeds `WEBHOOK_MAX_PAYLOAD_BYTES` (default **1 MiB**) after `webhook:before` hooks ran, any remaining inline media is shed the same way so the event is still delivered; only a payload that is over budget _without_ inline media is dropped (recorded in `GET /api/webhooks/delivery-failures`). Because shedding happens before enqueue, queued and failed BullMQ jobs in Redis never carry the blob either — failed-job retention is bounded by the queue's `removeOnComplete`/`removeOnFail` windows (1h/1000 completed, 24h/5000 failed). Fetch the media itself afterwards via `GET /api/sessions/:sessionId/messages/:chatId/history?includeMedia=true` when you need it.
-> There is **no** `contact.update` or `presence.update` event, and no `call.accepted` / `call.terminated` lifecycle event yet — only `call.received` is emitted.
+> There is **no** `contact.update` event. `presence.update` is emitted only for chats you have subscribed to (see the presence-subscription endpoint); call outcomes are reported as `call.accepted`, `call.rejected` and `call.missed` alongside `call.received`.
> **Group-event timing caveat (Baileys).** Membership/metadata changes that occurred while a Baileys session was offline are replayed by WhatsApp on reconnect and are dispatched like live events — but the engine does not forward their original occurrence time, so they carry the **receipt time** as `timestamp`. Treat `group.*` payloads as change notifications rather than a precise clock; stale offline _calls_ are never emitted this way (they are filtered by the `offline` flag).
diff --git a/src/config/env-precedence.ts b/src/config/env-precedence.ts
index 13eb3a3f0..481b09162 100644
--- a/src/config/env-precedence.ts
+++ b/src/config/env-precedence.ts
@@ -72,6 +72,9 @@ export const BLANK_SHADOWED_ENV_KEYS: string[] = [
'SESSION_LEASE_HEARTBEAT_MS',
'SESSION_TAKEOVER_SWEEP_MS',
'SESSION_PROXY_TIMEOUT_MS',
+ // Autoreply rule cap, blank-forwarded like the knobs above so an operator who sets nothing does
+ // not have an empty string shadow a value in .env / data/.env.generated.
+ 'AUTOMATION_MAX_PER_SESSION',
// Redis selection + connection details (#488)
'REDIS_ENABLED',
'REDIS_HOST',