00:00
00:00
Newgrounds Background Image Theme

Our goal is for Newgrounds to be ad free for everyone! Become a Supporter today and help make this dream a reality!

Sending Automatic Whatsapp messages via web

785 Views | 1 Reply
New Topic Respond to this Topic

I'm using web.whatsapp.com


I've made it so that I can populate the message with the following:


document.querySelector("._2UL8j > div:nth-child(2)").innerHTML = "hello";

I can also click the send button using this


document.querySelector('._1JNuk').click();

However, whenever the text is added in via JS, the send button doesn't appear. The only time it displays the send button is when input is added manually from the keyboard.


There must be a way to emulate this via JS.


If anyone has WhatsApp, please log into the web version and see if you can find a way to prompt the send button to appear one populating the textfield with the above code.

Response to Sending Automatic Whatsapp messages via web 2020-10-29 12:28:18


To do this, you have to create a new InputEvent, with bubbling enabled, and them dispatch it.

function send_message(message) {
    e = new InputEvent('input', {bubbles: true});
    message_element = document.getElementsByClassName('_3FRCZ')[1];
    message_element.innerHTML = message;
    message_element.dispatchEvent(e);
    document.querySelector('._1U1xa').click();
}