Open darkash opened 4 years ago
I have the same problem, something changed in how the chat room was created
ModelCreateError: Unknown at t.n (https://web.whatsapp.com/app.5be2ce7458b30031ac49.js:1:1041158) at new t (https://web.whatsapp.com/app.5be2ce7458b30031ac49.js:1:348068) at https://web.whatsapp.com/app2.13be54c9099a5680d99c.js:2:812334 at H (https://web.whatsapp.com/app.5be2ce7458b30031ac49.js:1:1011872) at MutationObserver.W (https://web.whatsapp.com/app.5be2ce7458b30031ac49.js:1:1011453)
Some idea about this?
Some idea about this? 2
I have the same problem. Can't send a message to an Id if there is no previous chat. (sendMessageToID)
I've replaced window.WAPI.getChat function
window.WAPI.getChat = async function(id, done) {
id = typeof id == 'string' ? id : id._serialized;
let found = window.Store.Chat.get(id);
if (found === undefined) {
//not found in Chat store
const exists = await Store.WapQuery.queryExist(id);
if (exists.status !== 404) {
// Account exists
const idUser = new window.Store.UserConstructor(id, { intentionallyUsePrivateConstructor: true })
await Store.Chat.find(idUser)
found = window.Store.Chat.get(id);
} else {
return false
}
}
found.sendMessage = found.sendMessage ? found.sendMessage : function() {
return window.Store.sendMessage.apply(this, arguments);
};
if (done !== undefined) done(found);
return found;
};
or use: driver.send_message_to_id(message.chat_id['_serialized'],"text")
I've replaced window.WAPI.getChat function
window.WAPI.getChat = async function(id, done) { id = typeof id == 'string' ? id : id._serialized; let found = window.Store.Chat.get(id); if (found === undefined) { //not found in Chat store const exists = await Store.WapQuery.queryExist(id); if (exists.status !== 404) { // Account exists const idUser = new window.Store.UserConstructor(id, { intentionallyUsePrivateConstructor: true }) await Store.Chat.find(idUser) found = window.Store.Chat.get(id); } else { return false } } found.sendMessage = found.sendMessage ? found.sendMessage : function() { return window.Store.sendMessage.apply(this, arguments); }; if (done !== undefined) done(found); return found; };
Sorry, but not work
@mayconmano check if you are awaiting your window.WAPI.getChat when sending message. Mine is working that way.
@lucasmori1 I have tried : WAPI.sendMessage('91xxxxxxxxxx@c.us', 'fsdfsd')
but it is saying :
TypeError: chat.sendMessage is not a function[Learn More]
please help me fast....
send_message_to_id no longer works like it was previously
right now it can only send message to someone who previously had chatroom. Meanwhile before Whatsapp Web update, you can create new chat room and send the message there. Is there alternative to this?