baileys-mongo
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

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

  1. Install the package

    npm i baileys-mongo
  2. 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
    }
  3. 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
  4. 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

Package Sidebar

Install

npm i baileys-mongo

Weekly Downloads

12

Version

1.5.0

License

MIT

Unpacked Size

46.2 kB

Total Files

30

Last publish

Collaborators

  • mrodriguezbegueri