orkestral / venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
https://orkestral.io
Apache License 2.0
6.08k stars 1.2k forks source link

WAPI is not defined issue found again and again [when sending message to other number to bot & bot is not responding] #2672

Closed verstechprince closed 6 months ago

verstechprince commented 6 months ago

Description

Whatsapp venom-bot is not responding on 5.0.21 yesterday its working code but today is not working resolve the issue WAPI is not defined or suggest me tip to resolve it .

Environment

Code

const venom = require('venom-bot');

venom
  .create({
    session: 'user-account' //name of session
  })
  .then((client) => start(client))
  .catch((erro) => {
    console.log(erro);
  });

function start(client) {
    console.log(client)
  client.onMessage((message) => {
    console.log(message)
    if (message.body === 'hi' && message.isGroupMsg === false) {
      client
        .sendText(message.from, 'Welcome Venom 🕷')
        .then((result) => {
          console.log('Result: ', result); //return object success
        })
        .catch((erro) => {
          console.error('Error when sending: ', erro); //return object error
        });
    }
  });
}

Error [After Connection]

Error [ReferenceError]: WAPI is not defined
    at evaluate (evaluate at Whatsapp.addChatWapi (F:\Work - Main\Running Projects\Darjuv9\node_modules\venom-bot\dist\api\whatsapp.js:72:25), <anonymous>:0:12)      
    at #evaluate (F:\Work - Main\Running Projects\Darjuv9\node_modules\puppeteer\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\ExecutionContext.js:231:55)        
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (F:\Work - Main\Running Projects\Darjuv9\node_modules\puppeteer\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\ExecutionContext.js:126:16)
    at async IsolatedWorld.evaluate (F:\Work - Main\Running Projects\Darjuv9\node_modules\puppeteer\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\IsolatedWorld.js:131:16)
    at async CdpFrame.evaluate (F:\Work - Main\Running Projects\Darjuv9\node_modules\puppeteer\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Frame.js:363:20)     
    at async CdpPage.evaluate (F:\Work - Main\Running Projects\Darjuv9\node_modules\puppeteer\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Page.js:751:20)       
    at async Whatsapp.addChatWapi (F:\Work - Main\Running Projects\Darjuv9\node_modules\venom-bot\dist\api\whatsapp.js:72:9)
    at async F:\Work - Main\Running Projects\Darjuv9\node_modules\venom-bot\dist\controllers\initializer.js:349:13
ghayman commented 6 months ago

Please could you try with latest github version. WhatsApp has been making breaking changes to web.whatsapp.com in their latest Beta version - it could be they are now rolling it to production.

Please report back your results - good or bad.

npm install orkestral/venom

A big shout out to @9cb14c1ec0 who is largely responsible for getting Venom-bot to work again

9cb14c1ec0 commented 6 months ago

Please could you try with latest github version. WhatsApp has been making breaking changes to web.whatsapp.com in their latest Beta version - it could be they are now rolling it to production.

Yes, I have run into that as well. Some of the beta versions randomly have problems, so I would advise staying on a non-beta version if at all possible.

thiagoalvesfoz commented 6 months ago

I have the same problem, it started after the last Whatsapp update

[edit] It works when I disconnect from the session and delete the tokens/ folder which is automatically generated.

alxcancado commented 6 months ago

I have the same problem, it started after the last Whatsapp update

[edit] It works when I disconnect from the session and delete the tokens/ folder which is automatically generated.

Still does not work @5.0.21, "Error [ReferenceError]: WAPI is not defined..."

9cb14c1ec0 commented 6 months ago

The npm version is old, and does not have the latest updates. Use npm install orkestral/venom instead.

farleyBatista commented 6 months ago

Same error here, but it doesn't go beyond the Checking is logged... option.

thiagoalvesfoz commented 6 months ago

[update]

A new release corrected all my problems like WAPI is not defined that I was facing in the last few days.

npm install venom-bot@5.1.0
orkestral commented 6 months ago

We have support for Venom for just $15 per month, if you are interested, call our support via the link: https://web.whatsapp.com/send?phone=5561985290357