Skip to content

x-cortex/x-whatsapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages