pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.53k stars 3.46k forks source link

Whatsapp-web.js is not working ...can anyone guide about this npm package ? #2921

Closed arslan9024 closed 3 months ago

arslan9024 commented 3 months ago

Is there an existing issue for this?

Describe the bug

There is some issue with the npm package whatsapp-web.js and after i install and create the new client with localAuth in index.js file it does not work. i have searched the errors about local web cache and other issues with can not read property null and undefined. still struggling to run this program from many days. can someone help to run this program?

Expected behavior

error

Steps to Reproduce the Bug or Issue

  1. npm init
  2. npm install whatsapp-web.js
  3. npm install qrcode-terminal
  4. create index.js file with this
  5. i just console.log every message received.

Relevant Code

import pkg from "whatsapp-web.js"; import qrcode from 'qrcode-terminal' const {LocalAuth, Client} = pkg;

export const Client = new Client({ webVersion: "2.2325.3", webVersionCache: { type: "remote", remotePath: "https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2325.3.html", }, authStrategy: new LocalAuth({ dataPath:"AuthFolder", clientId: "client-one" }), puppeteer: { args: ['--no-sandbox', '--disable-setuid-sandbox'], } }); Client.on('loading_screen', (percent, message) => { console.log('LOADING SCREEN', percent, message); }); Client.on('authenticated', () => { console.log('AUTHENTICATED'); }); Client.on('auth_failure', msg => { // Fired if session restore was unsuccessful console.error('AUTHENTICATION FAILURE', msg); }); Client.on('ready', () => { console.log('Bot is getting ready!') }); Client.on('qr', (qr) => { // NOTE: This event will not be fired if a session is specified. qrcode.generate(qr, {small: true}) // console.log('QR RECEIVED', qr); }); Client.on('message', msg => { if (msg.body == '!ping') { msg.reply('pong'); } console.log(msg) }); await Client.initialize();

Browser Type

Chromium

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: [e.g. Mac, Windows, Linux, Docker + Ubuntu 18, etc] Phone OS: [e.g. Android, iOS] whatsapp-web.js version [e.g. 1.2.3] WhatsApp Web version [run await client.getWWebVersion()]: Node.js Version [e.g. 1.2.3]

Additional context

No response

alechkos commented 3 months ago

2789