Files
whatsapp-web.js/example.js
2019-02-17 21:14:31 -04:00

27 lines
479 B
JavaScript

const { Client } = require('./src')
const client = new Client({puppeteer: {headless: false}});
client.initialize();
client.on('qr', (qr) => {
console.log('QR RECEIVED', qr);
});
client.on('authenticated', () => {
console.log('AUTHENTICATED');
});
client.on('ready', () => {
console.log('READY');
});
client.on('message', (msg) => {
console.log('MESSAGE RECEIVED', msg);
if (msg.body == 'ping') {
client.sendMessage(msg.from, 'pong');
}
})