Web SDK
@flooai/sdk lets your visitors talk to a Floo agent directly from the browser - mic in, speaker out, live transcript. No phone number required.
Install
npmbash
npm install @flooai/sdkQuickstart
React examplets
700 font-semibold">import { FlooCall } 700 font-semibold">from "@flooai/sdk";
700 font-semibold">const call = 700 font-semibold">new FlooCall({
agentId: "agt_abc123",
variables: { customer_name: "Alex" },
});
call.onTranscript((turn) => {
console.log(turn.role, turn.text);
});
call.onStatus((status) => {
console.log("status:", status); 700 font-semibold">class="text-gray-500 italic">// connecting | ready | speaking | ended
});
700 font-semibold">class="text-gray-500 italic">// Mic permission prompt fires here:
700 font-semibold">await call.start();
700 font-semibold">class="text-gray-500 italic">// Later - caller clicks "End call":
700 font-semibold">await call.hangup();API
| Member | Description |
|---|---|
new FlooCall(opts) | Constructor. opts: { agentId, apiUrl?, variables? } |
start() | Requests mic permission, fetches a LiveKit token, joins the room. Returns a promise that resolves when the agent is connected. |
hangup() | Disconnects. Idempotent. |
onTranscript(cb) | Called for every finalized turn: { role: "user" | "agent", text } |
onStatus(cb) | Status transitions: connecting → ready → speaking → ended |
onError(cb) | Network / mic permission failures. |
getCallId() | Server-assigned call ID after start(). |
Try the demo
See it live on flooai.com/try-floo - embedded widget with brand-gradient orb + live transcript.