Whatsapp Automation package
Project description
pywaykit
Wayland-compatible WhatsApp Web automation inspired by pywhatkit
pywaykit enables programmatic WhatsApp messaging via browser automation and system-level input simulation using Playwright and ydotool.
Designed for Linux systems — especially Wayland — where traditional GUI automation tools do not work.
Features
- Send WhatsApp messages from Python
- Schedule messages for a specific time
- Silent message delivery using browser events
- Extract chat messages from loaded WhatsApp page
- Persistent login via Firefox profile
Installation
Install with pip:
pip install pywaykit
Install Playwright's browser binaries:
playwright install firefox
ydotool Setup (Required)
ydotool is used for input simulation under Wayland.
You must perform the following setup steps:
1. Add your user to the input group:
sudo usermod -aG input $USER
2. Create a udev rule (script provided in the repo):
bash initial.sh
initial.sh
#!/bin/bash
sudo touch /etc/udev/rules.d/99-uinput.rules
echo "Created udev rule at /etc/udev/rules.d/99-uinput.rules"
sudo bash -c 'echo KERNEL=="uinput", GROUP="input", MODE="0660" > /etc/udev/rules.d/99-uinput.rules'
echo "Reloading Udev rules."
sudo udevadm control --reload-rules
sudo udevadm trigger
echo "Execution Completed."
Usage
Send a WhatsApp Message
from pywaykit import send_msg
send_msg(
phone_no="91xxxxxxxxxx",
message="Hello from pywaykit",
silent=False,
scheduled="14:45:00", # Optional (HH:MM:SS)
instant=5, # Optional delay after send
log=True
)
Extract Messages from Chat
from pywaykit import read_wmsg
stored_text, sender_msgs, receiver_msgs = read_wmsg()
Load WhatsApp Chat (No Message Sent)
from pywaykit import get_message_data
get_message_data(phone_no="91xxxxxxxxxx", message=" ") # here the message arg does almost nothing so keep it as an empty string.
Notes
- Works only on Linux with Firefox.
- First run requires QR login (saved for future runs).
- Feel free to contribute.
If you like this project, give this repo a ⭐ !
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywaykit-1.2.tar.gz.
File metadata
- Download URL: pywaykit-1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be73b6f4464fd4cb3ed705f1851021531d91c8fe0c288206a4b341a16cf7efd2
|
|
| MD5 |
ab69bd8a7843dfc7aa3c561c8990638b
|
|
| BLAKE2b-256 |
d54c6561a8b83c7bd79354c667fa87f25a970fb568112be06146aab070cffa28
|
File details
Details for the file pywaykit-1.2-py3-none-any.whl.
File metadata
- Download URL: pywaykit-1.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ec3eef48dd3b163dd7468d0621621beaf7f086559d13a47a8881218516b575
|
|
| MD5 |
40927f8ad054cb9fd48d03b6a1c4abb4
|
|
| BLAKE2b-256 |
52d29e960884371b2d0ce45d258ef9a85100893638fa8e3e25073058f6ba891d
|