WAWEB-phi
WAWEB-phi is library for controlling whatsapp web for nodejs,
inspired from whatsapp-web.js and WAPI.js
What is the difference? This library uses wapi.js which contains features such as sending pictures, sending to numbers that are not in the contact list
and many more
Installation
NPM
npm install waweb-phi
YARN
yarn add waweb-phi
Usage
const wa = require('waweb-phi')
const client = new wa({
puppeteer: { headless: false }
});
client.initialize();
Example
const wa = require('waweb-phi')
const client = new wa({
puppeteer: { headless: false }
});
client.initialize();
client.on('qr', (qr) => {
console.log('QR RECEIVED', qr);
});
client.on('authenticated', (session) => {
console.log('AUTHENTICATED', session);
});
client.on('auth_failure', msg => {
console.error('AUTHENTICATION FAILURE', msg);
})
client.on('ready', () => {
console.log('READY');
setTimeout(() => {
console.log("Send Message");
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
client.sendMessageToID("6289506096398@c.us", `test ${time}`).then((r) => {
console.log("sendMessageToID",r)
})
client.sendMessage("6289506096398@c.us", `test ${time}`).then((r) => {
console.log("sendMessage",r)
})
client.getBatteryLevel().then((r) => {
console.log("getBatteryLevel", r)
})
}, 2000);
});
client.on('message', async msg => {
console.log('MESSAGE RECEIVED', msg);
});
client.on('disconnected', () => {
console.log('Client was logged out');
})
Todo
Legal
This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk. Commercial use of this code/repo is strictly prohibited.
License
APACHE v2
made with 💗