Making a WhatsApp spammer with python under 10 lines of code.


Do you ever think of spamming your friends on WhatsApp by sending messages frequently to any group or a particular person?. If you do, then here, let us create a simple WhatsApp spammer with python under 10 lines of code.


For this task, we require a simple module named pyautogui which is a GUI automation python module to control keyboard and mouse events. You can directly install by running 'pip install pyautogui' on the command shell.

spam.py

import pyautogui as pt
import time

limit = input("Enter limit:")
message = input("Enter message:")
i = 0
time.sleep(5)

while i < int(limit):
    pt.typewrite(message)
    # the message is written where -
    # the cursor belongs      

    pt.press("enter")

    i+=1

WhatsApp automation


Now, you can set the limit of messages you want to send as well as the message in the Command Prompt itself. If you run this code it will give you five seconds to open WhatsApp( You can specify your time ) and point the cursor towards the message input box corresponding to the person or group you want to send messages to. The pt.typewrite( ) is a function that helps to write the messages automatically and pt.press( ) function helps to send the message by pressing enter. We are writing this inside a while loop so that it will run until it reaches the limit.


Basically, this program writes characters to which the cursor belongs. So in this case it will write the message in the message input box and press enter and we have done.