Skip to main content

Wazen Python SDK

Official Python SDK for the Wazen WhatsApp API.

PyPI Python

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

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

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

Metadata

Release files for wazen 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wazen 0.4.0
File Size Uploaded
wazen-0.4.0.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wazen 0.4.0
File Interpreter ABI Platform
wazen-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.3 kB

Release files / wazen-0.4.0.tar.gz

Download URL wazen-0.4.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb4eafe46f1ad55636c7c523bd6fc2bf9921089ac0e70c1c164111deba7f8070
BLAKE2b-256 checksum
How to use checksums
3348b0852a36692c2949bbdaf25d8ac3ecf42e0b0cdb0bd00127d1b79e01bb83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / wazen-0.4.0-py3-none-any.whl

Download URL wazen-0.4.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d8efae2e40160104f9c98cc596cde40866d32c7021bb276460a308fa6224f60
BLAKE2b-256 checksum
How to use checksums
a13db304cd708cac3ac11f2ec67bf2fc2a79f014788464567a4449fca16296ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page