Baileys Mongo
Package made by mrodriguezbegueri for using mongodb to store auth sessions from Baileys package
This package was inspired from baileys-bottle package made by deadlinecode.
This package let you save in mongo the credentials to create whatsapp socket with Baileys package.
Installation
-
Install the package
npm i baileys-mongo
-
Generate prisma scheme. For this create one folder named "prisma" with one file called "shceme.prisma". The file has to be like this:
datasource db { provider = "mongodb" url = env("MONGO_DB_URL") } generator client { provider = "prisma-client-js" } model Auth { id String @id @default(auto()) @map("_id") @db.ObjectId key String @unique value String }
-
Set an env var named "MONGO_DB_URL" with the url of your mongo database. Prisma client request to set a replica for upsert operations
MONGO_DB_URL=mongodb+srv://USER:PASSWORD@CLUSTERXXXX.XXXX.mongodb.net/sessions?retryWrites=true&w=majority
-
Run prisma generate command
npx prisma generate --schema=./prisma/scheme.prisma
Usage
Take a look at the information in the example folder
You need help or want to exchange about things
Send me an email to mrodriguezbegueri@gmail.com