feat: show typing indicator while preparing replies - #1
Open
nefurm wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
sendKapsoTypingIndicator()inoutbound.ts, wrapping the SDK'smessages.markReadwithtypingIndicator: { type: "text" }— the official Meta Cloud API typing-indicator mechanism, already exposed by@kapso/whatsapp-cloud-api.dispatchKapsoInboundEvent, gated onresolveAdmissionso blocked/disallowed senders never trigger it. Failures are logged viaapi.logger.warnand never block or fail the inbound turn.typingIndicatorchannel config flag (default:true).Config
On by default. To disable:
Tests
npm run typecheck,npm test(10 passing), andnpm run buildall pass.🤖 Generated with Claude Code