Skip to main content

JavaScript SDK

The official Zeplo JavaScript SDK provides a typed, promise-based interface for the WhatsApp Business API. It works in Node.js, Deno, Bun, and modern browsers.
The SDK is fully written in TypeScript and ships with built-in type definitions. No additional @types package is needed.

Installation

1

Install the package

npm
yarn
pnpm
2

Verify installation

Initialization

Create a new ZeploClient instance with your configuration:
Store your API key in an environment variable such as ZEPLO_API_KEY. Never commit secrets to source control.

Environment Variables

Operations

Messaging

Contacts

Campaigns

Webhooks

Error Handling

All SDK errors inherit from the base ZeploError class. Wrap calls in try/catch blocks to handle specific failure cases:
ZeploRateLimitError includes a retryAfter property (in seconds). Implement exponential backoff rather than retrying immediately.

TypeScript Types

The SDK exports all request and response types so you can type your own functions:

FAQ

Yes. The @zeplo/sdk package is published as ES modules with per-module entry points. If you only import the specific sub-modules you need, your bundler can eliminate unused code from the final build.
The SDK works in all modern browsers (Chrome, Firefox, Safari, Edge). However, webhook signature verification requires Node.js APIs (crypto). For browser-only usage, use the REST-based operations and perform webhook verification on your server.
The SDK does not automatically retry on rate-limit errors. When you receive a ZeploRateLimitError, inspect the retryAfter property and wait that many seconds before retrying. For high-throughput scenarios, consider implementing a queue with concurrency control.
By default, the SDK retries failed requests up to 3 times with exponential backoff. You can customize this behavior through the client configuration:
The REST SDK (@zeplo/sdk) handles HTTP-based operations only. For real-time WebSocket communication, use Socket.IO directly or the dedicated @zeplo/ws package. See the WebSocket API documentation for details.

Next Steps

API Reference

Browse the full REST API endpoints, parameters, and response schemas.

Python SDK

Use the official Python SDK for server-side and data pipeline integrations.

Webhooks

Set up real-time event notifications for incoming messages and status updates.