Power of DOM Manipulation Create a Simple Spam Script for WhatsApp Web

With the growing use of JavaScript framweworks, DOM Manipulation is looked down now a days. But Today, we are gonna do something fun (For us) and Annoying (for the victim) with the DOM Manipulation power of JavaScript. We are going to create a basic Spam Script for WhatsApp Web with some ideas of improvement as a challenge for you guys to try next.
Before we actually dive into code, Let’s walk through the process.
Overview
We are going to insert some JS code in console and send our message as many times as we want using the CODE. Let’s figure out how WhatsApp sends the message.
- You see the ``message box``, you type in message and click on send button.

2. Notice there is no send button until you type in some text. That means send button is generated/becomes visible in response to input event.

3. When you type something, the send button appears. Now is the perfect use case for JS click().
CODE
First thing, we have to select the Message Box and add some text to it. Since there is no ID assigned to it, we will try to access it via Class name.
- Accessing it via Class Name gives us following element. We can access it using index 1 of resulting array.

2. Let’s add some text via innerHTML property.

3. The Send button is not visible yet. As we discussed above, it appears as result of input event on Message Box. Let’s create and dispatch an input event.

4. It’s time to fake a click event on send button. But first, let’ see our Send button in DOM. Note the attached Click event to it.

5. Lastly, Let’s click on button from our code. Notice the message is sent after we emulated a click.

Congrats, You just learned how to programmatically send a Message on WhatsApp Web utilizing the Looked down DOM Manipulation power of JavaScript. You didn’t just learn the code but the process of digging through DOM which will also help you in future.
We Said SPAM Script but one message in not a SPAM. Wrap you code inside a loop and turn it into Spam Script
Finally Here is the GitHub Repository which contains the code.
What Next
This is just a basic script. Using the same approach as shown in Article, You can Add
- Mention feature to the Script.
- Make a form and get the form values to spam. Make the Script easy to use by just pasting in console and filling the form.