Skip to main content
Using an MCP-capable agent? Use Project MCP when the agent should manage Kapso without shell access.

Installation

Requires Node.js >= 20.19. BSUID recipients, thread control, and project webhook commands require CLI 0.19.0 or later. Device login, logout --all, native credential storage, and --api-key require CLI 0.21.0 or later. On Windows, use CLI 0.21.2 or later to save and reuse OAuth credentials with a standard user account.

Authentication

Browser login

Sign in. Select an owner/admin project. Approve its permissions. The CLI opens your browser and receives a local callback. --project restricts project selection. --scopes requests fewer permissions, with cli:project projects:read always included. Authorizing the same user and project replaces the previous CLI connection, including another device.

SSH and headless login

Open the verification URL on a trusted device. Sign in on that device. Compare the displayed code with your terminal. Then approve the project and permissions. Only approve a code that your own CLI requested. The code expires after ten minutes. Ctrl-C cancels login. SSH and terminals without a TTY select device login automatically. --browser forces the local callback flow. --no-browser prints a URL for that callback flow without opening it.

API keys

Project commands use the API key without browser login. Create a key in the Kapso dashboard. Use an environment variable for CI, containers, and scripts. For one command, pass --api-key:
The flag takes precedence over KAPSO_API_KEY, then saved OAuth. Do not combine an API key with --project. The flag value is not saved. Environment variables keep the key out of shell history and process arguments.

Credentials

The CLI uses macOS Keychain, Windows Credential Manager, or Linux Secret Service to protect OAuth credentials. It stores an encrypted file under ~/.kapso/cli/oauth/ and migrates existing credentials on their next save or refresh. If native storage is unavailable, the CLI warns and uses a protected file. POSIX files use mode 0600. Windows uses a private ACL. The CLI does not replace an existing encrypted file with plaintext when its keychain is locked or unavailable. KAPSO_CREDENTIAL_STORE=file explicitly selects file storage for new credentials. Existing encrypted credentials still require their keychain. KAPSO_CLI_HOME isolates local state for tests or separate installations.

Disconnect

--all requires a saved OAuth connection that can still authenticate. With multiple saved accounts, select a project first. Other accounts, servers, MCP/native apps, and API keys are unaffected. If remote revocation fails, the CLI clears matching local credentials and reports that it cannot confirm remote success. In Integrate → OAuth, click a connection to inspect permissions and its Reported device. Owners and admins can revoke any member’s connection. Members can revoke their own connections. The device name comes from the client. It does not identify a separate session for each physical device.

Migrate an older login

Run kapso login to replace a pre-OAuth login with an OAuth connection. Older logins still work; interactive commands remind you to migrate at most once every 24 hours. No retirement date has been announced. Project API keys remain supported for scripts and CI. They do not need to migrate to OAuth.

Project context

The CLI remembers your active project. projects list shows connections saved locally. Authorize each additional project with kapso login --project <project-id>.
Check your full setup status:
Status identifies OAuth, API-key, legacy-token, or unauthenticated access. OAuth sessions include the user, project, scopes, and access-token expiry without token values. CLI 0.21.2 omits the unavailable organization row from terminal output. For existing JSON consumers, organization remains null.

Setup

Connect a WhatsApp number to your project:
This resolves your project and customer, then generates a setup link to connect or provision a WhatsApp number. For automation:

Numbers

Most WhatsApp commands accept --phone-number or --phone-number-id to specify which number to act on. You can also pass the number as a positional argument where supported.

Messages

Send a text message

Send to a BSUID

Use --recipient for a business-scoped user ID (BSUID):
You can combine --to and --recipient when both identifiers belong to the same customer.

Send with a JSON payload

For media, interactive, or any advanced message type, pass a JSON payload:

Select a messaging account or endpoint

--messaging-account-id selects the WhatsApp Business Account used for the send. It must match the account configured for the phone number and overrides the same field in a JSON payload. For Meta’s Marketing Messages endpoint, use an eligible account and an approved marketing template payload:
The default endpoint is messages. The CLI sends raw JSON payloads through the Graph v24 proxy; Meta’s account and template requirements still apply.

List and get messages

Conversations

Human output uses BSUID and username when a conversation has no phone number. Message output includes passive and origin attribution for messages handled by another app.

Conversation routing

On numbers shared with another app or Meta’s AI agent, regular messages require Kapso to handle the conversation. Templates remain available, subject to the usual WhatsApp rules. See Conversation routing.
Each command accepts --to, --recipient, or both. Optional --metadata passes up to 2,000 characters to the receiving app. The roles for pass are escalation, ai_agent, customer_service, marketing, utility, and ctwa; Meta must enable the action and role on the account. To explicitly take control while sending, add --take-control:
Taking control requires Kapso to be the escalation app. An unknown result can mean the action succeeded; verify ownership before trying again. See API errors.

Calls

Read-only. Requires CLI 0.19.1 or later.
calls artifact needs KAPSO_API_KEY or --api-key. Recording inspection prints metadata only. Transcript inspection adds a short text preview; use --download for Meta’s original JSON. Existing files aren’t replaced unless you pass --force. See Recordings and transcripts.

Templates

Webhooks

Create a webhook

Number webhooks support message and conversation events, contact identity and marketing preference changes, workflow handoffs and failures, and these routing events:
  • whatsapp.thread.ownership_changed
  • whatsapp.thread.standby
  • whatsapp.meta_business_agent.handover
Use kapso whatsapp webhooks new --help for the complete event list. Subscribe to routing events on the number webhook; account enforcement and phone lifecycle events use a project webhook. See Message events.

Manage webhooks

Message buffering

Buffer multiple whatsapp.message.received events into a single delivery:

Project webhooks

Create a webhook without a number selector for project events, including account enforcement and phone connection changes. Those WhatsApp events require payload version v2.
list includes number webhooks across the project. test queues a sample for a subscribed event; check your receiver to confirm delivery. Omit --event to let the server choose a subscribed event. Webhook creation prints the signing secret. Both webhook scopes accept repeated --header Name=value flags; custom header names keep their original spelling. See Project webhooks for event payloads.

Customers

Logs

--source is all, external_api_log, whatsapp_webhook_event, flow_event, or webhook_delivery. --period is 24h, 7d, or 30d. Repeat --filter key=value to narrow results.

Local workflow development

Use these commands when you want to keep Kapso workflows and functions in a local repository.
kapso pull writes local source files for workflows and functions. If you edit workflows with @kapso/workflows, build the generated JSON before pushing:
You can also push one function or everything in the repo:
If a pull is blocked by local edits, inspect or replace the incoming changes:
See Build locally for the full workflow source-control guide.

Output formats

All commands support --output json or --output human. Most default to json — pipe into jq for scripting:

API errors

Message, thread-control, and webhook commands exit with a nonzero status on failure. With --output json, they write an error object to stderr with the HTTP status, error code, provider details when available, and a hint for routing refusals. A 409 ownership refusal means Kapso cannot send a regular message in that conversation. Meta code 2494191 means Kapso cannot take control; code 100 with “not supported” means the action or target role is unavailable on the account. After a 502 with an unknown thread-control result, the CLI reports outcome: "unknown", retryable: false, and retry.action: "verify_ownership". Check ownership through conversation state or a routing webhook before another action. The CLI does not retry thread-control actions automatically.

Help