WebWhatsapp-Wrapper icon indicating copy to clipboard operation
WebWhatsapp-Wrapper copied to clipboard

Send message to new numbers on WhatsApp Beta

Open vilsonei opened this issue 3 years ago • 4 comments

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?

vilsonei avatar Nov 06 '21 20:11 vilsonei

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');

vilsonei avatar Nov 06 '21 22:11 vilsonei

use FindChat

{ id: 'FindChat', conditions: (module) => (module && module.findChat) ? module : null },

fabiomello avatar Nov 08 '21 14:11 fabiomello

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?

dekkardnexus5 avatar Nov 09 '21 16:11 dekkardnexus5

// 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');

duzaq avatar Jan 30 '22 16:01 duzaq