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
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
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
File details
Details for the file openwa_sdk-1.1.0.tar.gz.
File metadata
- Download URL: openwa_sdk-1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc7dfe1ef9f044b62614f1f09f1447396b6e8bccddcae90606da659ba30a937d
|
|
| MD5 |
43aaa668da8f1a9cbcf2459745f3e3ec
|
|
| BLAKE2b-256 |
11b9ffb1228cd13754e9b5e2eb707687731973c25ed74a20684699d6b62951ed
|
File details
Details for the file openwa_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: openwa_sdk-1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831c046b071982d4e548c84a458e07a649246df80a6391e8c69cdcdf7fe1e9ae
|
|
| MD5 |
4547e02bf5e2c3dd1b0c1ce37ce8290e
|
|
| BLAKE2b-256 |
8234582c0b538d70cfb9ba6de45fc5591d65c27be7ccdae09f5542283796f0a0
|