Metadata-Version: 2.4
Name: reachflow
Version: 0.1.0
Summary: Client officiel Python pour l'API publique ReachFlow
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

Client officiel **Python** pour l’[API publique ReachFlow](https://docs.reachflow.me/developpeurs) (REST v1).

## Installation

```bash
pip install reachflow
```

**Prérequis :** Python ≥ 3.10.

## Configuration

```python
from reachflow import ReachFlow

client = ReachFlow(
    api_key="rfl_live_…",  # ou rfl_test_…
    base_url="https://sandbox-api.reachflow.me",  # optionnel
    timeout_ms=30_000,  # optionnel
    max_retries=2,  # optionnel — 429 / 5xx
)
```

Utilisez le client comme context manager pour fermer la connexion HTTP :

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

## Exemples

### Envoyer un message

```python
with ReachFlow(api_key="rfl_live_…") as client:
    result = client.messages.send(
        provider_id="uuid-du-provider",
        to="22996123456",
        message="Votre commande est confirmée.",
    )
    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="uuid-du-provider",
        phone_number="22996123456",
        brand_name="Mon App",
    )
    # Le code arrive sur WhatsApp — jamais dans la réponse JSON.
    verified = client.otp.verify(otp_id=sent["otpId"], code="482910")
    print(verified["valid"])
```

### Client asynchrone

```python
from reachflow import AsyncReachFlow

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

## Gestion des erreurs

```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:
        ...
```

## Idempotence

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

## Développement

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

## Licence

MIT
