reachflow

Official Python client for the ReachFlow public REST API (WhatsApp, OTP)


Keywords
api, otp, reachflow, sdk, whatsapp
License
MIT
Install
pip install reachflow==0.3.1

Documentation

ReachFlow SDKs

Open-source client libraries for the ReachFlow public API (REST v1).

Language Folder Package Registry
TypeScript / Node.js reachflow-node/ @reachflow/sdk npm
Python reachflow-python/ reachflow PyPI

Integration guides: docs/guide-sdk-official-en.md (EN) · docs/guide-sdk-officiels.md (FR)


Environments

Pass environment: 'sandbox' or environment: 'live'no base URL required.

environment API host Default
sandbox sandbox-api.reachflow.me yes
live api.reachflow.me

The SDK appends /api/v1 automatically.


Quick start

Node.js

npm install @reachflow/sdk
import { ReachFlow } from '@reachflow/sdk';

const client = new ReachFlow({
  apiKey: process.env.REACHFLOW_API_KEY!,
  environment: 'sandbox', // or 'live'
});

const { messageId } = await client.messages.send({
  providerId: 'your-provider-uuid',
  to: '22996123456',
  message: 'Hello!',
});

const status = await client.messages.waitForTerminal(messageId);
console.log(status.status);

Python

pip install reachflow
from reachflow import ReachFlow

with ReachFlow(api_key="rfl_live_…", environment="live") as client:
    result = client.messages.send(
        provider_id="your-provider-uuid",
        to="22996123456",
        message="Hello!",
    )
    status = client.messages.wait_for_terminal(result["messageId"])
    print(status["status"])

Authentication

All /api/v1/* requests use the X-API-Key header (rfl_live_… or rfl_test_…).

Create keys in the ReachFlow dashboard: Settings → API → API Keys.


OpenAPI contract

Frozen spec: spec/openapi.json

Regenerate after an API update in the ReachFlow monorepo:

cd ../reachflow/apps/api
npm run build --workspace=@reachflow/api
node --input-type=module -e "
import { PUBLIC_OPENAPI_SPEC } from './dist/modules/public-api/public-openapi.document.js';
import { writeFileSync } from 'fs';
writeFileSync('../../SDK/spec/openapi.json', JSON.stringify(PUBLIC_OPENAPI_SPEC, null, 2) + '\n');
"

Smoke tests

cp scripts/.env.sandbox.example scripts/.env.sandbox
# Edit: REACHFLOW_ENV, REACHFLOW_API_KEY, REACHFLOW_TEST_TO (optional)
# Node
cd reachflow-node && npm run build && cd ..
npm run smoke
npm run smoke:send

# Python
cd reachflow-python && python3 -m venv .venv && .venv/bin/pip install -e .
.venv/bin/python ../scripts/smoke-sandbox.py --send
Variable Description
REACHFLOW_ENV sandbox or live (default: sandbox)
REACHFLOW_API_KEY Required
REACHFLOW_TEST_TO Phone number for --send / --otp
REACHFLOW_PROVIDER_ID Optional provider UUID

Legacy: REACHFLOW_API_URL is still read and mapped to sandbox / live.


Local publishing (no CI)

chmod +x scripts/publish-release.sh

./scripts/publish-release.sh --status              # local vs npm/PyPI, next version
./scripts/publish-release.sh --set-version 0.2.0   # realign local files only
./scripts/publish-release.sh --dry-run all     # verify only
./scripts/publish-release.sh all               # patch auto (ex. 0.2.0 → 0.2.1)
./scripts/publish-release.sh all --bump minor  # minor only when needed (→ 0.3.0)
./scripts/publish-release.sh node
./scripts/publish-release.sh python

The script reads npm and PyPI before bumping (base = max of local + published versions) and refuses to republish a version that already exists on a registry.

Registry Setup
npm npm login or export NPM_TOKEN=…
PyPI ~/.pypirc or TWINE_USERNAME=__token__ + TWINE_PASSWORD=pypi-…

Package metadata (GitHub links, homepage) is editable in reachflow-node/package.json and reachflow-python/pyproject.toml — changes appear on the next published version.


Development

# Node
cd reachflow-node && npm install && npm test

# Python
cd reachflow-python && python3 -m venv .venv && .venv/bin/pip install -e ".[dev]" && .venv/bin/pytest

Versioning

  • SDKs use semver, independent of the ReachFlow product.
  • 0.2.x → REST API v1 (/api/v1).
  • Breaking change in 0.2.0: baseUrl / base_url replaced by environment: 'sandbox' | 'live'.

License

MIT — see each sub-project.