Skip to main content

A Playwright-based WhatsApp client to interact with x-cortex.

Project description

x-whatsapp

x-whatsapp by x-cortex is a python library for automating WhatsApp interactions. It uses playwright to automate tasks such as sending messages, fetching chat history, and listening for new messages on WhatsApp Web.

Usage

Initializing the Client

from x_whatsapp import WhatsappClient

# Initialize the client with debugging enabled
client = WhatsappClient(DEBUG=True)
# Initialize Playwright and launch the browser
await client.initialize_playwright()
# Log in to WhatsApp
await client.login()

Sending a Message

await client.send_message("contact_name", "Hello from x-whatsapp!")

Fetching Chat History

await client.open_chat_panel("contact_name")
messages = await client.extract_messages()
for message in messages:
    print(message)

Logging Out

await client.logout()

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

x_whatsapp-0.1.1.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

x_whatsapp-0.1.1-py3-none-any.whl (9.4 kB view hashes)

Uploaded Python 3

Supported by

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