TypeScript port of ~/sample-client-server (Python). Exists to exercise
the @inkbox/sdk TypeScript SDK end-to-end — the equivalent of the
Python sample for tunnels, signature verification, phone/mailbox
patching, and the in-process WebSocket bridge.
- Builds an
InkboxSDK client from env. - Brings a tunnel online via
inkbox.tunnels.connect(...)with in-process HTTP and WebSocket handlers — no separate uvicorn/express required; the SDK runtime dispatches into our handler functions directly. - Patches every phone number + mailbox in the org to point at the tunnel host so real Inkbox traffic flows back here.
- HTTP handler at
POST /webhook: verifies theX-Inkbox-SignatureviaverifyWebhook(...), persists the payload topayloads/, logs a one-line summary, and returns{action:"answer"}on incoming-call webhooks. - WS handler at
/phone/media/ws: opts in to Inkbox-managed STT/TTS via the response headers, sends a greeting once the platform sends astartevent, and echoes anytranscriptevent back as atextevent for the platform to speak.
This is deliberately the simplest WS shape that proves the SDK works end-to-end. There's no OpenAI Realtime bridge in v1 — easy to add by swapping the WS handler, but not needed for an SDK smoke test.
Requires Node ≥22.
# nvm
nvm use 22
# install deps (pulls @inkbox/sdk from the npm registry)
npm install
# fill in .env
cp .env.example .env
$EDITOR .env
# run
npm start@inkbox/sdkis pinned to a registry release inpackage.json. Swap tofile:/path/to/inkbox/sdk/typescripttemporarily if you need to test unreleased SDK changes.payloads/is gitignored. So is.inkbox-tunnel-state*/.- The tunnel's
publicHostis{INKBOX_TUNNEL_NAME}.{INKBOX_TUNNEL_ZONE}— e.g. for dev, setINKBOX_TUNNEL_ZONE=development.inkboxwire.com.