JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 60
  • Score
    100M100P100Q58294F
  • License MIT

Web SDK for Callybase AI voice agents

Package Exports

  • @callybaseai/vox
  • @callybaseai/vox/dist/vox.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@callybaseai/vox) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vox

Web SDK for Callybase AI voice agents

Installation

To install Vox, you can use either npm or yarn.

Using npm:

npm install @callybaseai/vox

Using yarn:

yarn add @callybaseai/vox

Usage

Import the package

Begin by importing the CallybaseClient class from the SDK into your JavaScript application:

import { CallybaseClient } from "@callybaseai/vox";

Initialize the client

Create an instance of the CallybaseClient class. This client will be used to manage your AI voice agent interactions.

const client = new CallybaseClient();

Start the call

To initiate a call with a specific AI agent, use the start method. Replace "agentId" with the ID of your agent from your Callybase dashboard

await client.start(<agentId>);

End the call

To end an ongoing call, invoke the stop method:

await client.stop();

Event Listeners

We provide event listeners that you can use to enhance the functionality of your application. Here are some of the key events:

client.on("CALL_INITIATED", () => {
  // Triggered when the call is initiated. This event is fired after the start method is called.
});

client.on("CALL_STARTED", () => {
  // Triggered when the AI agent is connected to the user.
});

client.on("CALL_ENDED", () => {
  // Triggered when the call ends, which may happen due to user action or session timeouts.
});

client.on("LATENCY", (d) => {
  // Sent periodically to report the latency of the last user speech processing.
  console.log(`Latency is ${d.total}ms`);
});

client.on("ERROR", (d) => {
  // Triggered when the server throws a fatal error.
  console.log(`Got an error`, e.message);
});