neonize 1.0.0
neonize: ^1.0.0 copied to clipboard
A Dart/Flutter library for WhatsApp automation and bot development, providing a high-level interface to interact with WhatsApp Web protocol through the Neonize Go library. Features include message han [...]
π Neonize Dart #
WhatsApp Automation Made Simple for Dart & Flutter #
A powerful Dart wrapper for Neonize - enabling seamless WhatsApp automation in your Dart and Flutter applications
β οΈ DEVELOPMENT STATUS - NOT READY FOR PRODUCTION #
π§ WORK IN PROGRESS π§
This project is currently under active development and is NOT ready for production use.
Getting Started β’ Features β’ Examples β’ Documentation β’ Contributing

β¨ What is Neonize Dart? #
Neonize Dart is a comprehensive Dart wrapper around the powerful Neonize shared library, bringing WhatsApp automation capabilities directly to your Dart and Flutter projects.
π― Why Choose Neonize Dart? #
- π₯ High Performance - Built on top of the battle-tested Neonize library
- π± Cross-Platform - Works seamlessly on Android, iOS, Windows, macOS, and Linux
- π‘οΈ Type Safe - Full Dart type safety with comprehensive error handling
- β‘ Real-time - Handle messages, media, and events in real-time
- π§ Easy Integration - Simple API design for quick implementation
- π Well Documented - Comprehensive documentation and examples
π Features #
Core Messaging #
- β Send and receive text messages
- β Handle media files (images, videos, documents, audio)
- β Group management and operations
- β Real-time message events
- β Message receipts and status tracking
Advanced Capabilities #
- π End-to-end encryption support
- π― Contact and user information retrieval
- π Call event handling
- π Presence and typing indicators
- π° Newsletter support
- π« Blocklist management
Developer Experience #
- π Event-driven architecture
- π Built-in logging and debugging
- ποΈ SQLite and PostgreSQL database support
- π§ͺ Comprehensive test coverage
π Getting Started #
Prerequisites #
- Dart SDK 3.0 or higher
- Flutter 3.0+ (for Flutter projects)
Installation #
β οΈ Since this project is still unstable, please follow these manual installation steps:
-
Clone this repository
git clone https://github.com/krypton-byte/neonize-dart.git cd neonize-dart
-
Download the Neonize shared library
- Go to Neonize Releases
- Download the appropriate shared library for your platform:
- Linux:
.so
file - macOS:
.dylib
file - Windows:
.dll
file
- Linux:
-
Set environment variable
# Set NEONIZE_PATH to point to your shared library location export NEONIZE_PATH=/path/to/your/neonize-library.so # For Windows (PowerShell) $env:NEONIZE_PATH="C:\path\to\your\neonize-library.dll" # For Windows (Command Prompt) set NEONIZE_PATH=C:\path\to\your\neonize-library.dll
-
Install dependencies
dart pub get
-
Run the example
# You can run the example directly from the bin folder dart run bin/main.dart
Alternative Installation (When Stable) #
Once the project becomes stable, you'll be able to add it directly to your pubspec.yaml
:
dependencies:
neonize: ^1.0.0 # Replace with actual version
Quick Start #
import 'package:neonize/neonize.dart';
void main() {
// Initialize the client
final client = NewAClient(
name: 'my-whatsapp-bot',
config: Config(
tempPath: '/tmp',
databasePath: './whatsapp.db',
),
);
// Handle incoming messages
client.on<Message>((message) {
print('π¨ Received: ${message.message}');
// Auto-reply example
if (message.message?.conversation?.toLowerCase() == 'hello') {
client.sendMessage(
message.info!.messageSource!.chat!,
text: 'π Hello there! How can I help you?'
);
}
});
// Handle QR code for authentication
client.qr((qrData) {
print('π± Scan this QR code with WhatsApp:');
qrTerminal(qrData, 2, size: 10);
});
// Handle connection events
client.on<Connected>((event) {
print('π Connected to WhatsApp!');
});
// Start the client
client.connect();
}
π‘ Examples #
π± Basic Client Setup #
import 'package:neonize/neonize.dart';
import 'dart:io';
void main() {
// Initialize the WhatsApp client
final client = NewAClient(
name: 'my-whatsapp-bot',
config: Config(
tempPath: '/tmp',
databasePath: './neonize.db',
),
);
// Setup QR code authentication
client.qr((qrData) {
print('π± Scan this QR code with WhatsApp:');
qrTerminal(qrData, 2, size: 10);
});
// Handle successful connection
client.on<Connected>((event) {
print('π Successfully connected to WhatsApp!');
});
// Start the client
client.connect();
}
π¬ Sending Messages #
// Send simple text message
client.sendMessage(
buildJID('1234567890'),
text: 'Hello from Neonize Dart! π'
);
// Send image with caption
final imageFile = File('/path/to/your/image.jpg');
final imageBytes = imageFile.readAsBytesSync();
final imageMessage = client.buildImageMessage(
imageBytes,
'Check out this amazing image! πΈ',
'image/jpeg',
Uint8List(0), // thumbnail (optional)
);
client.sendMessage(
buildJID('1234567890'),
message: imageMessage,
);
// Send document file
final document = File('/path/to/document.pdf');
final documentBytes = document.readAsBytesSync();
final documentMessage = client.buildDocumentMessage(
documentBytes,
'document.pdf',
'Here is the document you requested',
'application/pdf',
);
client.sendMessage(
buildJID('1234567890'),
message: documentMessage,
);
π Message Event Handling #
// Handle incoming text messages
client.on<Message>((message) {
final messageText = message.message?.conversation;
final senderJID = message.info?.messageSource?.sender;
final chatJID = message.info?.messageSource?.chat;
print('π¨ Received from $senderJID: $messageText');
// Auto-reply functionality
if (messageText?.toLowerCase() == 'hello') {
client.sendMessage(chatJID, text: 'Hello there! π');
} else if (messageText?.toLowerCase() == 'help') {
const helpText = '''
π€ *Bot Commands:*
β’ hello - Get a greeting
β’ help - Show this help message
β’ time - Get current time
β’ joke - Get a random joke
''';
client.sendMessage(chatJID, text: helpText);
}
});
// Handle message receipts (delivery status)
client.on<Receipt>((receipt) {
print('π§ Message ${receipt.type}: ${receipt.messageIds}');
});
// Handle typing indicators
client.on<ChatPresence>((chatPresence) {
final chat = chatPresence.messageSource?.chat;
final participant = chatPresence.messageSource?.sender;
print('π¬ $participant is typing in $chat');
});
π₯ Group Management #
// Create a new group
final participants = [
buildJID('1234567890'),
buildJID('0987654321'),
];
final groupInfo = client.createGroup(
'My Awesome Group π',
participants,
);
print('π Group created: ${groupInfo.jid}');
// Get group information
final groupInfo = client.getGroupInfo(...);
print('π Group Name: ${groupInfo.groupName}');
print('π Description: ${groupInfo.groupDesc}');
print('π₯ Participants: ${groupInfo.participants?.length ?? 0}');
// Add participants to group
client.updateGroupParticipants(
jidGroup,
[userJid],
ParticipantAction.add,
);
// Remove participants from group
client.updateGroupParticipants(
jidGroup,
[userJid],
ParticipantAction.remove,
);
// Update group name
client.updateGroupName(
jidGroup,
'New Group Name π―',
);
// Update group description
client.updateGroupDescription(
jidGroup,
'This is our updated group description',
);
π Contact & Profile Management #
// Get user profile information
final profile = client.getProfilePicture(
jidUser,
true, // get full resolution
);
print('π€ Profile picture URL: ${profile.url}');
print('π Profile ID: ${profile.id}');
// Update your own status
client.setPresence(Presence.available);
print('β
Status updated to available');
// Get contact information
final isRegistered = client.isOnWhatsApp(['1234567890']);
if (isRegistered.isNotEmpty && isRegistered.first.isIn) {
print('β
User is registered on WhatsApp');
print('π± JID: ${isRegistered.first.jid}');
} else {
print('β User is not on WhatsApp');
}
// Check if multiple contacts are on WhatsApp
final contacts = ['1234567890', '0987654321', '1122334455'];
final registeredContacts = client.isOnWhatsApp(contacts);
for (final contact in registeredContacts) {
if (contact.isIn) {
print('β
${contact.jid} is on WhatsApp');
} else {
print('β ${contact.query} is not on WhatsApp');
}
}
ποΈ Project Structure #
neonize-dart/
βββ bin
β βββ main.dart
β βββ qr_test.dart
βββ CHANGELOG.md
βββ lib
β βββ neonize.dart
β βββ src
β βββ client.dart
β βββ config.dart
β βββ enum.dart
β βββ error.dart
β βββ event
β β βββ event.dart
β β βββ type.dart
β βββ ffi
β β βββ bindings.dart
β β βββ structs.dart
β β βββ utils.dart
β βββ helpers
β β βββ helpers.dart
β β βββ image.dart
β βββ logging.dart
β βββ qr.dart
βββ LICENSE
βββ Makefile
βββ neonize.db
βββ neonize-linux-amd64.so
βββ pubspec.lock
βββ pubspec.yaml
βββ README.md
βββ scripts
βββ test
β βββ neonize_test.dart
π Documentation #
Core Classes #
NewAClient
- Main WhatsApp clientConfig
- Client configuration- Event Types - Available event types
- Protocol Buffers - Message definitions
Event System #
The event system in Neonize Dart is built around strongly-typed events:
// Type-safe event handling
client.on<Message>((msg) => handleMessage(msg));
client.on<Receipt>((receipt) => handleReceipt(receipt));
client.on<Presence>((presence) => handlePresence(presence));
Database Support #
Neonize Dart supports multiple database backends:
// SQLite (default)
Config(databasePath: './app.db')
// PostgreSQL
Config(databasePath: 'postgres://user:pass@localhost/dbname')
π€ Contributing #
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
Development Setup #
# Clone the repository
git clone https://github.com/krypton-byte/neonize-dart.git
cd neonize-dart
# Get dependencies
dart pub get
# Run tests
dart test
# Run the example
dart run bin/main.dart
π License #
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
π Acknowledgments #
- Neonize - The powerful Python library this project wraps
- Whatsmeow - The Go library that powers Neonize
- Dart & Flutter Community - For the amazing ecosystem
π Support #
- π§ Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Documentation: Full Documentation
Made with β€οΈ for the Dart & Flutter community
If this project helped you, please consider giving it a β on GitHub!