@hexalabs/vcc-js-sdk
v1.0.0
Published
Lightweight SDK for Vapi Connection (VCC) backend
Downloads
127
Keywords
Readme
VCC SDK
The VCC (Vapi Connection) SDK is a lightweight TypeScript/JavaScript library designed to facilitate seamless voice interactions between browser applications and the VCC backend. It handles WebSocket communication, microphone access, and audio processing for real-time voice AI sessions.
Features
- Easy Initialization: Connect to your VCC backend with a simple
initSdkcall. - WebSocket Integration: Automatically manages WebSocket connections for low-latency audio transmission.
- Microphone Management: Built-in support for capturing and processing microphone audio (16kHz PCM).
- Event-Driven: Simple API for listening to status updates, messages, and raw binary audio data.
- Flexible Authentication: Supports both Bearer tokens and API keys.
Installation
npm install @hexalabs/vcc-js-sdkQuick Start
import { initSdk } from '@hexalabs/vcc-js-sdk';
const client = await initSdk({
serverBaseUrl: 'https://your-vcc-backend.com',
organizationId: 'your-org-id',
assistantId: 'your-assistant-id',
authHeader: 'your-api-key' // or 'Bearer your-jwt'
});
// Start the microphone after user interaction
await client.startMicrophone();
// Handle messages from the assistant
client.on('message', (data) => {
console.log('Assistant says:', data);
});
// Monitor connection status
client.on('status', (info) => {
console.log('Status change:', info.type);
});Documentation
- Getting Started Guide - Detailed guide on integration and API reference.
Development
# Build the SDK
npm run build