-
-
Save yask123/d085d4b7a486d00dd103 to your computer and use it in GitHub Desktop.
document.getElementsByClassName("input")[1].innerHTML="This message was written via JS script! "; // Fills the text box message | |
var input = document.getElementsByClassName("icon btn-icon icon-send");//Grabs the send button | |
input[0].click();// Clicks the send button |
@tinyCoder32, @leonanluppi
Sorry for the delay, whats updated how to get the information, follow the correction of the previous script.
Store.Wap I did not find in their JS anymore.
This works via browser console, to use embedded next to some other application is necessary to inject the script together in the whats script, using something to remove the permissions, remembering that your JS needs to be hosted in some domain with https
if (window.Store === undefined) {
webpackJsonp([], {"bcihgfbdeb": (x, y, z) => window.Store = z('"bcihgfbdeb"')}, "bcihgfbdeb");
webpackJsonp([], {"jfefjijii": (x, y, z) => window.Store.Conn = z('"jfefjijii"')}, "jfefjijii");
//webpackJsonp([], {"iaeeehaci": (x, y, z) => window.Store.Wap = z('"iaeeehaci"')}, "iaeeehaci");
}
The latest solution of @dennyphilipp works perfectly.
I was making an extension which emulates user actions, but this method is way easy.
I wonder if this method is stable though, especially if this changes a lot.
To send multiple just put the for loop
for(var i=0;i<10;i++){ window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {bubbles: true});
var textbox= document.querySelector('#main > footer > div._3pkkz > div._1Plpp > div > div._2S1VP.copyable-text.selectable-text');
textbox.textContent = "Test";
textbox.dispatchEvent(event);
document.querySelector("#main > footer > div._3pkkz > div > button > span").click();}
worked for me but you have open web.whatsapp for the same.
@shyamzzp Thank you~ Its worked for me
for(var i=0;i<10;i++){ window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {bubbles: true});
var textbox= document.querySelector('#main > footer > div._3pkkz > div._1Plpp > div > div._2S1VP.copyable-text.selectable-text');textbox.textContent = "Test";
textbox.dispatchEvent(event);
document.querySelector("#main > footer > div._3pkkz > div > button > span").click();
}
how to select particular group?
UPDATE:
function whatsAppText(t) { window.InputEvent = window.Event || window.InputEvent; var d = new Date(); var event = new InputEvent('input', {bubbles: true}); var textbox = $('div._2S1VP'); textbox.textContent = t; textbox.dispatchEvent(event); $("button._35EW6").click(); }
UPDATE + SPAM SEND EVERY X SECONDS + MORE LEGIBLE CODE (credits to rafaelxavierborges for the skeleton of the code)
Tested on Google Chrome = does not work
Tested on Firefox = works
var t=0; //This is the counter, where the counting starts
var messageToSendEveryXTime; //the is the variable that holds the message to send
messageToSendEveryXTime = t; //in my case I want to spam counting numbers starting at zero
//if you want to send something else change here
//for example you migh want to send "I love you every second" every second
setInterval(function(){
window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {bubbles: true});
var textbox = $('div._2S1VP');
textbox.textContent = messageToSendEveryXTime; //inserts the message in the textbox
textbox.dispatchEvent(event); $("button._35EW6").click(); //sends the message
t++; //increments the counter
}, 1000); //interval to send messages, 1000= 1 second
//choose the delay in seconds times 1000, example, 5 seconds is 5000
If you are looking for a whatsapp spammer bot, I have updated it with instructions and working 29 september 2018
https://gist.github.com/igormuba/f37b8630cadbb511c53e7765de34bc6c
/**
* 1) Open a contact or group on Whatsapp Web;
* 2) Copy the Javascript code below;
* 3) Open the developer tools: CTRL + SHIFT + I;
* 4) Go to the "Console" tab and paste the code;
* 5) The function was added on the page;
* 6) Now, still on the console, type: spam ();
* 7) A pop-up will be displayed requesting the spam message and
* how many messages you want to send per second (I recommend placing 2 to 5).
*/
function spam() {
let prompt1 = prompt("Enter the spam message", "");
const prompt2 = prompt("Send how many messages per second?", 1);
const input = document.getElementsByClassName("_3FRCZ")[1];
window.InputEvent = window.Event || window.InputEvent;
let count = 0;
if (prompt1 === "") {
prompt1 = "​";
}
console.log("Spam started ...");
window.setInterval(function() {
count++;
input.innerHTML = prompt1;
input.dispatchEvent(new InputEvent("input", {
bubbles: true
}));
let enviar = document.getElementsByClassName("_1U1xa")[0];
enviar.click();
console.log('Messasages sent: ' + count);
}, 1000 / prompt2);
}
/** * 1) Open a contact or group on Whatsapp Web; * 2) Copy the Javascript code below; * 3) Open the developer tools: CTRL + SHIFT + I; * 4) Go to the "Console" tab and paste the code; * 5) The function was added on the page; * 6) Now, still on the console, type: spam (); * 7) A pop-up will be displayed requesting the spam message and * how many messages you want to send per second (I recommend placing 2 to 5). */ function spam() { let prompt1 = prompt("Enter the spam message", ""); const prompt2 = prompt("Send how many messages per second?", 1); const input = document.getElementsByClassName("_3FRCZ")[1]; window.InputEvent = window.Event || window.InputEvent; let count = 0; if (prompt1 === "") { prompt1 = "​"; } console.log("Spam started ..."); window.setInterval(function() { count++; input.innerHTML = prompt1; input.dispatchEvent(new InputEvent("input", { bubbles: true })); let enviar = document.getElementsByClassName("_1U1xa")[0]; enviar.click(); console.log('Messasages sent: ' + count); }, 1000 / prompt2); }
It shows
Uncaught TypeError: Cannot set property 'innerHTML' of undefined
at :19:25
How to send with media ?
@felipsilva2 - Update!!!