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 newZeploClient 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
- JavaScript/TypeScript
- Python
Contacts
- JavaScript/TypeScript
- Python
Campaigns
- JavaScript/TypeScript
- Python
Webhooks
- JavaScript/TypeScript
- Python
Error Handling
All SDK errors inherit from the baseZeploError class. Wrap calls in try/catch blocks to handle specific failure cases:
TypeScript Types
The SDK exports all request and response types so you can type your own functions:FAQ
Does the SDK support tree-shaking?
Does the SDK support tree-shaking?
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.Can I use the SDK in the browser?
Can I use the SDK in the browser?
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.How does rate limiting work?
How does rate limiting work?
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.Are requests retried automatically?
Are requests retried automatically?
By default, the SDK retries failed requests up to 3 times with exponential backoff. You can customize this behavior through the client configuration:
Does the SDK support WebSocket connections?
Does the SDK support WebSocket connections?
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.
