Metadata-Version: 2.4
Name: waappa-sdk
Version: 0.1.0
Summary: Official Python SDK for the Waappa API.
Author: Waappa
License: MIT
Keywords: waappa,whatsapp,waha,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Waappa Python SDK

Official Python SDK for the Waappa API.

## Installation

```bash
pip install waappa-sdk
```

Requires Python 3.9 or newer.

## Quick Start

```python
from waappa import WaappaClient

waappa = WaappaClient(
    api_key="waappa_session_api_key",
    session="default",
)

waappa.send_text(
    chatId="919876543210@c.us",
    text="Hello from Waappa",
)
```

The SDK sends the API key as the `Authorization` header. By default it uses:

```text
https://api.waappa.com
```

Use `base_url` for local or private deployments:

```python
waappa = WaappaClient(
    api_key="waappa_session_api_key",
    session="default",
    base_url="http://localhost:3001",
)
```

## Messages

```python
waappa.send_image(
    chatId="919876543210@c.us",
    caption="Invoice",
    file={
        "mimetype": "image/jpeg",
        "filename": "invoice.jpg",
        "url": "https://example.com/invoice.jpg",
    },
)

waappa.send_poll(
    chatId="919876543210@c.us",
    poll={
        "name": "Choose one",
        "options": ["A", "B"],
        "multipleAnswers": False,
    },
)
```

Supported message helpers:

- `send_text`
- `send_image`
- `send_voice`
- `send_video`
- `send_file`
- `send_poll`
- `send_list`
- `send_contact_vcard`
- `send_location`
- `send_event`
- `edit_message`
- `delete_message`
- `get_messages`

## Media Upload

```python
uploaded = waappa.upload("invoice.jpg")
```

Use the returned URL in `send_image`, `send_video`, `send_voice`, or `send_file`.

## Groups, Contacts, Labels, LIDs, Channels

```python
waappa.create_group("Support", ["919876543210@c.us"])

contacts = waappa.list_contacts()
labels = waappa.list_labels()
channels = waappa.list_channels()
```

The client includes helpers for the selected Waappa API surface: groups, group participants, contacts, labels, LID/phone resolution, and channels.

## Admin / Session Management

Session management methods require a master key:

```python
admin = WaappaClient(api_key="mk_live_...")
sessions = admin.list_sessions()
```

## Errors

Failed API responses raise `WaappaError`:

```python
from waappa import WaappaError

try:
    waappa.send_text(chatId="bad", text="Hello")
except WaappaError as error:
    print(error.status)
    print(error.data)
```

## Development

```bash
python -m compileall waappa
python -m pip wheel . --no-deps -w dist
```

## Publishing

```bash
python -m build
python -m twine upload dist/*
```

Before publishing, run a smoke test against a real Waappa API key and session.
