Migration and reference
Node.js SDK reference
Explore the server-side @yanola/whatsapp client, resources, request options, errors, retries, and webhook helpers.
DevelopersAdvancedAvailable
What this guide covers
- Initialize WhatsAppClient once with an API key and optional request settings.
- Use messages, senders, templates, media, events, usage, and webhook resources.
- Pass AbortSignal and explicit idempotency keys when your application owns them.
- Include the exported SDK version and request ID in sanitized support reports.
Identify the exact SDK release
The SDK exports YANOLA_SDK_VERSION and includes the same value in its default User-Agent. Record the exported version with a failing request ID so Yanola can distinguish release-specific patterns without collecting credentials or message content.
ts
import {
WhatsAppClient,
YANOLA_SDK_VERSION,
} from "@yanola/whatsapp"
const yanola = new WhatsAppClient({
apiKey: process.env.YANOLA_API_KEY!,
})
console.info({
component: "yanola-whatsapp",
sdkVersion: YANOLA_SDK_VERSION,
})Build a safe support report
- Preserve the same logical operation's request ID and idempotency key across application-owned retries.
- State whether the issue reproduces in Test Mode and whether any Live send or Yanola Balance is affected.
- For asynchronous sends, include the latest public message, event, webhook delivery, and usage states instead of treating a 202 response as final delivery.
| Include | Never include |
|---|---|
SDK version, UTC timestamp, environment, endpoint or operation name | API key, Authorization header, Meta token, or webhook signing secret |
Request ID and public msg_, msg_test_, evt_, del_, usg_, or resv_ IDs | Recipient lists, full message bodies, or raw retained provider payloads |
Sanitized error type, code, status, retryable flag, and bounded details | Signed media URLs, unredacted response bodies, or database credentials |
Diagnose delivery and billing safely
- Use webhookDeliveries.list or retrieve to inspect status, attempts, response status, and the redacted response preview.
- Replay only a terminal failed or canceled delivery after correcting the endpoint, and provide an application-owned idempotency key.
- Keep reserved and needs_reconciliation usage visible as unsettled. Never infer a final charge or create a replacement send while provider acceptance is uncertain.
- Escalate repeated endpoint timeouts, non-2xx patterns, reconciliation-needed states, or depleted Balance with the safe support fields above.