Skip to main content

Official Python SDK for OpenWA WhatsApp API Gateway

Project description

OpenWA Python SDK

The official Python client library for the OpenWA REST API Gateway.

This SDK allows you to easily manage WhatsApp sessions, send text/media messages, and interact with WhatsApp groups natively in Python. It supports both Synchronous and Asynchronous workflows out of the box!

Installation

pip install openwa-sdk

Quick Start

from openwa import OpenWAClient
import asyncio

# Initialize the client (points to your self-hosted OpenWA Gateway)
client = OpenWAClient(
    base_url="http://localhost:2785", 
    api_key="secret-key"
)

# --- Synchronous Example ---
# 1. Create a session
session = client.sessions.create("my-session")
print(f"Session Created: {session}")

# 2. Start the session (returns QR code in the terminal)
client.sessions.start("my-session")

# 3. Send a message
client.messages.send_text("my-session", {
    "chatId": "1234567890@c.us",
    "text": "Hello from Python!"
})

# --- Asynchronous Example ---
async def main():
    async_client = client.get_async_client()
    
    # Send a message asynchronously
    await async_client.messages.send_text("my-session", {
        "chatId": "1234567890@c.us",
        "text": "Hello async world!"
    })

asyncio.run(main())

Features

  • Fully Typed: Written with type hints for excellent IDE autocomplete.
  • Sync & Async: Backed by httpx, giving you both blocking and non-blocking clients.
  • Zero Overhead: Directly maps to the OpenWA OpenAPI specification.

License

MIT License

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

openwa_sdk-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

openwa_sdk-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file openwa_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: openwa_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for openwa_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3240a6c431fd2ecea62bd3b9207e50f88e5a3defef903be0dde9fa4dd3ff334c
MD5 5097f359eda0999dac17ea17fa8ad47a
BLAKE2b-256 066caf0c22777f0ac0645961904cd96ee2d7104f0f9d70e52f1306b0f1ebc7ac

See more details on using hashes here.

File details

Details for the file openwa_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: openwa_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for openwa_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bf80d2947509fab4947391a3d11bc34c8713590ac1244178423430f5e9f56a7
MD5 b7dea2ad6f85680de696acc3a3b46cb7
BLAKE2b-256 434ac7ca796ec4e50d0095c87a3f5e765e59f333799ee08be5164d7e62babcb2

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