Open In App

Send unlimited Whatsapp messages using JavaScript

Last Updated : 22 Dec, 2023
Like Article

When it comes to web development, JavaScript can do wonders! Let me show you one more wonder of JavaScript.

Wouldn’t it be cool if we could send infinite WhatsApp messages with just one click? be the first one to wish birthdays/anniversaries/special events to your loved ones? schedule any message for any contact/group on your WhatsApp? and so much more?

Well yes, we can achieve all these things with the help of JavaScript. The most interesting part is that all you need is a phone with WhatsApp, a laptop/PC, and a Web-Browser,(Google Chrome, Edge, Mozilla, etc.) with Javascript enabled in it (which is usually enabled by default).

Steps to follow on your phone to send unlimited Whatsapp messages

Let’s get started. Open WhatsApp on the phone.

  • Click on the 3 dots in the top right corner.
  • Click on WhatsApp Web.
  • Follow the instructions to open WhatsApp web on your computer.
  • Assuming that by this time you have WhatsApp Web running on your computer, check if it looks like the image below:-

    Steps to follow on your computer to send unlimited Whatsapp messages

    • In the browser press Ctrl, Shift and I together to open a developer’s console
    • Find out the “Console” tab there and click on it.
    • Now we are almost done.
    • Double click the code below to edit it.
    • Find and assign values to the following variables: name, message, and counter.

    JavaScript code to send unlimited messages:

    The code works on the principle of simulating send via reproducing send actions, it cannot search for a contact if a conversation is not initiated, as of yet. Read the comments in the code and you will know what to do.


      function simulateMouseEvents(element, eventName){
        const mouseEvent = document.
        initEvent(eventName, true, true);
      // Schedule your message section starts here
      // const now = new Date();
      // Replace Hours, Mins and secs with your
      // desired time in 24 hour time format e.g.
      // const rt = new Date(now.getFullYear(), now.getMonth(),
      // now.getDate(), Hours, Minutes, Sec, 0) - now;
      // to send message at 2.30PM
      // const rt = new Date(
      //         now.getFullYear(),
      //         now.getMonth(),
      //         now.getDate(),
      //         '14:30:00');
      // if (rt < 0) {
      //   rt += 86400000;
      // }
      // setTimeout(startTimer, rt);
      // Schedule your message section ends here
      // Replace My Contact Name with the name
      // of your WhatsApp contact or group e.g. title="Peter Parker"
      const contactName = "Contact name you want to send message to"
              '[title="' + contactName + '"]'),
      function startTimer()
          setTimeout(myFunc, 3000);
      const eventFire = (MyElement, ElementType) => {
        const MyEvent = document.createEvent("MouseEvents");
          true, true,
          0, 0, 0, 0, 0,
          false, false,
          false, false,
          0, null);
      function myFunc()
        messageBox = document.
        // Replace My Message with your message use 
        // to add spaces to your message
        message = "My Message";
        // Replace 5 with the number of times you
        // want to send your message
        counter = 5;
        for (let i = 0; i < counter; i++) {
          const event = document.createEvent("UIEvents");
          messageBox.innerHTML =
          message.replace(/ /gm, ''); // test it
            "input", true,
            true, window, 1);
            'span[data-icon="send"]'), 'click');


    Now copy the modified code and paste it in the console windows that you opened before. You are good to go now!

    Hit Enter, Your desired numbers of messages are sent to your desired contact, just with a single click.

    Extra Fun: To schedule your message, uncomment the code of Schedule your message section and set the time as per your wish!

    NOTE: Make sure that the contact/group you are willing to send messages are visible in the browser without the need of scrolling down.

    WhatsApp may block your account for excessive use of such scripts. So use at your own risk!

    All the information provided on this site are for educational purposes only. The site and author of the article is no way responsible for any misuse of the information.

    Feel free to tweak the code as per your need and have fun! Happy Coding 🙂

    Like Article
    Suggest improvement
    Share your thoughts in the comments

    Similar Reads