Metadata-Version: 2.4
Name: wasup.py
Version: 0.3.0
Summary: A stateful WhatsApp API Wrapper for Python with built-in conversation flow management.
Project-URL: Homepage, https://hrt.sh/june/wasup.py
Project-URL: Repository, https://hrt.sh/june/wasup.py
Project-URL: Issues, https://hrt.sh/june/wasup.py/issues
Author-email: June <june@ktz.sh>
License: MIT
License-File: LICENSE
Keywords: acs,api,aws,azure,chatbot,messaging,whatsapp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.10.0
Provides-Extra: azure
Requires-Dist: azure-communication-messages==1.2.0b1; extra == 'azure'
Requires-Dist: azure-identity>=1.25.1; extra == 'azure'
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: dotenv>=0.9.9; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: setuptools>=80.9.0; extra == 'dev'
Provides-Extra: redis
Requires-Dist: redis[asyncio]>=5.0.0; extra == 'redis'
Description-Content-Type: text/markdown

# wasup-py

A stateful WhatsApp API Wrapper for Python with built-in conversation flow management. Currently supports abstraction for Azure Communication Services.

## Example

```python
import os

from wasup import Bot
from wasup.bindings.azure import AzureBindingClient
from wasup.messages import TextMessage
from wasup.messages.dialogs import Dialog, DialogTurnResult, DialogTurnStatus, DialogContext

# initialize dialog with name and main flag
@Dialog.set(name="GreetingDialog", main=True)
class GreetingDialog(Dialog):
    """A simple greeting dialog that asks for the user's name."""

    @Dialog.step()
    @Dialog.store("user_name")
    async def ask_name(self, dc: DialogContext):
        """Ask the user for their name."""
        message = TextMessage(ctx=dc.ctx, message="Hello! 👋 What's your name?")
        await dc.message.send(message)
        return DialogTurnResult(DialogTurnStatus.Waiting)

    @Dialog.step()
    async def greet_user(self, dc: DialogContext):
        """Greet the user by name."""
        name = dc.get_value("user_name")
        message = TextMessage(ctx=dc.ctx, message=f"Nice to meet you, {name}! 😊")
        await dc.message.send(message)
        return DialogTurnResult(DialogTurnStatus.Complete)

# create bot instance
bot = Bot()

# load all dialogs
bot.load_dialog(GreetingDialog)

# initialize azure client
acs_client = NotificationMessagesClient.from_connection_string(os.getenv("AZURE_COMMUNICATION_ENDPOINT"))
azure_binding = AzureBindingClient(
    ctx=bot,
    client=acs_client,
    route="/api/whatsapp/events",
)

# run the bot with azure binding
bot.run(azure_binding)
```

## Installation

### Basic Installation

```bash
pip install wasup-py
```

### With Provider Support

**Azure Communication Services:**

```bash
pip install wasup-py[azure]
```

**Development:**

```bash
pip install wasup-py[dev]
```
