WPP_Whatsapp aim of exporting functions from WhatsApp Web to the python, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
WPP_Whatsapp
WPPWhatsapp is a powerful Python library built on top of WPPConnect, bringing WhatsApp Web automation to Python developers.
๐ก Looking for something else? Check out neonize - A powerful Python library built on top of Whatsmeow, enabling seamless WhatsApp automation with enterprise-grade performance.
๐ Looking for documentation? Check out our Complete Documentation
โจ Features
| Feature | Status | |---------|--------| | Automatic QR Refresh | โ | | Send text, image, video, audio, documents | โ | | Get contacts, chats, groups, group members | โ | | Send contacts, stickers, locations | โ | | Multiple Sessions Support | โ | | Forward Messages | โ | | Receive Messages with Callbacks | โ | | Group Management | โ | | Business Features | โ | | Rate Limiting | โ |
๐ Quick Start
Installation
Using pip:
pip install wpp-whatsapp
Using uv (Recommended):
uv add wpp-whatsapp
Your First Bot (2 minutes)
from WPP_Whatsapp import Create
Create and start client
creator = Create(session="mybot")
client = creator.start()
Define message handler
def on_message(msg): if msg.get('body') and not msg.get('isGroupMsg'): # Auto-reply client.sendText(msg.get('from'), "Thanks for your message! ๐ค")
Register handler
client.onmessage(onmessage)
Start bot
print("Bot started! Scan QR code...")
client.start()
That's it! Your WhatsApp bot is now running! ๐
๐ Documentation
We've created comprehensive documentation to help you:
- ๐ Quick Start Guide - Get started in 5 minutes
- ๐ API Reference - Complete method documentation
- ๐ง Troubleshooting - Common issues and solutions
- ๐ก Examples - Code examples for every use case
- โก Advanced Examples - Advanced patterns and features
๐ก Examples
Send Messages
from WPP_Whatsapp import Create
creator = Create(session="test") client = creator.start()
Send text
client.sendText("1234567890@c.us", "Hello!")
Send image
client.sendImage("1234567890@c.us", "image.jpg", "Beautiful sunset!")
Send file
client.sendFile("1234567890@c.us", "document.pdf", "Here's the document")
Send location
client.sendLocation("1234567890@c.us", 40.7128, -74.0060, title="New York")
Receive Messages
from WPP_Whatsapp import Create
creator = Create(session="test") client = creator.start()
def on_message(message): # Ignore group messages if message.get('isGroupMsg'): return # Process message chat_id = message.get('from') text = message.get('body') if 'hello' in text.lower(): client.sendText(chat_id, "Hi there! ๐")
client.onmessage(onmessage) client.start()
Group Management
from WPP_Whatsapp import Create
creator = Create(session="test") client = creator.start()
Create group
group = client.createGroup("My Group", ["123@c.us", "456@c.us"])
Add participant
client.addParticipant(group['gid'], "789@c.us")
Send message to group
client.sendText(group['gid'], "Hello everyone!")
More Examples
- ๐ Basic Examples - Core functionality
- โก Advanced Examples - Complex patterns
- ๐๏ธ Archive - Additional examples
๐ฏ Use Cases
WPP_Whatsapp can be used for:
- ๐ค Chatbots - Customer service automation
- ๐ข Broadcasting - Safe bulk messaging with rate limiting
- ๐ฅ Group Management - Automated group administration
- ๐ Analytics - Message tracking and statistics
- ๐ Integration - Connect WhatsApp with other services
- ๐ฑ Auto-replies - Intelligent response systems
โ ๏ธ Important Notes
Rate Limiting
Always use rate limiting for bulk operations to avoid bans:import time
contacts = ["123@c.us", "456@c.us"] for contact in contacts: client.sendText(contact, "Hello") time.sleep(2) # 2 second delay
Best Practices
- โ Handle errors gracefully
- โ Use unique session names
- โ Implement reconnection logic
- โ Test with small groups first
- โ Respect WhatsApp's terms of service
๐ Need Help?
Documentation
- ๐ Complete Documentation
- ๐ Quick Start Guide
- ๐ง Troubleshooting
Community
- ๐ฌ GitHub Discussions
- ๐ Report Issues
- ๐ก Feature Requests
๐ฆ Project Structure
WPP_Whatsapp/
โโโ WPP_Whatsapp/ # Main package
โโโ docs/ # Documentation
โโโ examples/ # Basic examples
โโโ scripts/ # Advanced examples
โโโ archive/ # Additional examples
โโโ tests/ # Test suite
โโโ README.md # This file
โโโ pyproject.toml # Project configuration
โโโ CHANGELOG.md # Version history
๐ค Contributing
We welcome contributions! Here's how you can help:
- ๐ Improve documentation
- ๐ Report bugs
- ๐ก Suggest features
- ๐ง Submit pull requests
- ๐ Add examples
๐ License
This project is licensed under the MIT License.
๐ Acknowledgments
- Built on top of WPPConnect
- Powered by Playwright
Made with โค๏ธ by Ammar Alkotb
Happy Coding! ๐