Metadata-Version: 2.4
Name: reachflow
Version: 0.1.1
Summary: Official Python client for the ReachFlow public REST API (WhatsApp, OTP)
Project-URL: Homepage, https://docs.reachflow.me/developpeurs
Project-URL: Documentation, https://docs.reachflow.me/developpeurs
Project-URL: Repository, https://github.com/reachflow/reachflow-python
Project-URL: Issues, https://github.com/reachflow/reachflow-python/issues
Author-email: ReachFlow <contact@reachflow.me>
License-Expression: MIT
License-File: LICENSE
Keywords: api,otp,reachflow,sdk,whatsapp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: mypy>=1.13.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: respx>=0.21.0; extra == 'dev'
Description-Content-Type: text/markdown

# reachflow

Official **Python** client for the [ReachFlow public API](https://docs.reachflow.me/developpeurs) (REST v1).

## Installation

```bash
pip install reachflow
```

**Requirements:** Python ≥ 3.10.

## Configuration

```python
from reachflow import ReachFlow

client = ReachFlow(
    api_key="rfl_live_…",  # or rfl_test_…
    base_url="https://sandbox-api.reachflow.me",  # optional
    timeout_ms=30_000,
    max_retries=2,
)
```

Use a context manager to close the HTTP connection:

```python
with ReachFlow(api_key="rfl_live_…") as client:
    ...
```

## Examples

### Send a message

```python
with ReachFlow(api_key="rfl_live_…") as client:
    result = client.messages.send(
        provider_id="your-provider-uuid",
        to="22996123456",
        message="Your order is confirmed.",
    )
    status = client.messages.wait_for_terminal(result["messageId"])
    print(status["status"])
```

### OTP

```python
with ReachFlow(api_key="rfl_live_…") as client:
    sent = client.otp.send(
        provider_id="your-provider-uuid",
        phone_number="22996123456",
        brand_name="My App",
    )
    # Code is delivered on WhatsApp only — never in the JSON response.
    verified = client.otp.verify(otp_id=sent["otpId"], code="482910")
    print(verified["valid"])
```

### Async client

```python
from reachflow import AsyncReachFlow

async with AsyncReachFlow(api_key="rfl_live_…") as client:
    providers = await client.providers.list()
```

## Error handling

```python
from reachflow import ReachFlow, ReachFlowError

try:
    client.messages.send(...)
except ReachFlowError as err:
    print(err.status_code, err.code, err.message)
    if err.retryable:
        ...
```

## Idempotency

```python
client.messages.send(
    provider_id=provider_id,
    to=to,
    message=message,
    idempotency_key="order-12345",
)
```

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT
