Official Python SDK for the Wazen WhatsApp API
Project description
Wazen Python SDK
Official Python SDK for the Wazen WhatsApp API.
Installation
pip install wazen
Quick Start
from wazen import Wazen
wazen = Wazen("wz_your_api_key")
# Send a message
message = wazen.messages.send("session-id", to="+1234567890", type="text", content="Hello from Wazen!")
# List sessions
sessions = wazen.sessions.list()
# Check if a number is on WhatsApp
result = wazen.contacts.check("session-id", phone="+1234567890")
Async Usage
from wazen import AsyncWazen
wazen = AsyncWazen("wz_your_api_key")
message = await wazen.messages.send("session-id", to="+1234567890", type="text", content="Hello!")
Resources
All resources are accessible as properties on the client instance.
Sessions
wazen.sessions.create()
wazen.sessions.list()
wazen.sessions.get("session-id")
wazen.sessions.delete("session-id")
wazen.sessions.restart("session-id")
wazen.sessions.get_qr("session-id")
wazen.sessions.factory_reset("session-id")
Messages
# Send text
wazen.messages.send("session-id", to="+1234567890", type="text", content="Hello!")
# Send image
wazen.messages.send("session-id", to="+1234567890", type="image", media_url="https://example.com/photo.jpg")
# Get message history
wazen.messages.list("session-id", direction="outgoing", limit=10)
# Get single message
wazen.messages.get("session-id", "message-id")
Groups (Pro+)
wazen.groups.list("session-id")
wazen.groups.create("session-id", subject="Team Chat", participants=["+1234567890"])
wazen.groups.get("session-id", "group-id")
wazen.groups.update("session-id", "group-id", subject="New Name")
wazen.groups.leave("session-id", "group-id")
wazen.groups.manage_participants("session-id", "group-id", action="add", participants=["+0987654321"])
wazen.groups.send_message("session-id", "group-id", type="text", content="Hello group!")
Channels (Pro+)
wazen.channels.create("session-id", name="Product Updates", description="Latest news")
wazen.channels.send_message("session-id", "channel-id", type="text", content="New release!")
Contacts
# Check single number
wazen.contacts.check("session-id", phone="+1234567890")
# Bulk check (Pro+)
wazen.contacts.bulk_check("session-id", phones=["+1234567890", "+0987654321"])
Warming
wazen.warming.start("session-id", contacts=[
{"phone": "+1234567890", "name": "Alice"},
{"phone": "+0987654321"},
])
wazen.warming.get_status("session-id")
wazen.warming.pause("session-id")
wazen.warming.resume("session-id")
wazen.warming.cancel("session-id")
Webhooks
wazen.webhooks.create(
url="https://your-app.com/webhooks/wazen",
events=["message.received", "message.delivered"],
)
wazen.webhooks.list()
wazen.webhooks.update("webhook-id", enabled=False)
wazen.webhooks.delete("webhook-id")
wazen.webhooks.test("webhook-id")
wazen.webhooks.get_logs("webhook-id")
Account
account = wazen.account.get()
usage = wazen.account.get_usage()
API Keys
key = wazen.api_keys.create(name="new-key")
wazen.api_keys.list()
wazen.api_keys.revoke("key-id")
Configuration
wazen = Wazen(
"wz_your_api_key",
base_url="https://wazen.dev/api/v1", # default
timeout=30, # default, in seconds
)
Error Handling
from wazen import Wazen, WazenApiError
try:
wazen.messages.send("session-id", to="+1234567890", type="text", content="Hi")
except WazenApiError as e:
print(e.status_code) # HTTP status code
print(e.error_code) # API error code
print(e.message) # Error message
Requirements
- Python 3.10 or later
- A Wazen account with an active subscription
- An API key from your Dashboard
Links
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wazen-0.1.0.tar.gz
(8.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
wazen-0.1.0-py3-none-any.whl
(15.0 kB
view details)
File details
Details for the file wazen-0.1.0.tar.gz.
File metadata
- Download URL: wazen-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a62f041617a66311ab704c8277764df12f1c6d16d2e9d33b92ad2820cc0b792
|
|
| MD5 |
cd369381b08de6e854b2aa6d272e3eaa
|
|
| BLAKE2b-256 |
75621ee85ec3d2075b6ad271720294ec8013c50000937cc9e0336b30f5adaea5
|
File details
Details for the file wazen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wazen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56fde69b174b5f68c6e3f3232ed1cc8e6979b314c9af057bfbf3652109c14619
|
|
| MD5 |
ace03530ec2b39c8f650dcca9640b115
|
|
| BLAKE2b-256 |
8d704cbd4fc9f731d823188f982342be4a6c7a25a6e3f78e21a9869a140b100d
|