TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jzszdznzzl/WABotJS/llms.txt
Use this file to discover all available pages before exploring further.
Stores.JID class maintains a persistent, bidirectional mapping between WhatsApp’s two user identifier formats: LID JIDs (anonymous identifiers, e.g. 123456789@lid) and PN JIDs (phone-number identifiers, e.g. 1234567890@s.whatsapp.net). Mappings are discovered automatically from inbound message events and stored in a local SQLite database, allowing you to look up either form of a JID given the other at any time during the bot’s lifetime.
In normal usage you never instantiate
Stores.JID directly. The Bot class creates and binds a JID store automatically, accessible at bot.cache.jid. Construct it manually only if you are composing stores outside of the Bot abstraction.Import & construction
dir to an absolute path (relative paths are resolved against process.cwd()). It creates a SQLiteStore internally but does not open the database file yet — call bind() to initialize.
Constructor
Directory in which the SQLite database file will be created. The store writes
to
{dir}/jid_store.sqlite. The directory is created recursively if it does
not already exist.Methods
bind(sock)
messages.upsert— for everynotify-type upsert, the store inspectskey.remoteJid/key.remoteJidAltandkey.participant/key.participantAlt. If both a LID and a PN JID are present, the pair is persisted.connection.update— when the connection reachesopen, the bot’s ownuser.lid,user.id, anduser.phoneNumberare stored so the bot’s own JID is always resolvable.
A WABotJS
Socket instance whose event emitter will be subscribed to. Passed
automatically by Bot; supply it yourself only when composing stores manually.resolve(jid)
undefined if the mapping has not yet been observed or the input is not a recognised JID type.
A LID JID (e.g.
123456789@lid) or a PN JID
(e.g. 1234567890@s.whatsapp.net) to look up.The LID form of the JID, normalised with
jidNormalizedUser.The PN (phone-number) form of the JID, normalised with
jidNormalizedUser.Storage details
| Detail | Value |
|---|---|
| Database file | {dir}/jid_store.sqlite |
| Journal mode | WAL |
| Synchronous mode | NORMAL |
| TTL | None — entries are kept indefinitely |
| L1 cache | 10-minute in-memory TTLCache in front of SQLite reads |
BLOB.