Trashcore Baileys Guide

Your complete documentation for using @trashcore/baileys

Modern WhatsApp API Library for Node.js

📦 Installation Methods

Choose the method that best fits your development needs:

1. Stable Release (Recommended)

Install the latest stable version from npm. Best for production.

package.json
"dependencies": {
  "@trashcore/baileys": "latest"
}

Install the exact stable version from npm.

package.json
"dependencies": {
  "@trashcore/baileys": "^4.0.5"
}

Then run:

npm install

2. GitHub Repository (Dev Build)

Install directly from the official GitHub repo for the latest features (may be unstable).

package.json
"dependencies": {
  "@trashcore/baileys": "github: Tennor-modz/MD-Baileys"
}

Or install via CLI:

npm install github:Tennor-modz/MD-Baileys

3. Custom Fork

Use your own or a modified fork for custom features or fixes.

package.json
"dependencies": {
  "@trashcore/baileys": "github:your-username/baileys"
}

Replace your-username with your GitHub handle.

npm install

✨ What's New & Fixed

🐞 What's Fixed

  • Low-RAM Compatibility: Now installable and runnable on servers with as little as 512MB RAM — optimized memory usage for budget hosting.
  • Device Linking Stability: Fixed persistent issues with pairing and reconnecting multi-device sessions.

🚀 Cool Features

  • WhatsApp Business Buttons: Fully support interactive reply buttons, list menus, and CTAs for WhatsApp Business accounts.
  • Advanced LID (Linked Identity) Features: Improved session persistence, faster reconnection, and seamless cross-device message sync.

⚡ Quick Start

Get your bot running in minutes with this simple setup:

const {
  default: TrashcoreConnect 
} = require('@trashcore/baileys');

async function startBot() { 
  const trashcore = await TrashcoreConnect({ 
    printQRInTerminal: true 
  });

  trashcore.ev.on('messages.upsert', async (m) => { 
    const msg = m.messages[0]; 
    if (!msg.message) return;

    const text = msg.message.conversation;

    if (text === 'ping') {
      await trashcore.sendMessage(msg.key.remoteJid, { text: 'pong!' });
    }
  });

  // Custom pairing example 
  const phoneNumber = '+1234567890'; 
  const cleanNumber = phoneNumber.replace(/[^0-9]/g, ''); 
  console.clear(); 
  const custom = "TRASHBOT"; 
  const pairCode = await trashcore.requestPairingCode(cleanNumber, custom); 
}

startBot();

🌐 Browser Setup

Configure the browser environment for optimal performance:

browser: ["Ubuntu", "Opera", "100.0.4815.0"]

📁 Project Structure

Organize your project with this recommended structure:

my-bot/
├── index.js
├── package.json
└── node_modules/

🔧 Common Errors & Fixes

❌ ENOENT: git not found
pkg install git
❌ Module not found
npm install

Key Features

QR Authentication

Secure login with QR code scanning for WhatsApp Web sessions

Pairing Code

Alternative login method using phone number pairing

Fast Performance

Optimized for speed with minimal resource usage

Terminal Example

bash - index.js
user@machine:~/my-bot$ node index.js
[INFO] Connecting to WhatsApp...
[INFO] Generating QR code...
[QR] Scan this code with your phone
[SUCCESS] Connected to WhatsApp Web
[INFO] Bot is running and listening for messages
[MSG] Received: "ping"
[MSG] Sent: "pong!"

Available Packages

@trashcore/baileys @trashcore/multi-device @trashcore/utils @trashcore/events whatsapp-web.js qrcode-terminal