Skip to content

XdKing2/malvin-baileys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Malvin Baileys Banner

npm version License: MIT Node.js Version Downloads GitHub stars


🚀 WHY MALVIN-BAILEYS?

⚡ Lightning Fast
Optimized WebSocket
🛡️ Secure
Custom Pairing Codes
🧩 Feature-Rich
Interactive Messages
🔄 Active Dev
Regular Updates
🤖 AI Messages
Smart Icon Branding
📰 Newsletters
Channel Management
🎨 Modern UI
Gradient Banners
💪 Production Ready
Stable & Reliable

Note

The original Baileys repository was initially removed and subsequently maintained by WhiskeySockets. This enhanced version includes numerous improvements and powerful features for production WhatsApp bots.


📦 INSTALLATION

Option 1: NPM (Recommended)

npm install malvin-baileys

Option 2: Yarn

yarn add malvin-baileys

Option 3: Package.json Alias

{
  "dependencies": {
    "@whiskeysockets/baileys": "npm:malvin-baileys"
  }
}

Option 4: GitHub Direct

{
  "dependencies": {
    "@whiskeysockets/baileys": "github:XdKing2/malvin-baileys"
  }
}

🔌 IMPORT METHODS

// ESM
import makeWASocket from 'malvin-baileys'

// CommonJS
const { default: makeWASocket } = require('malvin-baileys')

// TypeScript
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'malvin-baileys'

📖 QUICK START

import makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'malvin-baileys'

const startSock = async () => {
  const { state, saveCreds } = await useMultiFileAuthState('auth_info')
  
  const sock = makeWASocket({
    auth: state,
    browser: ['Malvin Baileys', 'Chrome', '1.0.0'],
    printQRInTerminal: true,
    syncFullHistory: false
  })

  sock.ev.on('creds.update', saveCreds)

  sock.ev.on('connection.update', (update) => {
    const { connection, lastDisconnect } = update
    if (connection === 'close') {
      const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
      console.log('Connection closed, reconnecting:', shouldReconnect)
      if (shouldReconnect) startSock()
    } else if (connection === 'open') {
      console.log('✅ Connected to WhatsApp')
    }
  })

  return sock
}

const sock = await startSock()

🔐 CUSTOM PAIRING CODE

Tip

Custom pairing codes enhance security and provide a personalized experience. The code must be exactly 8 characters (letters/numbers).

const phoneNumber = "263XXXXXXX"
const customCode = "MRMALVIN" // Must be 8 characters
const code = await sock.requestPairingCode(phoneNumber, customCode)
console.log(`📱 Pairing code: ${code?.match(/.{1,4}/g)?.join('-') || code}`)

Example Output: MRMA-LVIN or ABCD-1234


📊 FEATURE MATRIX

Feature Status Description
🔐 Custom Pairing Default "MRMALVIN" or custom 8-digit codes
🤖 AI Message Icon Brand your bot messages with AI icon
📰 Newsletter Support Full channel management & messaging
🎛️ Interactive Buttons Quick replies, CTAs, copy codes
🖼️ Album Messages Group multiple media in carousel
📱 Event Messages Virtual event invites with RSVP
🗳️ Poll Results Share poll outcomes with vote counts
💳 Payment Requests Request payments with custom UI
🛍️ Product Catalog E-commerce ready product messages
🎨 Gradient Banners Beautiful console & message output
🔄 Auto-Reconnect Stable connection handling
📱 Multi-Device Latest WhatsApp MD support

✨ FEATURE SHOWCASE

📰 Newsletter Management

Expand Newsletter Features

Get Newsletter Info

// By invite code
const metadata = await sock.newsletterMetadata("invite", "xxxxx")

// By JID
const metadata = await sock.newsletterMetadata("jid", "abcd@newsletter")
console.log(metadata)

Create & Manage Newsletter

// Create new newsletter
const metadata = await sock.newsletterCreate("Newsletter Name", "Description")

// Update description
await sock.newsletterUpdateDescription("abcd@newsletter", "New Description")

// Update name
await sock.newsletterUpdateName("abcd@newsletter", "New Name")

// Update/Remove picture
await sock.newsletterUpdatePicture("abcd@newsletter", buffer)
await sock.newsletterRemovePicture("abcd@newsletter")

// Delete newsletter
await sock.newsletterDelete("abcd@newsletter")

Follow & Notifications

// Follow/Unfollow
await sock.newsletterFollow("abcd@newsletter")
await sock.newsletterUnfollow("abcd@newsletter")

// Mute/Unmute
await sock.newsletterMute("abcd@newsletter")
await sock.newsletterUnmute("abcd@newsletter")

React to Posts

// Get message ID from URL: https://whatsapp.com/channel/xxxxx/175
const messageId = "175"
await sock.newsletterReactMessage("abcd@newsletter", messageId, "🥳")

🎛️ Interactive Buttons

Expand Button & Interactive Features

Text Buttons

const buttons = [
  { buttonId: 'btn1', buttonText: { displayText: 'Option 1' }, type: 1 },
  { buttonId: 'btn2', buttonText: { displayText: 'Option 2' }, type: 1 }
]

await sock.sendMessage(jid, {
  text: "Choose an option:",
  footer: "Malvin Baileys",
  buttons,
  headerType: 1
})

Image Buttons

const buttons = [
  { buttonId: 'btn1', buttonText: { displayText: 'View Details' }, type: 1 },
  { buttonId: 'btn2', buttonText: { displayText: 'Learn More' }, type: 1 }
]

await sock.sendMessage(jid, {
  image: { url: "https://example.com/image.jpg" },
  caption: "Check out our new product!",
  footer: "Malvin Baileys",
  buttons,
  headerType: 1
})

Advanced Interactive Buttons

const interactiveButtons = [
  {
    name: "quick_reply",
    buttonParamsJson: JSON.stringify({
      display_text: "Quick Reply",
      id: "reply_1"
    })
  },
  {
    name: "cta_url",
    buttonParamsJson: JSON.stringify({
      display_text: "Visit Website",
      url: "https://example.com"
    })
  },
  {
    name: "cta_copy",
    buttonParamsJson: JSON.stringify({
      display_text: "Copy Code",
      id: "code_123",
      copy_code: "PROMO2026"
    })
  }
]

await sock.sendMessage(jid, {
  text: "Special Offer!",
  title: "Limited Time Deal",
  footer: "Malvin Baileys",
  interactiveButtons
})

Interactive with Media

const interactiveButtons = [
  {
    name: "quick_reply",
    buttonParamsJson: JSON.stringify({
      display_text: "Yes, I'm Interested",
      id: "interested"
    })
  },
  {
    name: "cta_url",
    buttonParamsJson: JSON.stringify({
      display_text: "Learn More",
      url: "https://example.com/product"
    })
  }
]

// With Image
await sock.sendMessage(jid, {
  image: { url: "https://example.com/product.jpg" },
  caption: "New Arrival!",
  title: "Premium Collection",
  footer: "Malvin Baileys",
  interactiveButtons
})

// With Video
await sock.sendMessage(jid, {
  video: { url: "https://example.com/demo.mp4" },
  caption: "Watch our demo",
  title: "Product Demo",
  footer: "Malvin Baileys",
  interactiveButtons
})

🤖 AI Message Icon

// Simply add "ai: true" to display AI icon
await sock.sendMessage(jid, { 
  text: "Hello! I'm your AI assistant.", 
  ai: true 
})

Tip

AI icons make your bot messages stand out and clearly indicate automated responses to users.


🖼️ Album Messages

await sock.sendMessage(jid, { 
  albumMessage: [
    { image: { url: "https://example.com/pic1.jpg" }, caption: "Summer 2026" },
    { image: { url: "https://example.com/pic2.jpg" }, caption: "Memories" },
    { video: { url: "https://example.com/video.mp4" }, caption: "Highlights" }
  ] 
})

📱 Event Messages

await sock.sendMessage(jid, { 
  eventMessage: { 
    isCanceled: false, 
    name: "Tech Summit 2026", 
    description: "Join us for AI innovations and networking!", 
    location: { 
      degreesLatitude: 6.9271,
      degreesLongitude: 79.8612,
      name: "Colombo Convention Center" 
    }, 
    joinLink: "https://call.whatsapp.com/video/event123", 
    startTime: "1763019000",
    endTime: "1763026200"
  } 
})

🗳️ Poll Result Messages

await sock.sendMessage(jid, { 
  pollResultMessage: { 
    name: "Favorite Feature?", 
    pollVotes: [
      {
        optionName: "AI Messages",
        optionVoteCount: "152"
      },
      {
        optionName: "Newsletters",
        optionVoteCount: "98"
      },
      {
        optionName: "Interactive Buttons",
        optionVoteCount: "234"
      }
    ] 
  } 
})

💳 Payment Request Messages

await sock.sendMessage(jid, {
  requestPaymentMessage: {
    currency: "USD",
    amount: 50000,
    from: sender,
    background: {
      id: "100",
      fileLength: "0",
      width: 1000,
      height: 1000,
      mimetype: "image/webp"
    }
  }
})

🛍️ Product Messages

await sock.sendMessage(jid, {
  productMessage: {
    title: "Premium Headphones",
    description: "Wireless noise-cancelling headphones",
    thumbnail: { url: "https://example.com/product.jpg" },
    productId: "PROD001",
    retailerId: "STORE001",
    url: "https://example.com/products/headphones",
    priceAmount1000: 299000,
    currencyCode: "USD",
    buttons: [
      {
        name: "cta_url",
        buttonParamsJson: JSON.stringify({
          display_text: "Buy Now",
          url: "https://example.com/checkout"
        })
      }
    ]
  }
})

🛠️ TROUBLESHOOTING

Common Issues & Solutions

Pairing Code Not Working

· Ensure code is exactly 8 characters (letters/numbers) · Valid examples: "MRMALVIN", "ABCD1234", "TEST2026" · Invalid examples: "ABC", "123", "TOOLONG99"

Connection Drops

· Auto-reconnect is built-in and handles most cases · Check your internet stability · Verify Node.js version is 18+

QR Code Not Showing

· Set printQRInTerminal: true in socket config · Or listen to connection.update event for custom QR handling · Use pairing code method as alternative

Messages Not Sending

· Verify the JID format: number@s.whatsapp.net · Check if bot is connected: listen to connection.open event · Ensure you have proper authentication state


📞 SUPPORT & COMMUNITY

WhatsApp Channel Telegram GitHub Issues NPM Package


📝 NOTES

Note

This enhanced version includes improvements over the original repository. For base functionality and documentation, check out WhiskeySockets/Baileys.

Important

Always use a dedicated WhatsApp number for bots. Never use your personal number to avoid potential bans.


👨‍💻 DEVELOPER

Created & Maintained by Malvin King

GitHub NPM YouTube


⭐ Star this repository if you find it useful! ⭐

Built with ❤️ for the WhatsApp developer community

© 2026 Malvin Baileys - MIT License

About

Moded Official Fork Baileys Support MultiDevice Channels Groups

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors