Browse documentation

Start here

Installation

Set up the server-side Node.js SDK or call Yanola's versioned REST API directly.

DevelopersAdvancedAvailable

What this guide covers

  • Install the ESM-first @yanola/whatsapp package in a supported Node.js service.
  • Keep SDK and REST API usage in server-only code.
  • Configure the API key through your deployment platform's secret storage.

Requirements

  1. Node.js 20 or newer.
  2. A server-side ESM application, worker, or route handler.
  3. A Yanola API key created for the target Agent Project and environment.

Install the beta package

The SDK is currently pre-1.0. Pin the beta dist-tag and review the changelog before upgrading because breaking SDK changes may occur before 1.0.

npm
bash
npm install @yanola/whatsapp@beta
pnpm
bash
pnpm add @yanola/whatsapp@beta
Yarn
bash
yarn add @yanola/whatsapp@beta

Initialize one reusable client

Create the client once in a server-only module and reuse it. By default it calls https://api.yanola.ai/v1, times out after 30 seconds, and retries eligible failures up to two times.

src/lib/yanola.ts
ts
import { WhatsAppClient } from "@yanola/whatsapp"

const apiKey = process.env.YANOLA_API_KEY

if (!apiKey) {
  throw new Error("Missing YANOLA_API_KEY")
}

export const yanola = new WhatsAppClient({
  apiKey,
  timeoutMs: 30_000,
  maxRetries: 2,
})
WhatsAppClient options
OptionDefaultPurpose
apiKeyRequiredYanola API key from YANOLA_API_KEY.
baseUrlhttps://api.yanola.ai/v1Override only for an approved local or test deployment.
timeoutMs30000Timeout applied to each request attempt.
maxRetries2Retries for network, timeout, rate-limit, and eligible server failures.
headersNoneAdditional default headers; cannot replace authorization or request IDs.

Framework placement

Safe SDK locations
RuntimeUse the SDK inAvoid
Next.jsRoute handlers, Server Actions, server-only modules, and jobsClient Components and NEXT_PUBLIC_ variables
Express or NestJSBackend services, controllers, and workersHTML templates and browser-delivered configuration
Queues and cron jobsWorker processes with secret-manager accessSerialized job payloads containing API keys
ServerlessServer functions with encrypted environment secretsEdge runtimes without Node.js compatibility

Use the REST API without the SDK

All SDK operations use the same versioned /v1 contract. Send the Yanola API key as Bearer credentials when calling REST directly.

List Senders with curl
bash
curl "https://api.yanola.ai/v1/senders" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer $YANOLA_API_KEY"

Upgrade safely

  1. Read @yanola/whatsapp/CHANGELOG.md before changing beta versions.
  2. Run your TypeScript build and integration tests after an upgrade.
  3. Keep the REST /v1 base URL unchanged unless Yanola provides a migration path.