Skip to main content
Use @kapso/chat-adapter when a Chat SDK agent needs to receive Kapso WhatsApp webhooks, reply in threads, send buttons or media, and read Kapso conversation history. Use @kapso/whatsapp-cloud-api directly when you need raw templates, flows, catalogs, or lower-level WhatsApp API calls.

Installation

Requires Node.js >= 20.19. @chat-adapter/state-memory is good for local development. For production, use durable Chat SDK state.

Quickstart

Environment

You can also pass config directly:

Webhook route

Kapso sends platform webhooks as POST requests. Forward the raw Request to Chat SDK.
Configure the webhook in Kapso: Add whatsapp.message.sent only if your app needs sent-message echoes.

Send replies

Reply inside a direct message handler:
Start an outbound WhatsApp conversation:

Buttons

Chat SDK cards with buttons become WhatsApp reply buttons.
Handle button clicks:
WhatsApp supports up to 3 reply buttons. Button labels must be 1-20 characters.

Media

Send files through Chat SDK:
Inbound media appears as Chat SDK attachments. When Kapso includes a mirrored media URL, the attachment has url. When a WhatsApp media ID is available, the attachment has lazy fetchData().

History

With KAPSO_API_KEY, history reads from Kapso:
fetchThread() enriches metadata with Kapso contact and conversation records when available.

Source

GitHub repository

Source code, examples, and issue tracker for @kapso/chat-adapter.