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

TypeError: Cannot read properties of undefined (reading 'createWid') #1773

Closed Murilandrade closed 7 months ago

Murilandrade commented 1 year ago

Is there an existing issue for this?

Describe the bug

I use the injected.js from a chrome extension and when i use this code:

const newMessage = async (chatId, message) => { const chatWid = window.Store.WidFactory.createWid(chatId); const chat = await window.Store.Chat.find(chatWid); const msg = await window.WWebJS.sendMessage(chat, message);

return msg.serialize();

}

newMessage("5571991580344@c.us", "hi, how are you?");

is not working

Expected behavior

Yestarday the code was sending messages and today is not working

Steps to Reproduce the Bug or Issue

inject the file injected.js on whatsapp web and than, run the code on terminal

Relevant Code

No response

Browser Type

Google Chrome

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

windows 11 Whatsapp Web version: latest version

Additional context

No response

dsaha1656 commented 1 year ago

faced same problem today

luiscuriel commented 1 year ago

Similar problem here: cannot convert wid to ChatJid

sautpt commented 1 year ago

I have the same problem ..

sciapuscio commented 1 year ago

Same problem now

luiscuriel commented 1 year ago

no solution yet to "cannot convert wid to ChatJid"?

alechkos commented 7 months ago

Wrong user id is passed, check example.js