Search code examples
pythonwinapiautomationwhatsapppyautogui

How to automate web whatsapp to send messases with win32 api and pyautogui?


Can anyone tell me how can I automate web WhatsApp to send msgs to every person in the contect list or suggest me a better option to do so, just remember I cant buy paid APIs.


Solution

  • you can use web.whatsapp.com url:

    import webbrowser
    import time
    import pyautogui
    phone = "12345678901"
    text = "my message"
    webbrowser.open(f"https://web.whatsapp.com/send?phone={phone}&text={text}&app_absent=0")
    time.sleep(9) # wait for whatsapp web
    pyautogui.click() # move your mouse to textbox before
    pyautogui.press("enter")