Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(sdk): add Python and PHP package READMEs (registry descriptions)

Yudhi Armyndharis847c72d268c1
diff --git a/sdk/php/README.md b/sdk/php/README.md
new file mode 100644
index 000000000..72b08ce6a
--- /dev/null
+++ b/sdk/php/README.md
@@ -0,0 +1,80 @@
+# rmyndharis/openwa
+
+Official PHP SDK for the [OpenWA](https://github.com/rmyndharis/OpenWA) WhatsApp API Gateway.
+
+A synchronous client built on [Guzzle](https://docs.guzzlephp.org/), PSR-4 autoloaded.
+
+## Install
+
+> **Not yet published to Packagist.** Until the first release, install from a
+> checkout of the repo (`cd sdk/php && composer install`) or point Composer at
+> the repository directly.
+
+```bash
+composer require rmyndharis/openwa # once published
+```
+
+Requires PHP 8.1+ and Guzzle 7. The namespace is `OpenWA\`.
+
+## Usage
+
+```php
+<?php
+require 'vendor/autoload.php';
+
+use OpenWA\Client;
+
+$client = new Client([
+ 'baseUrl' => 'https://your-gateway.example.com',
+ 'apiKey' => 'owa_k1_…',
+]);
+
+$client->sessions->start('my-session');
+
+$result = $client->messages->sendText('my-session', [
+ 'chatId' => '[email protected]',
+ 'text' => 'Hello from the OpenWA PHP SDK!',
+]);
+echo $result['messageId'];
+```
+
+For tests, inject a Guzzle client whose handler is a `MockHandler` — no network, no global state:
+
+```php
+$client = new Client([
+ 'baseUrl' => 'http://x',
+ 'apiKey' => 'k',
+ 'httpClient' => $mockGuzzleClient,
+]);
+```
+
+## Errors
+
+A non-2xx response throws a typed `OpenWA\Exceptions\OpenWAApiException` subclass —
+`OpenWAAuthException` (401), `OpenWAForbiddenException` (403), `OpenWANotFoundException` (404),
+`OpenWAConflictException` (409), `OpenWARateLimitException` (429),
+`OpenWANotImplementedException` (501) — each exposing `getStatus()` and the parsed `getBody()`.
+A timeout throws `OpenWATimeoutException`.
+
+```php
+use OpenWA\Exceptions\OpenWANotFoundException;
+
+try {
+ $client->sessions->get('missing');
+} catch (OpenWANotFoundException $e) {
+ echo $e->getStatus(); // 404
+}
+```
+
+## Notes
+
+- **Use HTTPS in production** — the API key is sent as `X-API-Key` and is bearer-equivalent.
+- The SDK does **not** retry, and **never follows redirects** (so the key is never re-sent to
+ a redirect target). Path segments are percent-encoded; a base-URL path prefix (e.g. behind a
+ reverse proxy) is preserved.
+- Escape hatch for endpoints the SDK does not wrap:
+ `$client->request($method, $path, $query, $body)`.
+
+## License
+
+MIT
diff --git a/sdk/python/README.md b/sdk/python/README.md
new file mode 100644
index 000000000..6eb6c6eac
--- /dev/null
+++ b/sdk/python/README.md
@@ -0,0 +1,78 @@
+# rmyndharis-openwa
+
+Official Python SDK for the [OpenWA](https://github.com/rmyndharis/OpenWA) WhatsApp API Gateway.
+
+A synchronous client built on [httpx](https://www.python-httpx.org/), with bundled type hints (PEP 561).
+
+## Install
+
+> **Not yet published to PyPI.** Until the first release, install from a checkout
+> of the repo (`cd sdk/python && pip install -e .`) or from git.
+
+```bash
+pip install rmyndharis-openwa # once published
+```
+
+Requires Python 3.9+. The importable module is `openwa`.
+
+## Usage
+
+```python
+from openwa import OpenWAClient
+
+client = OpenWAClient(
+ base_url="https://your-gateway.example.com",
+ api_key="owa_k1_…",
+)
+
+client.sessions.start("my-session")
+
+result = client.messages.send_text("my-session", {
+ "chatId": "[email protected]",
+ "text": "Hello from the OpenWA Python SDK!",
+})
+print(result["messageId"])
+```
+
+The client is also a context manager (it closes the underlying connection pool on exit):
+
+```python
+with OpenWAClient(base_url="…", api_key="…") as client:
+ client.messages.send_text("my-session", {"chatId": "…@c.us", "text": "hi"})
+```
+
+For tests, pass an httpx transport — no global monkey-patching required:
+
+```python
+import httpx
+client = OpenWAClient(base_url="…", api_key="…", transport=httpx.MockTransport(handler))
+```
+
+## Errors
+
+A non-2xx response raises a typed `OpenWAApiError` subclass — `OpenWAAuthError` (401),
+`OpenWAForbiddenError` (403), `OpenWANotFoundError` (404), `OpenWAConflictError` (409),
+`OpenWARateLimitError` (429), `OpenWANotImplementedError` (501) — each carrying `.status`
+and the parsed `.body`. A timeout raises `OpenWATimeoutError`.
+
+```python
+from openwa import OpenWANotFoundError
+
+try:
+ client.sessions.get("missing")
+except OpenWANotFoundError as e:
+ print(e.status) # 404
+```
+
+## Notes
+
+- **Use HTTPS in production** — the API key is sent as `X-API-Key` and is bearer-equivalent.
+- The SDK does **not** retry, and **never follows redirects** (so the key is never re-sent to
+ a redirect target). Path segments are percent-encoded; a base-URL path prefix (e.g. behind a
+ reverse proxy) is preserved.
+- Escape hatch for endpoints the SDK does not wrap:
+ `client.request(method, path, query=…, body=…)`.
+
+## License
+
+MIT