Created
March 11, 2019 18:36
-
-
Save techguybiswa/267587c6ce727710fda3720739ae8bfe to your computer and use it in GitHub Desktop.
What's App Automated "New Year Wish" Script
This file contains 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
let listOfRecentContacts = document.getElementsByClassName("_3j7s9"); | |
console.log("listOfRecentContacts.length = " + listOfRecentContacts.length); | |
var eventToSwitchMessageBox = new MouseEvent('mousedown', { | |
bubbles: true, | |
}); | |
let count =1; | |
let openMessageBox = setInterval(function(){ | |
// if(count>listOfRecentContacts.length) { | |
if(count>5) { | |
console.log("Clearing interval with clearInterval..."); | |
clearInterval(openMessageBox); | |
} | |
listOfRecentContacts[count].dispatchEvent(eventToSwitchMessageBox); | |
console.log("Opening message box of " + listOfRecentContacts[count].getElementsByClassName("_1wjpf")[0].title + " -> " + count); | |
// let textToSend = "Hello " + listOfRecentContacts[count-1].getElementsByClassName("_1wjpf")[0].title + ". I hope you are doing great. This is an autogenerated message from Bisso. Please Ignore. Do not reply."; | |
let textToSend = "Hello. Wish you a very happy new year from Bisso. PS: Ignore this message I am testing out a program."; | |
let textbox = document.querySelector('div._2S1VP'); | |
let sendMessageEvent = new InputEvent('input', { | |
bubbles: true | |
}); | |
textbox.textContent =textToSend; | |
textbox.dispatchEvent(sendMessageEvent); | |
document.querySelector("button._35EW6").click(); | |
count++; | |
}, 3000); |
Hey Bisso, I've tried the code but the message was sent only to 21 people while my contact list has about 600 people. What do you think the issue here could be?
Yeah so the script uses DOM manipulation.
That means for now it cannot message all 600 people but can message only the most recently contacted ones.
You can modify the script to add a scroll function that would keep on adding more and more contacts one by one to the DOM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Bisso, I've tried the code but the message was sent only to 21 people while my contact list has about 600 people. What do you think the issue here could be?