Skip to main content

What is the Web SDK?

The Web SDK is a small piece of code you drop into your website. When a visitor clicks a “Talk to us” button, it opens a live voice conversation with your OneInbox agent — right in the browser, using their microphone. Think of it like a live chat widget, but for voice. What it handles for you:
  • Asking the browser for microphone permission
  • Streaming audio in real time (both directions)
  • Showing live transcripts as the conversation happens
  • Mute, unmute, and hang up
What your team sets up:
  • An agent on OneInbox (the AI that answers)
  • A button or widget on your site that starts the call

Quick steps — the simplest way to add it to your site

This is the fastest path: a publishable key + the Web SDK, no backend required.
1

Create your agent

Build the agent that will answer calls — see Quickstart if you haven’t made one yet. Save its id (agt_…).
2

Create a publishable key

In the OneInbox dashboard, go to Settings → Publishable KeysCreate key. Enter the allowed origins for this key — one per line:Copy the key — it starts with oi_pk_live_….
Using * means any website can use your publishable key to start calls on your agent. This is fine for local testing but restrict to your actual domain before going to production.
3

Install the Web SDK

4

Wire it to your agent

Initialize the SDK with your publishable key, then point start() at your agent’s id:
5

Add a button on your site

Wire that start() call to any button — e.g. “Talk to us.” When a visitor clicks it, the call begins right there in the browser, using their mic.
That’s it — no server, no separate “create a call” step. The full event/control API (mute, transcripts, hang up, etc.) is below under Vanilla example and React example.

How it fits into your product

When a visitor clicks “Call”:
  1. Your website asks your server: “start a call for this visitor”
  2. Your server creates the call via the OneInbox API and gets back a short-lived access token
  3. The Web SDK uses that token to connect the visitor’s browser to the agent
  4. The conversation starts — live, two-way voice
Your server holds your secret API key. The browser only ever receives a one-time token that expires when the call ends — so nothing sensitive is exposed to visitors.

Two packages

Both do the same thing. The React package just wraps the core one with React-friendly patterns.

Install

Each package is self-contained — the SDK bundles everything it needs to handle the audio connection, so there are no other companion packages to install.

Vanilla example

What you can listen to

Controls


React example

useOneInbox() gives you everything you need to build a call UI: