Skip to main content

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, a_msgs, b_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywaykit-1.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywaykit-1.2.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pywaykit-1.2.1.tar.gz.

File metadata

  • Download URL: pywaykit-1.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pywaykit-1.2.1.tar.gz
Algorithm Hash digest
SHA256 3f65ad4dd2688d482e8a6176caa1d23402eeeecbc06e8ad577afb65f17adebca
MD5 5ae8b30f2b4e23515c151447090482b1
BLAKE2b-256 17a3c20d4fd3ae89a686c69891e877e7ee3e346b5cbed93df2a396db02d54fcd

See more details on using hashes here.

File details

Details for the file pywaykit-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: pywaykit-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pywaykit-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4a8cbc1d577d669e19cda55d8d7bc0f0c4972093c44a38b2edf70cdb3be49e2
MD5 b15453c82defb7001a28e6f28b6b9f02
BLAKE2b-256 95909b6501561b911a68e3deaa0576106f74211cb577b33590f98120a92b55ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page