feat(whatsapp): implement native typing indicators via Cloud API - #1173
Open
JuanBifrost wants to merge 1 commit into
Open
JuanBifrost wants to merge 1 commit into
JuanBifrost wants to merge 1 commit into
Conversation
JuanBifrost
force-pushed
the
feat/whatsapp-typing-indicator
branch
from
September 13, 2026 20:12
560fc5f to
7765640
Compare
- Implement native WhatsApp typing indicator per Meta official documentation - Thread messageId into ConversationHandlers sendTyping and ChatJobSendTyping - Pass latest incoming message sourceId as message_id to Cloud API messages endpoint - Enforce configured delay in stepSendTyping so typing indicator remains visible before subsequent steps - Add unit tests for WhatsApp sendTyping handler and worker stepSendTyping
JuanBifrost
force-pushed
the
feat/whatsapp-typing-indicator
branch
3 times, most recently
from
September 13, 2026 23:27
85ba534 to
dda005d
Compare
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.
Summary
Implements native WhatsApp typing indicators via the WhatsApp Business Cloud API according to Meta's official documentation:
https://developers.facebook.com/documentation/business-messaging/whatsapp/typing-indicators
Context & Problem
Previously, the WhatsApp conversation handler attempted to call
markAsReadwith a hardcoded"lastMessageId"dummy string and did not implement typing indicator payloads. Additionally, flow steps executing typing did not pause execution to allow the typing indicator to remain visible before sending the subsequent message.Changes
SDK (
packages/sdk):ConversationHandlers["sendTyping"]input type with optionalmessageId?: string.Worker Config (
packages/worker-config):messageId?: stringtoChatJobSendTyping["data"].WhatsApp Integration (
integrations/whatsapp):sendTypingusingwhatsappClient.$$apiFetch$$with the official Meta endpointPOST /<API_VERSION>/<PHONE_NUMBER_ID>/messagesand payload:{ "messaging_product": "whatsapp", "status": "read", "message_id": "<INCOMING_MESSAGE_ID>", "typing_indicator": { "type": "text" } }messageIdand API/network errors without throwing unhandled exceptions."lastMessageId"dummy call inagentMarkAsRead.Worker Step Execution (
apps/worker):stepSendTyping, dynamically resolves the latest incoming message ID (sourceId) for the conversation viamessageService.findLatestIncomingMessage(following theservice -> repository -> DBpattern).setTimeoutfor the configured duration (props.step.seconds, clamped between 1s and 60s) so the typing indicator remains visible on the user's phone before subsequent flow messages are dispatched.messageIdinsendTypingToChannel(with fallback lookup for WhatsApp) and inprocessAutomatedResponse(triggerMessage?.sourceId).Unit Tests:
integrations/whatsapp/__tests__/conversation-typing.test.tsto test typing payloads, missing ID handling, and error resiliency.apps/worker/__tests__/step-typing-handler.test.tsto test step delay, message lookup, and channel dispatch.Verification
... escribiendo) renders on device during configured step seconds before response message arrives.