Skip to main content

WPP_Whatsapp aim of exporting functions from WhatsApp Web to the python

Project description

WPP_Whatsapp

PyPI Version View GitHub Actions Python Version

WPP_Whatsapp is a powerful Python library built on top of WPPConnect, bringing WhatsApp Web automation to Python developers.

๐Ÿ“š 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.on_message(on_message)

# 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:

Start here: Complete Documentation Index


๐Ÿ’ก 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.on_message(on_message)
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


๐ŸŽฏ 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

Community


๐Ÿ“ฆ 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

See Contributing Guide for details.


๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ™ Acknowledgments


Made with โค๏ธ by Ammar Alkotb

Happy Coding! ๐ŸŽ‰

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

wpp_whatsapp-1.0.1.tar.gz (111.5 kB view details)

Uploaded Source

Built Distribution

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

wpp_whatsapp-1.0.1-py3-none-any.whl (114.2 kB view details)

Uploaded Python 3

File details

Details for the file wpp_whatsapp-1.0.1.tar.gz.

File metadata

  • Download URL: wpp_whatsapp-1.0.1.tar.gz
  • Upload date:
  • Size: 111.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for wpp_whatsapp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d608257df8794781893d86f133b35d40c72989a2f5f8578874fdcd6d871db7bb
MD5 adb6431149023104298a52916550d158
BLAKE2b-256 851c1b028c27eb6448648d34b7434caa68badb400b8e7a6040b60d4edafce539

See more details on using hashes here.

File details

Details for the file wpp_whatsapp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: wpp_whatsapp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 114.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for wpp_whatsapp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24663b23628800c77a7e406f5a32529f006c70f1f8f3c45bc3fc16208f21625c
MD5 420d534d5e20acfc0347167576a55901
BLAKE2b-256 74464a4eab4854ea14cbb3b1507d6e393ae2013a75cd96be518326c727e591b5

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