NAVIGATION
ELOWEN DOCUMENTATION

Last updated: 10 October 2026

Browse documentation · whatsapp implementation
Developer reference

whatsapp implementation

Runtime ownership

lib/adapter.mjs owns ingress authorization, turn execution, media and outbound transport. It checks current group and sender access before passing a reply to a parked question or menu, then applies the mention gate to ordinary messages.

lib/pairing.mjs owns authentication, the current Baileys socket, QR and phone-code snapshots, socket event registration and its single reconnect timer. The adapter supplies inbound-message and sent-message lookup callbacks; outbound transport and group tools resolve the current socket through this owner. Fresh pairing, unpair and registered-device logout share one local credential reset. An expired unregistered pairing keeps its credentials and phone-code request state, while a registered logout resets credentials and permits a new code. Disconnect cancels reconnects.

lib/menus.mjs owns command rendering, numbered pages and selection checks. lib/askFlow.mjs owns parked questions, ordered text answers and core settlement. Only menus use the adapter's configured askTimeoutMs; questions are considered before menus. The host shared question parser, answer projection and model/reasoning helpers remain their source of truth. These modules are internal and add no platform API or persistent state.

askTimeoutMs controls only interactive picker menus, such as /model. With no override it uses six minutes. An expired menu closes locally; parked core questions have no additional adapter deadline.

Parked AskUserQuestion prompts remain answerable until the core accepts an answer or emits ask_resolved for timeout, cancellation or replacement. Channel adapters do not expire these questions locally. askTimeoutMs controls only the adapter's local interactive pickers or numbered menus; it does not change the core question deadline. Core resolution removes the pending entry and retires the prompt. Telegram accepts free text only from the original sender and permits option callbacks from that sender or an operator; WhatsApp text replies retain their original sender binding.

Native question rendering passes the selected service-message table to formatQuestionOptionLabel(option, messages, maxLabelLength) and formatQuestionPrompt(question, messages) from elowen-plugin-shared/ask. Recommendation labels and numbered reply instructions use English, Czech or Slovak without changing stored option labels or values. Non-recommended options have no suffix, and custom: false omits the custom-reply instruction. Rendering keeps the channel's markup and limits; there is no message-table fallback.

WhatsApp receives at most one image per incoming message. The removed maxImages setting had no effect and is retired through retiredConfigKeys: ["maxImages"]. The authoritative core plugin loader removes a stored value before registration using the existing configuration revision check. An installation without that key needs no cleanup. maxImageBytes still bounds inbound download size, and maxUploadImages still bounds shared images attached to an outgoing reply. WhatsApp is the consumer; no plugin-local migration or media behavior change is required.

maxImageBytes defaults to 5 MiB; an oversized inbound image becomes an attachment note. maxUploadImages defaults to four and is configurable from one to ten. Cleanup of an absent retired key needs no write, unrelated settings stay intact, and read-only loading does not persist cleanup. Shared files use the host-provided chat-files directory and retain their file names and bytes.