Skip to content

Instantly share code, notes, and snippets.

@EmersonGarrido
Created September 20, 2021 14:49
Show Gist options
  • Save EmersonGarrido/c1749cd1ed27fb889ea87392669db985 to your computer and use it in GitHub Desktop.
Save EmersonGarrido/c1749cd1ed27fb889ea87392669db985 to your computer and use it in GitHub Desktop.
Send Message Whatsapp
function sendMessage() {
const button = document.querySelector("#startNonContactChat > div");
button.click();
const number = "67993109148";
const input = document.querySelector("div.alerty-content > div > input[type=text]");
input.value = input.value + number;
document.querySelector("div.alerty-action > a.btn-ok").click();
const message = "Mensagem";
var t = document.querySelector("#main > footer > div._2BU3P.tm2tP.copyable-area > div > div > div._2lMWa > div.p3_M1 > div > div._13NKt.copyable-text.selectable-text");
var y = document.createTextNode(message);
t.appendChild(y);
var mouseEvent = document.createEvent('MouseEvents');
mouseEvent.initEvent('teste', true, true);
t.dispatchEvent(mouseEvent);
}
sendMessage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment