Skip to content

Zavu SDKs Overview

The official Zavu SDK for TypeScript and the REST API it wraps. Send SMS, WhatsApp, Email and Voice messages with one typed client, or call the API directly from any language.

View .md

Zavu ships one official SDK, for TypeScript. It is generated from the same OpenAPI spec as the API reference, covers every v1 endpoint, and exposes API v2 as client.v2.

From any other language, call the REST API directly: every endpoint is plain JSON over HTTPS with a Bearer token, and each reference page shows the request as cURL.

Available tools

TypeScript SDKREST API
Package@zavudev/sdkhttps://api.zavu.dev
RuntimeNode 20+, Bun 1.0+, Deno 1.28+, edge runtimesAny
TypesFull TypeScriptOpenAPI spec
CoverageEvery v1 endpoint, plus v2 as client.v2Every endpoint

Installation

npm add @zavudev/sdk # or: bun add @zavudev/sdk

Basic Usage

import Zavudev from '@zavudev/sdk'; const zavu = new Zavudev(); // reads ZAVUDEV_API_KEY const result = await zavu.messages.send({ to: '+14155551234', text: 'Hello from Zavu!', }); console.log('Message ID:', result.message.id);

Common Operations

Send a Message

const result = await zavu.messages.send({ to: "+14155551234", text: "Your code is 123456", channel: "sms", });

Send with Template

const result = await zavu.messages.send({ to: "+14155551234", messageType: "template", content: { templateId: "tpl_abc123", templateVariables: { "1": "John", "2": "12345", }, }, });

List Messages

const result = await zavu.messages.list({ status: "delivered", limit: 50, }); for (const message of result.items) { console.log(message.id); }

Error Handling

import Zavudev, { APIError } from '@zavudev/sdk'; const zavu = new Zavudev({ apiKey: process.env["ZAVUDEV_API_KEY"], }); try { await zavu.messages.send({ to: "invalid", text: "Hello" }); } catch (error) { if (error instanceof APIError) { console.error("API Error:", error.status, error.message); } }

Most errors come back as { "code", "message", "details" } with a meaningful HTTP status. A few on POST /v1/messages (the monthly message and email allowances, and the per-recipient SMS rate limit) arrive nested as { "error": { "code", "message", "details" } }. Read the reason as body.code ?? body.error?.code and one handler covers both.

Generate a client from the OpenAPI spec

The specs are public and are the source the TypeScript SDK is generated from:

Point any OpenAPI 3 generator at them (for example openapi-generator for Python, Go, Java or PHP) to get a typed client for your language. Regenerate when the spec changes.

Other tools