WebWhatsapp-Wrapper
WebWhatsapp-Wrapper copied to clipboard
Send message to new numbers on WhatsApp Beta
In the new version of WhatsApp Beta when I try to send a message to a new number that is not in the phonebook the method window.Store.Chat.get('[email protected]') always returns undefined.
Has anyone managed to solve it?
Solution:
// Create user
var idx = new window.Store.UserConstructor('[email protected]', {intentionallyUsePrivateConstructor: true});
// Get chat
var chat = window.Store.Chat.find(idx);
// Send message
chat._value.sendMessage('Text');
use FindChat
{ id: 'FindChat', conditions: (module) => (module && module.findChat) ? module : null },
Solution:
// Create user var idx = new window.Store.UserConstructor('[email protected]', {intentionallyUsePrivateConstructor: true}); // Get chat var chat = window.Store.Chat.find(idx); // Send message chat._value.sendMessage('Text');
HI Vilsonei,
Where should I insert those lines into the code?
// 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 ('[email protected]','oi');