Skip to content

inkbox-ai/inkbox-quickstart-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-sample-client-server

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.

What it does

  • Builds an Inkbox SDK 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 the X-Inkbox-Signature via verifyWebhook(...), persists the payload to payloads/, 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 a start event, and echoes any transcript event back as a text event 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.

Setup

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

Notes

  • @inkbox/sdk is pinned to a registry release in package.json. Swap to file:/path/to/inkbox/sdk/typescript temporarily if you need to test unreleased SDK changes.
  • payloads/ is gitignored. So is .inkbox-tunnel-state*/.
  • The tunnel's publicHost is {INKBOX_TUNNEL_NAME}.{INKBOX_TUNNEL_ZONE} — e.g. for dev, set INKBOX_TUNNEL_ZONE=development.inkboxwire.com.

About

Sample Inkbox client/server in TypeScript using @inkbox/sdk.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors