Skip to content

azizemad-coder/neonize-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neonize-node

Simple, powerful WhatsApp API for Node.js — powered by Neonize.

npm version License: MIT

Features

  • 🚀 Simple API - Send messages in just a few lines of code
  • 📱 Full WhatsApp Support - Messages, media, groups, reactions, polls & more
  • 🔒 Multi-Device - Works with WhatsApp's multi-device protocol
  • High Performance - Native Go library via FFI
  • 📦 Zero Config - Just install and connect

Installation

npm install @azizemad/neonize-node

The native library is automatically downloaded on install.

Supported Platforms

Platform Architecture Status
Windows x64
Linux x64
Linux ARM64
macOS x64
macOS ARM64 (M1+)

Quick Start

Simple API (Recommended)

import { WhatsApp } from '@azizemad/neonize-node';

const wa = new WhatsApp();

wa.onMessage((msg) => {
    console.log(`${msg.sender}: ${msg.text}`);
    
    if (msg.text === 'ping') {
        msg.reply('pong 🏓');
    }
});

wa.onConnected(() => {
    console.log('Connected! My number:', wa.myNumber);
});

wa.connect();

Send Messages

// Text message
wa.send('1234567890', 'Hello from neonize-node!');

// Image with caption
wa.sendImage('1234567890', './photo.jpg', 'Check this out!');

// Document
wa.sendDocument('1234567890', './file.pdf', 'document.pdf');

// Poll
wa.sendPoll('1234567890', 'Best pizza topping?', ['Pepperoni', 'Mushrooms', 'Pineapple']);

Message Actions

wa.onMessage((msg) => {
    // Reply with quoted context
    msg.reply('Thanks for your message!');
    
    // React to the message
    msg.react('👍');
    
    // Delete the message (your own messages only)
    msg.delete();
    
    // Download media
    if (msg.hasImage) {
        const buffer = msg.downloadMedia();
        fs.writeFileSync('image.jpg', buffer);
    }
});

Groups

// Get all groups
const groups = wa.getGroups();

// Get group info
const info = wa.getGroupInfo('123456789@g.us');

Advanced API

For full control, use the NewClient class directly:

import { NewClient, Event, EventType } from '@azizemad/neonize-node';

const client = new NewClient('session.db');

// Set up event handling
client.event.onMessage((client, message) => {
    console.log('Received:', message);
});

client.event.onConnected((client) => {
    console.log('Connected!');
    
    // Full API access
    client.sendMessage(jid, { conversation: 'Hello!' });
    client.sendReaction(chatJid, senderJid, messageId, '❤️');
    client.editMessage(chatJid, messageId, 'Edited text');
    // ... and 90+ more methods
});

await client.connect();

API Reference

WhatsApp Class (Simple API)

Method Description
onMessage(handler) Handle incoming messages
onConnected(handler) Handle connection
onQR(handler) Handle QR code display
onDisconnected(handler) Handle disconnection
send(to, text) Send text message
sendImage(to, image, caption?) Send image
sendVideo(to, video, caption?) Send video
sendDocument(to, doc, filename) Send document
sendPoll(to, question, options) Send poll
getGroups() Get joined groups
getGroupInfo(groupId) Get group details
connect() Start connection
disconnect() Close connection
logout() Logout and clear session

Message Class

Property Description
text Message text content
sender Sender's phone number
chatId Chat identifier
id Message ID
isGroup Is from a group?
isFromMe Is from yourself?
hasImage Has image attachment?
hasVideo Has video attachment?
hasDocument Has document attachment?
Method Description
reply(text) Reply with quoted context
react(emoji) React with emoji
delete() Delete/revoke message
downloadMedia() Download media as Buffer

Configuration

Database Location

The session is stored in a SQLite database. Default is neonize.db in the current directory.

const wa = new WhatsApp('my-session.db');

Logging

Enable debug logging:

const client = new NewClient('session.db', {
    logLevel: 'DEBUG' // DEBUG, INFO, WARN, ERROR
});

client.event.debug(true);

Requirements

  • Node.js 18.0.0 or higher
  • Windows, Linux, or macOS (x64 or ARM64)

Troubleshooting

"Could not find goneonize library"

The native library wasn't downloaded. Run manually:

node node_modules/@azizemad/neonize-node/scripts/download.js

"Couldn't link device" on QR scan

This usually means the session is corrupted. Delete the .db file and try again.

Credits

  • Neonize - The Go library powering this package
  • whatsmeow - WhatsApp Web API implementation

License

MIT © See LICENSE for details.

About

Simple, powerful WhatsApp API for Node.js — powered by [Neonize](https://github.com/krypton-byte/neonize).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors