TypeScript / JavaScript SDK

The official Voicebip SDK for TypeScript and JavaScript, auto-generated from the OpenAPI spec via Fern. The package is not yet published to npm — this page previews what the API will look like when it ships.

Installation (Coming Soon)

$npm install @voicebip/sdk

In the Meantime

Use the REST API directly with fetch:

1const BASE = "https://api.voicebip.com/v1";
2const headers = {
3 Authorization: "Bearer pk_live_xxx",
4 "Content-Type": "application/json",
5};
6
7// Create an agent
8const agent = await fetch(`${BASE}/agents`, {
9 method: "POST",
10 headers,
11 body: JSON.stringify({ display_name: "Support", language: "en" }),
12}).then((r) => r.json());
13
14// Initiate a call
15const call = await fetch(`${BASE}/calls`, {
16 method: "POST",
17 headers,
18 body: JSON.stringify({
19 agent_id: agent.agent_id,
20 from_number: "+2342013501000",
21 to_number: "+2348031234567",
22 }),
23}).then((r) => r.json());
24
25console.log("Call started:", call.call_id);

Preview Usage

When @voicebip/sdk is published, the same flow will look like this:

Quick Start

1import { Voicebip } from "@voicebip/sdk";
2
3const client = new Voicebip({ apiKey: "pk_live_xxx" });
4
5// Create an agent
6const agent = await client.agents.create({
7 displayName: "Customer Support",
8 language: "en",
9 systemPrompt: "You are a helpful customer support agent.",
10});
11
12// Provision a Nigerian number
13const number = await client.numbers.provision({
14 numberId: "num_xxx",
15 agentId: agent.agentId,
16 channels: ["voice"],
17});
18
19// Initiate an outbound call
20const call = await client.calls.initiate({
21 agentId: agent.agentId,
22 fromNumber: number.e164,
23 toNumber: "+2348031234567",
24});
25
26console.log(`Call started: ${call.callId}`);

Error Handling

1import { Voicebip, VoicebipError } from "@voicebip/sdk";
2
3try {
4 await client.calls.initiate({ ... });
5} catch (err) {
6 if (err instanceof VoicebipError) {
7 console.error(`${err.errorCode}: ${err.message}`);
8 // Handle specific errors
9 if (err.errorCode === "CALL_WINDOW_RESTRICTED") {
10 console.log("Call outside permitted hours");
11 }
12 }
13}

Available Methods

ModuleMethodDescription
agentscreate, list, get, update, deleteAgent CRUD
numberslistAvailable, provision, get, releaseNumber management
callsinitiate, get, end, hold, resume, transfer, sendDtmfVoice calls
messagessendSMS and WhatsApp
apiKeyscreate, list, revoke, rotateAPI key management
billinggetUsage, getBalance, createCheckoutUsage and payments
dpaaccept, getStatusNDPR compliance
webhookstestWebhook testing