Supabase Baileys
ActivePersistent WhatsApp Auth Adapter for Baileys
supabase-baileys is a persistent authentication adapter for Baileys (WhatsApp Web API) that uses Supabase as a storage backend. It allows WhatsApp multi-session states to be synced across processes or instances using PostgreSQL + S3 via Supabase. Supports get, set, clear, and removeCreds operations with automatic serialization using BufferJSON.
Features
Persistent Sessions
WhatsApp session states are persisted in Supabase, surviving process restarts and deployments.
Multi-Session Support
Manage multiple WhatsApp sessions simultaneously with unique session IDs.
Auto Serialization
Automatically serializes and deserializes keys using BufferJSON for seamless storage.
Simple API
Drop-in replacement for Baileys auth state with just a few lines of configuration.
Documentation
Getting Started
Installation
npm install supabase-baileys
Quick Start
import makeWASocket from "baileys";
import { useSupabaseAuthState } from "supabase-baileys";
const { state, saveCreds } = await useSupabaseAuthState({
supabaseUrl: "https://your-project.supabase.co",
supabaseKey: "your-anon-key",
session: "your-session-id",
});
const sock = makeWASocket({
auth: state,
});
sock.ev.on("creds.update", saveCreds);
Supabase Table Schema
Create the following table in Supabase:
create table if not exists auth (
session text not null,
id text not null,
value jsonb,
primary key (session, id)
);
Environment Variables
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key