WhatsApp SDK Python Documentation

Python Versions License Tests

A comprehensive synchronous Python SDK for WhatsApp Business Cloud API, following Meta’s official documentation.

Features

  • βœ… 100% Synchronous - Simple, straightforward API without async complexity

  • πŸ“˜ Fully Type-Hinted - Complete type safety with Pydantic models

  • πŸ”„ Auto-Retry Logic - Built-in retry mechanism for robust API calls

  • πŸ” Webhook Verification - Secure webhook signature validation

  • πŸ“¦ Media Management - Upload, download, and manage media files

  • πŸ’¬ Template Messages - Full template message support

  • πŸ”” Interactive Messages - Buttons, lists, and quick replies

  • πŸ“ Location Messages - Send and receive location data

  • πŸ‘₯ Contact Messages - Share contact cards

  • ✨ Modern Python - Supports Python 3.8+

Quick Example

from whatsapp_sdk import WhatsAppClient

# Initialize client
client = WhatsAppClient(
    phone_number_id="YOUR_PHONE_NUMBER_ID",
    access_token="YOUR_ACCESS_TOKEN"
)

# Send a text message
response = client.messages.send_text(
    to="+1234567890",
    body="Hello from WhatsApp SDK!"
)
print(f"Message sent! ID: {response.messages[0].id}")

Why This SDK?

This SDK provides a clean, intuitive interface for the WhatsApp Business API with:

  • No Async Complexity: Simple synchronous calls, no await/async to manage

  • Type Safety: Full Pydantic model support for all requests and responses

  • Developer Friendly: Clear error messages and comprehensive documentation

  • Production Ready: Built-in retry logic, rate limiting, and error handling

  • Well Tested: Comprehensive test suite with high coverage

Support

License

MIT License - see the LICENSE file for details.

Indices and tables