mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.02k stars 796 forks source link

MULTIDEVICE send to UNKNOWN numbers #1118

Open mbemquerer opened 2 years ago

mbemquerer commented 2 years ago

It seems new whatsapp multidevice needs a special method to send to unknown numbers. If anybody has a solution please share.

duzaq commented 2 years ago

// use this code window.WAPI.sendMessageToID2 = function (id, message, done) { try { // Create user var idx = new window.Store.UserConstructor(id, {intentionallyUsePrivateConstructor: true}); // Get chat var chat = window.Store.Chat.find(idx); // Send message chat._value.sendMessage(message); } catch (e) { return false;

}
if (done !== undefined) done(false);
return false;

}; //window.WAPI.sendMessageToID2 ('0000000000@c.us','oi');