Skip to content

Commit b298364

Browse files
committed
Enhance README.md with Client SDKs section for Python and Node.js; add SDK Usage Guide link. Update GitHub Actions workflows for Node.js and Python SDKs to support manual triggering via workflow_dispatch.
1 parent f9c806b commit b298364

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

.github/workflows/sdk-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
publish:
2727
needs: build-test
28-
if: github.event_name == 'release' && github.event.action == 'published'
28+
if: (github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch'
2929
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v4

.github/workflows/sdk-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
publish:
3131
needs: build-test
32-
if: github.event_name == 'release' && github.event.action == 'published'
32+
if: (github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch'
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Simple fax-sending API with AI integration. Choose your backend:
2525

2626
- Quick start: use the scripts in `api/scripts` (`start-mcp.sh`, `start-mcp-http.sh`) or `make mcp-stdio` / `make mcp-http`.
2727

28+
## Client SDKs
29+
- Python: `pip install faxbot`
30+
- Node.js: `npm install faxbot`
31+
32+
[→ SDK Usage Guide](docs/SDKS.md)
33+
2834
## Documentation
2935
- [API Reference](docs/API_REFERENCE.md) — Endpoints and examples
3036
- [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues

docs/SDKS.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Client SDKs
2+
3+
Thin, official clients for the Faxbot API. They call the unified Faxbot REST API (no direct Phaxio/Asterisk calls).
4+
5+
- Python: `faxbot`
6+
- Node.js: `faxbot`
7+
8+
## Python
9+
- Install:
10+
```
11+
pip install faxbot
12+
```
13+
- Usage:
14+
```python
15+
from faxbot import FaxbotClient
16+
17+
client = FaxbotClient(base_url="http://localhost:8080", api_key="YOUR_API_KEY")
18+
job = client.send_fax("+15551234567", "/path/to/document.pdf")
19+
print("Queued:", job["id"], job["status"])
20+
status = client.get_status(job["id"])
21+
print("Status:", status["status"])
22+
```
23+
- Notes:
24+
- Only `.pdf` and `.txt` files are accepted.
25+
- If `API_KEY` is enabled on the server, the client sends it via `X-API-Key`.
26+
- Optional: `check_health()` calls `/health`.
27+
28+
## Node.js
29+
- Install:
30+
```
31+
npm install faxbot
32+
```
33+
- Usage:
34+
```js
35+
const FaxbotClient = require('faxbot');
36+
const client = new FaxbotClient('http://localhost:8080', 'YOUR_API_KEY');
37+
38+
(async () => {
39+
const job = await client.sendFax('+15551234567', '/path/to/document.pdf');
40+
console.log('Queued:', job.id, job.status);
41+
const status = await client.getStatus(job.id);
42+
console.log('Status:', status.status);
43+
})();
44+
```
45+
- Notes:
46+
- Only `.pdf` and `.txt` files are accepted.
47+
- If `API_KEY` is enabled, `X-API-Key` header is added automatically.
48+
- Optional: `checkHealth()` calls `/health`.
49+
50+
## Errors
51+
- The SDKs raise/throw on non-2xx responses. Common cases:
52+
- 400: invalid phone number or parameters
53+
- 401: missing/invalid API key
54+
- 413: file too large
55+
- 415: unsupported media type (non-PDF/TXT)
56+
- 404: job not found (for GET /fax/{id})
57+
58+
## Compatibility
59+
- The SDKs work regardless of backend (Phaxio cloud or SIP/Asterisk) because Faxbot abstracts the difference.

0 commit comments

Comments
 (0)