Skip to main content

Overview

The Vogent Web Client is a TypeScript/JavaScript library that allows you to integrate Vogent voice capabilities directly into your web applications. It provides real-time call management, audio streaming, and transcript monitoring.

GitHub Repository

View the source code and contribute on GitHub

Installation

Install the Vogent Web Client using your preferred package manager:

Prerequisites

Before using the Web SDK, you’ll need:
  • sessionId: Unique session identifier
  • dialId: Unique dial/call identifier
  • token: Authentication token (dial token)
Important: Use a public API key when creating browser-based calls. Never expose your secret API key in client-side code.

Quick Start

Here’s a complete example of how to initiate a call and monitor transcripts:

API Reference

VogentCall Constructor

Initialize a new call instance:
Parameters:
  • sessionId (string): Unique identifier for the session
  • dialId (string): Unique identifier for the dial/call
  • token (string): Authentication token (dial token)

Methods

start()

Initiates the call session.
Returns: Promise<void>

connectAudio()

Establishes the audio connection for the call.
Returns: Promise<AudioConnection>

monitorTranscript(callback)

Monitors the call transcript in real-time.
Parameters:
  • callback (function): Function called with transcript updates
Returns: function - Unsubscribe function to stop monitoring Transcript Object:
  • text (string): The transcribed text
  • speaker (string): Speaker identifier (e.g., “user”, “agent”)

setPaused(paused)

Pauses or resumes AI interaction during the call.
Parameters:
  • paused (boolean): true to pause, false to resume
Returns: Promise<void>

hangup()

Ends the call.
Returns: Promise<void>

Events

status

Listen for call status changes:
Status values:
  • connecting: Call is being established
  • connected: Call is active
  • ended: Call has ended
  • error: An error occurred

TypeScript Support

The Vogent Web Client is written in TypeScript and includes full type definitions for an enhanced development experience.

Error Handling

Always wrap your calls in try-catch blocks to handle errors gracefully:

Best Practices

Always use public API keys (prefixed with pub_) in client-side code. Never expose secret API keys in your web application.
Always unsubscribe from transcript monitoring and properly hang up calls when done: