Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vobiz.ai/llms.txt

Use this file to discover all available pages before exploring further.

The official Node.js SDK for the Vobiz Voice API. Make calls, manage SIP trunks, handle CDR, record calls, configure phone numbers, and more - all natively from your Node.js or TypeScript backend. Source code: vobiz-ai/Vobiz-Node-SDK

Installation

Clone the repository and install the dependencies locally:
git clone https://github.com/vobiz-ai/Vobiz-Node-SDK.git
cd Vobiz-Node-SDK
npm install

Quick start

Make an outbound call:
const { Client } = require('vobiz-node');

const client = new Client(process.env.VOBIZ_AUTH_ID, process.env.VOBIZ_AUTH_TOKEN);

client.calls.create(
  '+911171366914',                  // source caller ID
  '+919148227303',                  // destination
  'https://yourserver.com/answer',  // webhook responding with VobizXML
  { hangupUrl: 'https://yourserver.com/hangup' }
).then(res => {
  console.log('Call queued with UUID:', res.requestUuid);
}).catch(console.error);

Authentication

All API calls require your Auth ID and Auth Token, available in the Vobiz Console. Initialize the client directly:
const { Client } = require('vobiz-node');
const client = new Client('YOUR_AUTH_ID', 'YOUR_AUTH_TOKEN');
Or use environment variables:
export VOBIZ_AUTH_ID=YOUR_AUTH_ID
export VOBIZ_AUTH_TOKEN=YOUR_AUTH_TOKEN
const client = new Client(); // Picks up env vars automatically

Common operations

Live and queued calls

// Hang up a live call
client.calls.hangup(callUuid);

// Transfer to another leg
client.calls.transfer(callUuid, { legs: 'aleg', alegUrl: 'https://...' });

// Inject audio and TTS
client.calls.playMusic(callUuid, ['https://example.com/audio.mp3']);
client.calls.speakText(callUuid, 'Hello from Vobiz', { voice: 'WOMAN', language: 'en-US' });

// Send DTMF digits
client.calls.sendDigits(callUuid, '1234');

// Stream audio (WebSocket fork)
client.calls.stream(callUuid, 'wss://your-agent.com', { audioTrack: 'inbound' });

Call detail records (CDR)

client.cdr.get({
  limit: 20,
  offset: 0,
  startTime: '2026-01-01T00:00:00Z',
  callDirection: 'outbound'
}).then(history => {
  console.log(`Fetched ${history.length} records`);
});

Conferences

client.conferences.get('sales-channel').then(conference => {
  conference.kickMember(memberId);
  conference.muteMember(memberId);
  conference.playAudioToMember(memberId, 'https://example.com/chime.mp3');
  conference.record({ fileFormat: 'mp3', transcriptionType: 'auto' });
});

VobizXML

The SDK handles REST interactions only (outbound dials, live mutations, provisioning). When a call is answered, Vobiz expects standard VobizXML logic returned from your webhook server:
app.post('/answer', (req, res) => {
  const xml = `
    <Response>
      <Speak voice="WOMAN" language="en-US">Thank you for calling.</Speak>
    </Response>
  `;
  res.type('text/xml').send(xml);
});

Webhooks and verification

Use the built-in validator to verify that webhook events originate from Vobiz:
const { validateSignature } = require('vobiz-node');

app.post('/webhook', (req, res) => {
  const isValid = validateSignature(
    req.url,
    req.headers['x-vobiz-signature'],
    req.body,
    process.env.VOBIZ_AUTH_TOKEN
  );

  if (!isValid) return res.status(401).send('Unauthorized payload');

  // Proceed with processing
});

Resources