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

@mlhkinfotech/wa-server

v1.0.3

Published

Ready-to-deploy REST API and WebSocket Server for MLHK WhatsApp AI Ecosystem

Readme

@mlhkinfotech/wa-server

npm version License: MIT

Turnkey, production-grade REST API and WebSocket Server for the MLHK WhatsApp AI Ecosystem. Includes rate-limiting, bearer token security, multi-session management, live Socket.IO events, and a reliable notification queuing system.


🚀 Features

  • RESTful API: Endpoints for sending messages, checking bot status, session control, and broadcasts.
  • Real-time WebSockets (Socket.IO): Live feeds for QR code generation, incoming WhatsApp chats, session connection state, and server telemetry.
  • Asynchronous Notification Queue (NotificationQueue): Priority-based background delivery queue with retries and delay spacing to prevent WhatsApp rate limits.
  • Security & Multi-Tenant: Configurable API tokens (API_SECRET_TOKEN), CORS whitelist, and request rate limiting.
  • Docker-Ready: Comes with production Dockerfile and docker-compose.yml.

📦 Installation

# Direct npm package
npm install @mlhkinfotech/wa-server

# Or run instantly via npx
npx @mlhkinfotech/wa-server

💻 Quick Start

Embedded in Node.js

import { createWAServer } from '@mlhkinfotech/wa-server';

const server = createWAServer({
  port: 3001,
  apiSecret: 'your-secure-secret-token',
  sessionDir: './sessions'
});

await server.start();
console.log('MLHK WhatsApp Server listening on port 3001');

🌐 REST API Endpoints

All protected endpoints accept header: Authorization: Bearer <API_SECRET_TOKEN>

| Method | Endpoint | Description | |---|---|---| | GET | /health | Server health, uptime, and system status | | GET | /api/status | Current WhatsApp connection status & session details | | GET | /api/qr | Latest QR code in Data URL (image) and raw text | | POST | /api/send | Send a text message to a specific phone number or group | | POST | /api/broadcast | Broadcast message to multiple recipients with safe pacing | | POST | /api/notifications/queue | Add a message to asynchronous delivery queue | | GET | /api/sessions | List all managed sessions | | POST | /api/sessions/:id/restart | Restart a specific WhatsApp session |

Example: Send Message via cURL

curl -X POST http://localhost:3001/api/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer my-secret-token" \
  -d '{
    "to": "919876543210",
    "text": "Hello! Your invoice #INV-2024 is ready."
  }'

🔌 Real-Time WebSocket Events (Socket.IO)

Connect from any frontend dashboard (e.g., React, Vue, Mobile):

import { io } from 'socket.io-client';

const socket = io('http://localhost:3001', {
  auth: { token: 'my-secret-token' }
});

// Real-time QR Code
socket.on('wa:qr', ({ qrDataUrl }) => {
  document.getElementById('qr-img').src = qrDataUrl;
});

// WhatsApp Connected
socket.on('wa:ready', (data) => {
  console.log('Bot ready:', data);
});

// Live incoming/outgoing chat messages
socket.on('wa:message', (message) => {
  console.log('New message:', message);
});

🐳 Docker Deployment

Run with Docker Compose:

version: '3.8'
services:
  wa-server:
    image: node:22-alpine
    working_dir: /app
    command: npx @mlhkinfotech/wa-server
    ports:
      - "3001:3001"
    environment:
      - PORT=3001
      - API_SECRET_TOKEN=my-secret-token
      - AI_PROVIDER=gemini
      - GEMINI_API_KEY=your-api-key
    volumes:
      - ./sessions:/app/sessions

📄 License

MIT © MLHK Infotech