api.keebai.com/v1.
Why use it
One client, two modes
Pass
apiKey and it talks to Keebai with persistence, dashboards, broadcasts, and normalized webhooks. Pass accessToken and it goes straight to Meta Graph API. Same method surface in both modes.Full WhatsApp coverage
Text, media (image, video, audio, document, sticker), location, contact cards, reactions, mark-read, interactive (buttons, list, CTA URL, catalog), templates, and broadcasts.
Strict TypeScript
Fully typed: inputs, responses, errors. Autocomplete in VS Code, Cursor, or any LSP-aware IDE. Dual ESM + CJS build with
.d.ts.Retries and timeouts
Automatic exponential backoff on 429, 5xx, and network errors. Configurable timeout. Normalizes Keebai and Meta errors into the same class.
Installation
fetch, FormData, and Blob). Also works on edge runtimes (Vercel Edge, Cloudflare Workers, Deno, Bun) and modern browsers.
Configuration
Set credentials via environment variables:The two modes
| Mode | Credential | Backend | When |
|---|---|---|---|
keebai (default) | apiKey: kbai_pk_... | https://api.keebai.com/v1 | You’re on the Keebai platform. Persistence, multi-tenant, broadcasts, webhooks, dashboards. |
meta | accessToken: EAA... | https://graph.facebook.com/v21.0 | You have your own WhatsApp Business Account and want to go straight to Meta. |
API surface
client.messages.*
| Method | What it does |
|---|---|
sendText | Free-form text inside the 24h window. |
sendImage | JPG/PNG by URL or media_id. Optional caption. |
sendVideo | MP4 with optional caption. |
sendAudio | Audio. voice: true for PTT (Opus in OGG). |
sendDocument | PDF/DOCX/etc. with filename and caption. |
sendSticker | Static or animated WebP. |
sendLocation | Map pin with optional name and address. |
sendContacts | One or more vCards. |
sendReaction | Emoji on a previous message. |
markRead | Mark as read, with optional typing indicator. |
sendInteractiveButtons | Up to 3 reply buttons. |
sendInteractiveList | Scrollable list with sections. |
sendInteractiveCtaUrl | Single button with an external URL. |
sendInteractiveCatalogMessage | Catalog message (Commerce). |
sendTemplate | Approved template with named variables. |
sendBulk | Mass broadcast (Keebai mode). |
getBulkStatus | Status of a previous broadcast (Keebai mode). |
sendRaw | Escape hatch — raw Graph API body. |
client.media.*
| Method | What it does |
|---|---|
upload | Upload a file. Returns a reusable media_id. |
get | Metadata (mime, size, sha256, signed URL). |
delete | Delete an uploaded media asset. |
download | Fetch the binary (as: 'blob' | 'arraybuffer'). |
client.templates.* (Keebai mode)
| Method | What it does |
|---|---|
list | List approved templates. |
create | Create and submit to Meta for approval. |
update | Edit components or category. |
Examples
Send an image with a caption
Template with named variables
Interactive buttons
Upload media once, send N times
Mark as read + typing
Mass broadcast
Error handling
| Code | Status | Cause |
|---|---|---|
UNAUTHORIZED | 401 | Token revoked or invalid. |
FORBIDDEN | 403 | Token doesn’t have the required scope. |
CHANNEL_NOT_FOUND | 404 | phoneNumberId unknown in your company. |
invalid_phone | 422 | to is not in E.164 format. |
MEDIA_REFERENCE_REQUIRED | 400 | Media is missing both link and media_id. |
THROTTLED | 429 | Hit the rate limit (the SDK retries on its own). |
Direct Meta mode
When you’d rather go straight to Meta without the platform:| Concern | keebai mode | meta mode |
|---|---|---|
| Auth | PAT (kbai_pk_...) from app.keebai.com | Access token (EAA...) from developers.facebook.com |
| Persistence | Yes — conversations, messages, contacts | No — Meta doesn’t store history |
| Normalized webhooks | Yes — { event, data, timestamp } envelope with HMAC signature | No — raw Meta envelope |
Broadcasts (sendBulk) | Yes | Not available |
| Templates CRUD | Yes | Not in this SDK; use the Business Management API |
| Dashboard | Yes | No |
| Multi-tenant | One PAT, multiple channels | One token per WABA |
| Send messages | Full coverage | Full coverage |
Helpers
Resources
GitHub repo
Source code, issues, and PRs. MIT.
npm: @keebai/sdk
Latest version, changelog, install stats.
Agent Skills
The
integrate-keebai-whatsapp skill for AI agents, built on this SDK.REST API
If you’d rather call the API directly without the SDK.