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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nyasocket

v1.0.3

Published

Advanced, robust, and easy-to-use WhatsApp bot framework for Node.js

Readme

🐱✨ NyaSocket ✨🐱

The cutest WhatsApp bot framework you'll ever use! 💕

npm version TypeScript License: MIT

Making WhatsApp bots as easy as saying "Nya~!" 🎀

✨ Features🚀 Quick Start📚 Docs🎨 Examples


💝 Why NyaSocket?

Building WhatsApp bots shouldn't be complicated! NyaSocket wraps the powerful Baileys library in a super cute and easy-to-use API that makes bot development feel like magic! ✨

// Look how simple! 🎉
bot.command("hello", async (ctx) => {
  await ctx.reply("Nya~ Hello! 🐱");
});

Trusted by developers who love cute things 🌟


✨ Sparkles Features

🎨 Beautiful API

Write clean, readable code that makes you smile! Our fluent API is designed for maximum cuteness and minimum complexity.

Plugin Magic

Extend your bot with adorable plugins! Mix and match features like building with LEGO blocks! 🧩

�️ Built-in Protection

Rate limiting keeps your bot safe from spam. No more bans! Your bot stays happy and healthy! 💪

🎯 Smart Commands

Simple /command system that just works! No configuration headaches, just pure joy! ✨

Rich Media

Send images, videos, stickers, and more! Make your conversations come alive! 🎭

TypeScript Love

Full type safety means fewer bugs and more fun! Your IDE will love you! 💕


� Rocket Quick Start

Installation 📦

npm install nyasocket
# or with yarn
yarn add nyasocket

Your First Bot 🎀

import { Bot, LocalAuth, RateLimitMiddleware } from 'nyasocket';
import QRCode from 'qrcode-terminal';

// Create your adorable bot! 🐱
const bot = new Bot(
  "my-cute-bot-uuid",
  new LocalAuth("my-uuid", "sessions"),
  { jid: "", pn: "", name: "CuteBot" }
);

// Show QR code in terminal ✨
bot.on("qr", (qr) => {
  QRCode.generate(qr, { small: true });
  console.log("✨ Scan me with WhatsApp! ✨");
});

// Celebrate when connected! 🎉
bot.on("open", () => {
  console.log("🎊 Bot is online and ready to spread joy! 🎊");
});

// Add some protection 🛡️
bot.use(RateLimitMiddleware);

// Create your first command! 💫
bot.command("ping", async (ctx) => {
  await ctx.reply("🏓 Pong! I'm alive and well! 💕");
});

bot.command("cute", async (ctx) => {
  await ctx.reply("(=^・ω・^=) Nya~! 🐱✨");
});

// Start the magic! 🌟
await bot.login("qr");

✨ That's it! Your bot is ready to spread happiness! ✨


🎨 Art Examples

🖼️ Send Beautiful Images

bot.command("cat", async (ctx) => {
  await ctx.replyImage(
    "https://cataas.com/cat",
    "Here's a random cat for you! 🐱💕"
  );
});

🎬 Share Videos

bot.command("video", async (ctx) => {
  await ctx.replyVideo(
    "https://example.com/cute-video.mp4",
    "Check out this adorable video! 🎥✨"
  );
});

🎵 Play Audio

bot.command("music", async (ctx) => {
  await ctx.replyAudio("https://example.com/song.mp3");
});

🔌 Plugin System

Create reusable magic! ✨

const WelcomePlugin = {
  name: 'WelcomePlugin',
  init: (bot) => {
    bot.on('group-participants.update', async (update) => {
      if (update.action === 'add') {
        await bot.sendMessage(update.id, {
          text: "🎉 Welcome to our awesome group! 🎊"
        });
      }
    });
  }
};

await bot.loadPlugin(WelcomePlugin);

🎁 Built-in Plugins

  • 🎊 WelcomePlugin - Greet new members with style
  • 👑 AdminPlugin - Powerful group management
  • 🎮 FunPlugin - Games and entertainment

🌈 Middleware Magic

Stack middleware like pancakes! 🥞

// Log all messages 📝
bot.use(async (ctx, next) => {
  console.log(`💬 Message from ${ctx.from.name}`);
  await next();
});

// Rate limiting (built-in!) 🛡️
bot.use(RateLimitMiddleware);

// Custom middleware 🎨
bot.use(async (ctx, next) => {
  if (ctx.body.includes("bad word")) {
    await ctx.reply("Please be nice! 💕");
    return;
  }
  await next();
});

👥 Group Management

Manage groups like a pro! 👑

// Create a group 🎉
await bot.createGroup("Cute Friends", [
  "[email protected]",
  "[email protected]"
]);

// Promote to admin 👑
await bot.promoteGroupParticipants(groupJid, [userJid]);

// Update group info 📝
await bot.updateGroupSubject(groupJid, "Super Cute Friends 🌟");
await bot.updateGroupDescription(groupJid, "The cutest group ever! 💕");

📚 Books Documentation

🎯 Core Concepts

| Concept | Description | |---------|-------------| | Bot 🤖 | Your main bot instance - the heart of everything! | | Commands ⚡ | Simple /command handlers that respond to messages | | Middleware 🔄 | Process messages before they reach commands | | Plugins 🔌 | Reusable modules that add features | | Events 📡 | React to WhatsApp events in real-time |

🎨 Context Object

Every command gets a magical ctx object:

bot.command("info", async (ctx) => {
  ctx.msg        // 📨 Original message
  ctx.from       // 👤 Sender info
  ctx.chat       // 💬 Chat info
  ctx.body       // 📝 Message text
  
  // Helper methods ✨
  await ctx.reply("Text message")
  await ctx.replyImage(url, caption)
  await ctx.replyVideo(url, caption)
  await ctx.replyAudio(url)
  await ctx.replySticker(url)
});

🎪 Events

Listen to everything! 👂

bot.on("qr", (qr) => {
  // 📱 QR code for login
});

bot.on("open", (account) => {
  // 🎉 Connected!
});

bot.on("messages.upsert", (messages) => {
  // 💬 New messages
});

bot.on("contacts.update", (contacts) => {
  // 👥 Contact updates
});


🔐 Session Encryption

Protect your WhatsApp sessions with military-grade encryption! 🛡️

NyaSocket includes a unique encryption system using AES-256-GCM with PBKDF2 key derivation.

🎯 Features

  • 🔒 AES-256-GCM - Authenticated encryption
  • 🔑 PBKDF2 - 100,000 iterations for key derivation
  • 🎲 Unique Salt - Cryptographically secure per-session
  • Auth Tag - Integrity verification
  • 🛡️ Random IV - Unique initialization vector per file

💫 Usage

import { EncryptedAuth } from 'nyasocket';

const auth = new EncryptedAuth(
  uuid,
  "sessions",
  "your-super-secret-password"
);

const bot = new Bot(uuid, auth, account);

Your session files will be completely encrypted and unreadable without the password! 🎉


🌥️ Cloud Deployment

NyaSocket is cloud-ready out of the box! Deploy to modern platforms with ease! ✨

🎯 Session Storage Options

🔴 RedisAuth

Perfect for cloud platforms!

import { RedisAuth } from 'nyasocket';

const auth = new RedisAuth(
  uuid,
  process.env.REDIS_URL
);

Best for: Heroku, Railway, Render

🍃 MongoAuth

Persistent & scalable!

import { MongoAuth } from 'nyasocket';

const auth = new MongoAuth(
  uuid,
  process.env.MONGO_URL
);

Best for: MongoDB Atlas

☁️ S3Auth

Serverless-friendly!

import { S3Auth } from 'nyasocket';

const auth = new S3Auth(
  uuid,
  process.env.S3_BUCKET
);

Best for: AWS Lambda

🚀 Quick Deploy

Railway (Easiest!)

railway init
railway add redis
railway up

Docker

docker-compose up -d

Heroku

heroku create my-bot
heroku addons:create heroku-redis:mini
git push heroku main

📖 Full Deployment Guide →


💡 Pro Tips

🌟 Make your bot even more amazing! 🌟

  1. 🛡️ Always use RateLimitMiddleware - Keep your bot safe!
  2. 🎨 Use plugins - Don't reinvent the wheel!
  3. 📝 Log everything - Debugging is easier with good logs!
  4. 💕 Be nice - Make bots that spread positivity!
  5. 🔐 Protect sessions - Keep your auth data safe!

🤝 Contributing

We love contributions! 💕

  1. 🍴 Fork the repo
  2. 🌟 Create your feature branch
  3. 💝 Commit your changes
  4. 🚀 Push to the branch
  5. 🎉 Open a Pull Request

� License

MIT License - Use it, love it, share it! 💕


🌸 Made with love and lots of Nya~! 🌸

⭐ Star us on GitHub🐛 Report Bug💡 Request Feature

Built with 💖 by developers who believe coding should be fun!


🎀 "The only WhatsApp bot framework that makes you smile!" 🎀