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)
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:sessionId(string): Unique identifier for the sessiondialId(string): Unique identifier for the dial/calltoken(string): Authentication token (dial token)
Methods
start()
Initiates the call session.
Promise<void>
connectAudio()
Establishes the audio connection for the call.
Promise<AudioConnection>
monitorTranscript(callback)
Monitors the call transcript in real-time.
callback(function): Function called with transcript updates
function - Unsubscribe function to stop monitoring
Transcript Object:
text(string): The transcribed textspeaker(string): Speaker identifier (e.g., “user”, “agent”)
setPaused(paused)
Pauses or resumes AI interaction during the call.
paused(boolean):trueto pause,falseto resume
Promise<void>
hangup()
Ends the call.
Promise<void>
Events
status
Listen for call status changes:
connecting: Call is being establishedconnected: Call is activeended: Call has endederror: 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
Use Public API Keys
Use Public API Keys
Always use public API keys (prefixed with
pub_) in client-side code. Never expose secret API keys in your web application.Clean Up Resources
Clean Up Resources
Always unsubscribe from transcript monitoring and properly hang up calls when done: