PyWhatKit
raw JSON → 5.4 verified Fri May 01 auth: no python
PyWhatKit is a Python library for automating WhatsApp Web, including sending messages, images, and performing searches. It relies on a web browser to open WhatsApp Web and simulate user actions. Current version is 5.4, with maintenance-focused releases.
pip install pywhatkit Common errors
error No module named 'pywhatkit' ↓
cause Library not installed in current Python environment.
fix
Run: pip install pywhatkit
error AttributeError: module 'pywhatkit' has no attribute 'sendwhatmsg' ↓
cause Incorrect import or outdated library version.
fix
Update library and ensure import is correct: import pywhatkit; pywhatkit.sendwhatmsg(...)
Warnings
gotcha Phone number must include country code without '+' (e.g., '1234567890' instead of '+1234567890'). Many users incorrectly include '+'. ↓
fix Use numbers only, e.g., '911234567890' for India.
gotcha The library opens a real browser window (Chrome) and simulates keystrokes. It will not work in headless environments or on servers without a display. ↓
fix Ensure a graphical desktop environment is available. For headless, consider using a different library like twilio or selenium directly.
breaking Version 5.0 changed the image sending API. Older code using sendwhats_image may fail if not updated. ↓
fix Use the new parameters: pwk.sendwhats_image(phone_no, img_path, caption='')
Install
pip install pywhatkit --upgrade Imports
- pywhatkit wrong
from pywhatkit import sendwhatmsgcorrectimport pywhatkit
Quickstart
import pywhatkit as pwk
# Send a WhatsApp message to a contact (include country code)
pwk.sendwhatmsg("+1234567890", "Hello from PyWhatKit!", 15, 30) # hour, minute (24-hour)
print("Message scheduled.")