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

SendMessage on New id always give "Phone number shared via url is invalid" #1123

Closed Parveen-Mothsara closed 1 year ago

Parveen-Mothsara commented 2 years ago

Dear all,

i am getting this response "Phone number shared via url is invalid" when i try below code.Its start given this response from 2 days before it works properly ,please suggest .... any alternate please suggest.. function createMessageLink(number, text) { return new Promise((resolve, reject) => { const encodedText = text; const link = document.createElement("a"); link.setAttribute("href", whatsapp://send?phone=${number}&text=${encodedText}); document.body.append(link); console.log('new linq applied'); setTimeout(() => { link.click(); document.body.removeChild(link); resolve() }, 1000) }) }

Thanks

duzaq commented 2 years ago

Looks like they put a limit on opening new conversations by link. 2 numbers of mine have already stopped, it only works with number already open before

sergey-chechaev commented 2 years ago

any solution?

dekkardnexus5 commented 2 years ago

Is this error fired using Whatsapp Multi device Beta?

duzaq commented 2 years ago

for now is to use the API solution > wapi.js > WAPI.sendMessageToID()

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

Parveen-Mothsara commented 2 years ago

@duzaq please share latest wapi.js