Skip to main content

Client officiel Python pour l'API publique ReachFlow

Project description

reachflow

Client officiel Python pour l’API publique ReachFlow (REST v1).

Installation

pip install reachflow

Prérequis : Python ≥ 3.10.

Configuration

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 :

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

Exemples

Envoyer un message

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

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

from reachflow import AsyncReachFlow

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

Gestion des erreurs

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

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

Développement

pip install -e ".[dev]"
pytest

Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reachflow-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reachflow-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file reachflow-0.1.0.tar.gz.

File metadata

  • Download URL: reachflow-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for reachflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 748266c0ebec6d60c835188fc6689720badbbd502049a80d379d98841400f597
MD5 6855fe1bb7d6566069aab6abdcf2dc45
BLAKE2b-256 76da370e69e91d3982a7a86633b55bc785fcf4e8019d8fb633cde442d8570c73

See more details on using hashes here.

File details

Details for the file reachflow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reachflow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for reachflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fb8f375cf106eafe5abed79b9d3714d3821585d62eef322f32dc4295bf793d0
MD5 d889d0e26c8fb37d21611b8ba9e1de58
BLAKE2b-256 ee5445af24d699df0f5ae9e676203a29ef7af4ad662ecc635394d6811fdbde23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page