-
-
Save jesusninoc/42d66c835106914df730a6117093ec38 to your computer and use it in GitHub Desktop.
Send messages to WhatsApp (web version only) programmatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMessage (message) { | |
window.InputEvent = window.Event || window.InputEvent; | |
var event = new InputEvent('input', { | |
bubbles: true | |
}); | |
var textbox = document.querySelector('div._3u328'); | |
textbox.textContent = message; | |
textbox.dispatchEvent(event); | |
document.querySelector("button._3M-N-").click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment