npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dct-dula-dev-baileys

v1.0.5

Published

WhatsApp Modified By DCT Dula Dev

Readme

🚀 DCT Dula Baileys - Advanced WhatsApp API

License: MIT Node.js TypeScript WhatsApp

A powerful, feature-rich WhatsApp Web API for Node.js with Desktop App Support

FeaturesInstallationQuick StartDesktop AppAPI DocsSupport


📋 Table of Contents


✨ Features

Core Features

  • WhatsApp Web Integration - Connect to WhatsApp Web seamlessly
  • Web & PC Support - Works on browsers and native desktop app
  • Desktop Application - Native Electron-based desktop client
  • Multiple Message Types - Text, Media, Buttons, Lists, Templates
  • Group Management - Create, modify, and manage groups
  • Contact Management - Full contact access and management
  • Auto-Reply System - Automated message responses
  • Newsletter Support - Auto-follow and auto-react features
  • QR Code Authentication - Secure login via QR
  • Signal Protocol - End-to-end encryption support

Newsletter Features

  • 🔔 Auto-follow newsletters
  • 👍 Auto-react with emojis
  • 📊 View statistics
  • 📈 Track reactions and views
  • 🎯 Manage metadata

Interactive Messages

  • 🔘 Interactive buttons
  • 📋 List messages
  • 🎨 Rich templates
  • 📱 Media sharing

📦 Requirements

  • Node.js: >= 20.0.0
  • npm or yarn
  • WhatsApp Account: Active account
  • Browser: Modern browser (for Web version)
  • Optional: Electron (for Desktop App)

📥 Installation

Via NPM

npm install dct-dula-dev-baileys

Via Yarn

yarn add dct-dula-dev-baileys

Clone Repository

git clone <repository-url>
npm install

🚀 Quick Start

Basic Bot

const { makeWASocket, useMultiFileAuthState, DisconnectReason } = require('dct-dula-dev-baileys');
const P = require('pino');

async function startBot() {
  // Auth
  const { state, saveCreds } = await useMultiFileAuthState('baileys-creds');

  // Socket
  const sock = makeWASocket({
    auth: state,
    printQRInTerminal: true,
    logger: P({ level: 'debug' })
  });

  // Connection update
  sock.ev.on('connection.update', (update) => {
    const { connection, lastDisconnect } = update;
    
    if (connection === 'open') {
      console.log('✅ Connected!');
    } else if (connection === 'close') {
      const reason = lastDisconnect?.error?.output?.statusCode;
      if (reason === DisconnectReason.loggedOut) {
        console.log('❌ Logged out');
      }
    }
  });

  // Save credentials
  sock.ev.on('creds.update', saveCreds);

  // Listen for messages
  sock.ev.on('messages.upsert', async (m) => {
    const message = m.messages[0];
    
    if (!message.key.fromMe && message.message) {
      console.log(`📨 ${message.key.remoteJid}: ${message.message.conversation}`);
      
      // Reply
      await sock.sendMessage(message.key.remoteJid, {
        text: 'Thanks for your message!'
      });
    }
  });
}

startBot().catch(console.error);

🖥️ Desktop App

Complete native WhatsApp PC application built with Electron.

Setup

cd desktop
npm install
npm start

Features

  • 📱 Native desktop interface
  • 💬 Chat management
  • 👥 Contacts list
  • ✉️ Send messages & media
  • 🔘 Interactive buttons
  • 📊 Real-time status
  • 🔐 Secure storage

Structure

desktop/
├── main.js              # Electron process
├── preload.js           # IPC bridge
├── renderer.js          # Frontend logic
├── bot-instance.js      # Baileys integration
├── index.html           # UI
├── styles.css           # Design
└── package.json

📚 API Documentation

Authentication

Create Socket

const sock = makeWASocket({
  auth: state,
  printQRInTerminal: true,
  logger: P({ level: 'info' })
});

Initialize Auth State

const { state, saveCreds } = await useMultiFileAuthState('creds');
sock.ev.on('creds.update', saveCreds);

Messaging

Send Text

await sock.sendMessage(jid, { 
  text: 'Hello World!' 
});

Send Media

const media = require('fs').readFileSync('image.jpg');
await sock.sendMessage(jid, {
  image: media,
  caption: 'Image caption'
});

Send Buttons

await sock.sendMessage(jid, {
  text: 'Choose:',
  buttons: [
    { buttonId: '1', buttonText: { displayText: 'Option 1' }, type: 1 },
    { buttonId: '2', buttonText: { displayText: 'Option 2' }, type: 1 }
  ]
});

Send List

await sock.sendMessage(jid, {
  text: 'Select:',
  sections: [{
    title: 'Options',
    rows: [
      { rowId: '1', title: 'Item 1' },
      { rowId: '2', title: 'Item 2' }
    ]
  }]
});

Events

Message Received

sock.ev.on('messages.upsert', (m) => {
  console.log('New message:', m.messages[0]);
});

Message Updated

sock.ev.on('messages.update', (m) => {
  console.log('Message updated:', m);
});

Connection Status

sock.ev.on('connection.update', (update) => {
  if (update.qr) console.log('Scan QR');
  if (update.connection === 'open') console.log('Connected');
});

Groups

Create Group

const groupId = await sock.groupCreate('Group Name', [
  '[email protected]'
]);

Add Members

await sock.groupParticipantsUpdate(
  groupId,
  ['[email protected]'],
  'add'
);

Remove Members

await sock.groupParticipantsUpdate(
  groupId,
  ['[email protected]'],
  'remove'
);

Update Subject

await sock.groupUpdateSubject(groupId, 'New Name');

📰 Newsletter Features

Follow Newsletter

await sock.newsletterFollow('id@newsletter');

React to Message

await sock.newsletterReactMessage(
  'id@newsletter',
  'serverId',
  '👍'
);

Get Metadata

const data = await sock.newsletterMetadata(
  'type', 'key', 'GUEST'
);

Listen to Events

sock.ev.on('newsletter.reaction', ({ id, reaction }) => {
  console.log('Reaction:', reaction);
});

sock.ev.on('newsletter.view', ({ id, count }) => {
  console.log('Views:', count);
});

🔘 Button Messages

Text Buttons

const buttons = [
  { buttonId: '1', buttonText: { displayText: 'Yes' }, type: 1 },
  { buttonId: '2', buttonText: { displayText: 'No' }, type: 1 }
];

await sock.sendMessage(jid, {
  text: 'Your question?',
  buttons,
  footer: 'Choose one'
});

Image Buttons

const buttons = [
  { buttonId: '1', buttonText: { displayText: 'View' }, type: 1 }
];

await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  caption: 'Beautiful image',
  buttons
});

Video Buttons

const buttons = [
  { buttonId: '1', buttonText: { displayText: 'Play' }, type: 1 }
];

await sock.sendMessage(jid, {
  video: { url: 'https://example.com/video.mp4' },
  caption: 'Watch this',
  buttons
});

💡 Examples

Auto-Reply Bot

sock.ev.on('messages.upsert', async (m) => {
  const message = m.messages[0];
  
  if (!message.key.fromMe && message.message) {
    await sock.sendMessage(message.key.remoteJid, {
      text: '🤖 Thanks! We will reply soon.'
    });
  }
});

Newsletter Auto-Follow

setTimeout(async () => {
  try {
    await sock.newsletterFollow('120363408629601473@newsletter');
    console.log('✅ Followed!');
  } catch (error) {
    console.error('Error:', error);
  }
}, 5000);

Chat Statistics

async function getStats() {
  const chats = await sock.fetchAllChats();
  console.log(`
    📊 Stats
    Total: ${chats.length}
    Groups: ${chats.filter(c => c.isGroup).length}
    Contacts: ${chats.filter(c => !c.isGroup).length}
  `);
}

🛠️ Troubleshooting

QR Code Issues

  • Ensure terminal supports Unicode
  • Use printQRInTerminal: true
  • Try desktop app for visual QR

Connection Problems

  • Check internet
  • Clear credentials folder
  • Update Node.js
  • Restart WhatsApp

Send Failures

  • Verify JID format
  • Check permissions
  • Ensure phone is online

Desktop App Issues

rm -rf node_modules package-lock.json
npm install
npm start

🤝 Contributing

  1. Fork repository
  2. Create feature branch
  3. Commit changes
  4. Push branch
  5. Open Pull Request

Development

npm install
npm run build:tsc
npm test

📄 License

MIT License - See LICENSE for details


⚠️ Disclaimer

  • Not affiliated with WhatsApp Inc.
  • Use responsibly and follow WhatsApp's ToS
  • No spam or illegal activities
  • Use at your own risk

🤖 Support

  • 📖 Documentation: Read this README
  • 🐛 Issues: Report on GitHub
  • 💬 Community: Join discussions
  • 📧 Contact: See repository
  • 📱 WhatsApp: Join our channel

Community

  • ⭐ Star if useful
  • 🔗 Share with others
  • 👥 Contribute
  • 💡 Suggest features

Made with ❤️ by DCT Dula Dev

GitHubWhatsApp ChannelTwitter