Skip to content

feat: show typing indicator while preparing replies - #1

Open
nefurm wants to merge 1 commit into
gokapso:masterfrom
nefurm:feat/typing-indicator
Open

feat: show typing indicator while preparing replies#1
nefurm wants to merge 1 commit into
gokapso:masterfrom
nefurm:feat/typing-indicator

Conversation

@nefurm

@nefurm nefurm commented Jun 29, 2026

Copy link
Copy Markdown

What

When an inbound WhatsApp message arrives, the channel now marks it as read and asks WhatsApp to display a typing indicator while the agent prepares its reply. The indicator is dismissed when the reply is sent, or after ~25s (Meta's limit).

This gives users immediate feedback that their message was received — handy since agent turns (especially with reasoning models) can take a few seconds before the first reply.

How

  • Adds sendKapsoTypingIndicator() in outbound.ts, wrapping the SDK's messages.markRead with typingIndicator: { type: "text" } — the official Meta Cloud API typing-indicator mechanism, already exposed by @kapso/whatsapp-cloud-api.
  • Fires it best-effort / fire-and-forget at the start of dispatchKapsoInboundEvent, gated on resolveAdmission so blocked/disallowed senders never trigger it. Failures are logged via api.logger.warn and never block or fail the inbound turn.
  • Adds an opt-out typingIndicator channel config flag (default: true).

Config

On by default. To disable:

openclaw config set 'channels["kapso-whatsapp"].typingIndicator' 'false' --strict-json

Tests

  • npm run typecheck, npm test (10 passing), and npm run build all pass.
  • New tests cover the typing-indicator payload and the config opt-out; README documents the option.

🤖 Generated with Claude Code

When an inbound message arrives, the channel now marks it as read and asks
WhatsApp to display a typing indicator while the agent prepares its reply.
The indicator is dismissed when the reply is sent or after ~25s (Meta's limit),
giving users immediate feedback that the bot received their message.

- Add `sendKapsoTypingIndicator()` (wraps the SDK `messages.markRead` with
  `typingIndicator: { type: "text" }`).
- Fire it best-effort / fire-and-forget at the start of inbound dispatch, gated
  on admission so blocked/disallowed senders don't trigger it. Failures are
  logged and never block the inbound turn.
- Add an opt-out `typingIndicator` channel config flag (default: true).
- Tests for the helper and the config flag; README documents the option.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant