@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
@chat-adapter/state-memory is good for local development. For production, use durable Chat SDK state.
Quickstart
Environment
| Variable | Required | Use |
|---|---|---|
KAPSO_API_KEY | Yes | Sends messages, reads history, contacts, conversations, and media through Kapso. |
KAPSO_PHONE_NUMBER_ID | Recommended | Default WhatsApp phone number ID. Required for openDM(). |
KAPSO_WEBHOOK_SECRET | Recommended | Verifies Kapso X-Webhook-Signature deliveries. |
KAPSO_BASE_URL | No | Kapso proxy URL. Defaults to https://api.kapso.ai/meta/whatsapp. |
KAPSO_BOT_USERNAME | No | Bot display name. Defaults to the Chat SDK userName. |
Webhook route
Kapso sends platform webhooks asPOST requests. Forward the raw Request to Chat SDK.
| Setting | Value |
|---|---|
| Endpoint URL | Your public POST route, for example https://app.example.com/webhooks/kapso |
| Secret key | Same value as KAPSO_WEBHOOK_SECRET |
| Events | whatsapp.message.received |
whatsapp.message.sent only if your app needs sent-message echoes.
Send replies
Reply inside a direct message handler:Buttons
Chat SDK cards with buttons become WhatsApp reply buttons.Media
Send files through Chat SDK:url. When a WhatsApp media ID is available, the attachment has lazy fetchData().
History
WithKAPSO_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.
