mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
feat: add examples to create workflow and use sdk
This commit is contained in:
parent
16587fd7e1
commit
f041e6030d
18 changed files with 1038 additions and 7 deletions
44
examples/README.md
Normal file
44
examples/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Dograh SDK Examples
|
||||
|
||||
Runnable examples of the Dograh SDK in Python and TypeScript.
|
||||
|
||||
## Shared environment variables
|
||||
|
||||
Copy `.env.example` to `.env` in each example directory and fill in your values, then `source .env` (or use your preferred dotenv loader).
|
||||
|
||||
| Variable | Description |
|
||||
| --------------------- | ------------------------------------------------------------ |
|
||||
| `DOGRAH_API_ENDPOINT` | Dograh API base URL (e.g. `http://localhost:8000`) |
|
||||
| `DOGRAH_API_TOKEN` | API token — sent as `X-API-Key` |
|
||||
|
||||
The workflow ID and destination phone number are set as constants at the top of each example script — edit them there.
|
||||
|
||||
## Python
|
||||
|
||||
```bash
|
||||
pip install dograh-sdk
|
||||
|
||||
export DOGRAH_API_ENDPOINT=http://localhost:8000
|
||||
export DOGRAH_API_TOKEN=sk-...
|
||||
|
||||
# Fetch a workflow by ID and place a test phone call.
|
||||
python python/fetch_workflow_and_call.py
|
||||
|
||||
# Create a new workflow from a definition.
|
||||
python python/create_workflow.py
|
||||
```
|
||||
|
||||
## TypeScript
|
||||
|
||||
Uses `tsx` to run directly.
|
||||
|
||||
```bash
|
||||
cd typescript
|
||||
npm install
|
||||
|
||||
export DOGRAH_API_ENDPOINT=http://localhost:8000
|
||||
export DOGRAH_API_TOKEN=sk-...
|
||||
|
||||
npm run call # fetch_workflow_and_call.ts
|
||||
npm run create # create_workflow.ts
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue