Persist your WhatsApp session (auth creds + signal keys) and chat history in Convex. Unlike Postgres/Redis/SQLite, Convex is reached through deployed functions, so there is a one-time setup step.
In your Convex project:
- Add the
zaileys_kvtable fromschema.tsto yourconvex/schema.ts(merge it with your existing schema). - Copy
zaileys.tsinto your project asconvex/zaileys.ts. - Deploy:
npx convex dev(ornpx convex deploy).
This exposes zaileys:get, zaileys:set, zaileys:del, zaileys:clear, and
zaileys:list against a single zaileys_kv table.
pnpm add conveximport { Client, ConvexAuthStore, ConvexMessageStore } from 'zaileys'
const url = process.env.CONVEX_URL // e.g. https://your-deployment.convex.cloud
const client = new Client({
auth: new ConvexAuthStore({ url, namespace: 'wa-auth' }),
store: new ConvexMessageStore({ url, namespace: 'wa-store' }),
})Pass a pre-built client instead of a url if you already have one:
import { ConvexHttpClient } from 'convex/browser'
const convex = new ConvexHttpClient(process.env.CONVEX_URL!)
new ConvexAuthStore({ client: convex, namespace: 'wa-auth' })- Use distinct
namespacevalues for auth vs store if they share one deployment —clear()wipes a whole namespace (authclear()runs on a 401/410 logout, mirroring the other adapters). - Values are
BufferJSON-serialized strings, so Buffers round-trip byte-for-byte. - Messages carry
sortKey = messageTimestamp;listMessagesreturns newest-first and honoursbeforepaging.