
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
wwebjs-electron
Advanced tools
Library for interacting with the WhatsApp Web API through electron
A WhatsApp API client optimized for Electron applications
wwebjs-electron is a fork of whatsapp-web.js specifically optimized for use with Electron applications. It works seamlessly with puppeteer-in-electron to provide a native desktop WhatsApp experience. The library connects through WhatsApp Web using Puppeteer within Electron's BrowserView, providing access to all WhatsApp Web features while maintaining the security and performance benefits of Electron.
[!IMPORTANT] It is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
The module is now available on npm! npm i wwebjs-electron
For proper Electron integration, you also need to install these dependencies:
npm i wwebjs-electron puppeteer-core puppeteer-in-electron
[!NOTE] Node
v18+
is required.
Just get the latest LTS from the official node website.
sudo npm install -g n
sudo n stable
choco install nodejs-lts
winget install OpenJS.NodeJS.LTS
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
const { app, BrowserWindow, BrowserView } = require('electron');
const { Client, LocalAuth } = require('wwebjs-electron');
const pie = require('puppeteer-in-electron');
const puppeteer = require('puppeteer-core');
// Initialize puppeteer-in-electron
pie.initialize(app);
app.whenReady().then(async () => {
// Create main window
const mainWindow = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
nodeIntegration: false,
contextIsolation: true
}
});
// Connect browser
const browser = await pie.connect(app, puppeteer);
// Create BrowserView for WhatsApp
const whatsappView = new BrowserView({
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
webSecurity: false
}
});
// Get Puppeteer page from BrowserView
const page = await pie.getPage(browser, whatsappView);
// Set user agent
await page.setUserAgent(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
);
// Create WhatsApp client using the Puppeteer page
const client = new Client({
authStrategy: new LocalAuth(),
page: page
});
client.on('qr', (qr) => {
console.log('QR RECEIVED', qr);
// Display QR code to user
});
client.on('ready', () => {
console.log('WhatsApp Client is ready!');
});
client.on('message', async (msg) => {
if (msg.body === '!ping') {
await msg.reply('🤖 Pong!');
}
});
// Add BrowserView to window
mainWindow.addBrowserView(whatsappView);
mainWindow.setBrowserView(whatsappView);
// Set BrowserView bounds
const { width, height } = mainWindow.getContentBounds();
whatsappView.setBounds({ x: 0, y: 0, width, height });
// Initialize client
await client.initialize();
});
const { Client, LocalAuth } = require('wwebjs-electron');
const client = new Client({
authStrategy: new LocalAuth()
});
client.on('qr', (qr) => {
console.log('QR RECEIVED', qr);
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', msg => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});
client.initialize();
Take a look at example.js for another examples with additional use cases.
For further details on saving and restoring sessions, explore the provided Authentication Strategies.
wwebjs-electron provides several enhancements specifically designed for Electron applications:
Install the required packages:
npm install wwebjs-electron puppeteer-core puppeteer-in-electron
Initialize puppeteer-in-electron in your main process:
const pie = require('puppeteer-in-electron');
pie.initialize(app);
Use the provided Electron integration pattern as shown in the examples above.
For optimal compatibility, use these specific versions:
{
"wwebjs-electron": "^1.33.2",
"puppeteer-core": "^24.19.0",
"puppeteer-in-electron": "^3.0.5"
}
These versions have been tested together and provide the most stable experience.
Feature | Status |
---|---|
Multi Device | ✅ |
Send messages | ✅ |
Receive messages | ✅ |
Send media (images/audio/documents) | ✅ |
Send media (video) | ✅ (requires Google Chrome) |
Send stickers | ✅ |
Receive media (images/audio/video/documents) | ✅ |
Send contact cards | ✅ |
Send location | ✅ |
Send buttons | ❌ (DEPRECATED) |
Send lists | ❌ (DEPRECATED) |
Receive location | ✅ |
Message replies | ✅ |
Join groups by invite | ✅ |
Get invite for group | ✅ |
Modify group info (subject, description) | ✅ |
Modify group settings (send messages, edit info) | ✅ |
Add group participants | ✅ |
Kick group participants | ✅ |
Promote/demote group participants | ✅ |
Mention users | ✅ |
Mention groups | ✅ |
Mute/unmute chats | ✅ |
Block/unblock contacts | ✅ |
Get contact info | ✅ |
Get profile pictures | ✅ |
Set user status message | ✅ |
React to messages | ✅ |
Create polls | ✅ |
Channels | ✅ |
Vote in polls | 🔜 |
Communities | 🔜 |
Something missing? Make an issue and let us know!
Feel free to open pull requests; we welcome contributions! However, for significant changes, it's best to open an issue beforehand. Make sure to review our contribution guidelines before creating a pull request. Before creating your own issue or pull request, always check to see if one already exists!
You can support the maintainer of this project through the links below
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
Copyright 2019 Pedro S Lopez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this project except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Library for interacting with the WhatsApp Web API through electron
The npm package wwebjs-electron receives a total of 169 weekly downloads. As such, wwebjs-electron popularity was classified as not popular.
We found that wwebjs-electron demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.