Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.wazzapi.com/llms.txt

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

Node.js SDK

The official Node.js and TypeScript SDK gives you a typed client for the public WazzAPI surface. Use it to:
  • send direct WhatsApp messages
  • pair SDK usage with the public API for device inventory and sender selection
  • manage contacts, groups, and templates
  • verify signed WazzAPI webhook deliveries
  • download and decrypt WhatsApp media payloads

Package

Install the published package from npm.

Source code

Browse the SDK repository, examples, and release history.

Requirements

  • Node.js 20, 22, or 24
  • a WazzAPI account
  • a WazzAPI API key
If you plan to verify webhooks, also create a webhook secret in the dashboard.
Do not use this SDK in browser-side code. Keep your WazzAPI credentials on the server only.

Install

Choose the package manager that fits your stack:
npm
npm install @wazzapi/wazzapi
bun
bun add @wazzapi/wazzapi

Configuration

The SDK uses https://api.wazzapi.com by default. For most integrations, you only need:
  • WAZZAPI_API_KEY
For webhook verification, also set:
  • WAZZAPI_WEBHOOK_SECRET
.env
WAZZAPI_API_KEY=wz_live_your_api_key
WAZZAPI_WEBHOOK_SECRET=whsec_your_webhook_secret

Quick start

Send a message

import { WazzapiClient } from "@wazzapi/wazzapi";

const client = new WazzapiClient({ apiKey: process.env.WAZZAPI_API_KEY });

const response = await client.messages.send({
  phone_number: "+6281234567890",
  whatsapp_account_id: "your-whatsapp-account-id",
  content: "Hello from WazzAPI!",
});

console.log(response.message_id, response.status);

List devices

const response = await fetch("https://api.wazzapi.com/api/v1/devices", {
  headers: {
    Authorization: `Bearer ${process.env.WAZZAPI_API_KEY}`,
  },
});

const devices = await response.json();

console.log(devices.total);
console.log(devices.devices.map((device) => [device.id, device.name, device.status]));

Verify incoming webhooks

Use WebhookHandler to validate the raw request body against the signature header before parsing JSON.
import { WebhookHandler } from "@wazzapi/wazzapi";

const handler = new WebhookHandler(process.env.WAZZAPI_WEBHOOK_SECRET || "");
const webhook = handler.verifyAndParse(rawBody, request.headers);

console.log(webhook.event_type);
console.log(webhook.data);
WazzAPI signs webhook deliveries with:
  • X-Wazzapi-Signature
  • X-Wazzapi-Event
  • X-Wazzapi-Event-ID
Supported event families include:
  • message events: message.received, message.sent, message.delivered, message.read, message.failed
  • device events: device.connected, device.disconnected

Handle API errors

When the API returns a non-success status, the SDK raises WazzapiAPIError.
import { WazzapiAPIError, WazzapiClient } from "@wazzapi/wazzapi";

try {
  const client = new WazzapiClient({ apiKey: process.env.WAZZAPI_API_KEY });
  await client.messages.get("missing-message-id");
} catch (error) {
  if (error instanceof WazzapiAPIError) {
    console.error(error.statusCode);
    console.error(error.message);
    console.error(error.details);
  }
}

Example scripts

The SDK repository includes ready-to-run examples:
  • examples/list-contacts.ts
  • examples/send-message.ts
  • examples/create-template.ts
  • examples/preview-template.ts
  • examples/verify-webhook.ts
  • advanced-examples/download-media.ts

Next steps

Quickstart

Create your API key and send your first live request.

API Reference

Explore endpoints and payloads behind the SDK methods.