Skip to main content

JavaScript SDK

@telepat/otto-sdk is the official TypeScript/JavaScript SDK for integrating Otto into 3rd-party applications. It wraps the relay WebSocket and HTTP APIs into a clean, type-safe client that works in Node.js 22+, Cloudflare Workers, Deno, and any other runtime with native fetch and WebSocket.

npm install @telepat/otto-sdk

What you can do with the SDK​

CapabilitySDK surface
List nodes connected to the relayclient.nodes.list()
List available commands on a nodeclient.commands.list({ nodeId })
Execute a command and get the resultclient.commands.run({ nodeId, site, command, input })
Stream live listener updatesclient.listeners.subscribe({ nodeId, listener })
List pending pairing challengesclient.pairing.listPending()
Approve a pairing codeclient.pairing.approve({ code })

How it fits into the Otto architecture​

The SDK acts as a controller — the same role as the @telepat/otto CLI. Commands flow from your application through the SDK to the relay, then to the browser node:

Your app → @telepat/otto-sdk → Relay → Browser node (extension)

The SDK handles:

  • Credential exchange (clientId + clientSecret → JWT access token)
  • WebSocket lifecycle (connect, auth handshake, heartbeat, reconnect)
  • Request/response correlation via requestId
  • Typed streaming via AsyncIterable and EventEmitter

Before you start​

You need a relay running and a registered controller client. The quickest path:

# Start the relay
otto start

# Register a controller client and note the clientId + clientSecret
otto client register --name "My App"

See Getting Started for the full setup walkthrough.

In this section​

PageWhat you will find
Getting StartedRegistration, installation, connecting, and your first command
API ReferenceComplete API for OttoClient, sub-clients, StreamSession, and error types
ExamplesReal-world patterns: edge runtimes, retry, CI, streaming