Skip to content

feat(messages): typingIndicator option on markRead - #12

Merged
Ryan Zhu (underthestars-zhy) merged 1 commit into
mainfrom
feat/typing-indicator
Jul 21, 2026
Merged

feat(messages): typingIndicator option on markRead#12
Ryan Zhu (underthestars-zhy) merged 1 commit into
mainfrom
feat/typing-indicator

Conversation

@invisicat

@invisicat Andy (invisicat) commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

pins the BSR module to ff29794 (spectrum-whatsapp-business 2cab0fb), which added MarkReadRequest.typing_indicator. markRead() now accepts { typingIndicator: true } to show a typing bubble as a rider on the read receipt. theres no stop indicator b/c meta does not provide one.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Note

Low Risk
Backward-compatible optional flag on an existing API; scope is limited to mark-read/typing UX with tests.

Overview
Adds optional typing indicator support on markRead() by wiring through the new MarkReadRequest.typing_indicator field from the updated WhatsApp BSR schema (pin bumped to ff29794, package 0.2.1).

markRead(messageId, options?) now accepts MarkReadOptions with typingIndicator?: boolean (defaults to false), so callers can show a typing bubble on the same gRPC call as the read receipt. MarkReadOptions is exported from the package public API.

Unit tests cover default read-only behavior and typingIndicator: true forwarding to the gRPC client.

Reviewed by Cursor Bugbot for commit d90fc94. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added support for displaying a typing indicator when marking a message as read.
    • Exposed new options for configuring mark-as-read behavior.
  • Bug Fixes

    • Mark-as-read requests now consistently default the typing indicator to disabled.
  • Chores

    • Updated the package release version.
    • Refreshed the underlying service definition reference.

Pins the BSR module to ff29794 (spectrum-whatsapp-business 2cab0fb),
which added MarkReadRequest.typing_indicator. markRead() now accepts
{ typingIndicator: true } to show a typing bubble as a rider on the
read receipt — Meta dismisses it after 25s or on the next send; there
is no stop API. Bumps version to 0.2.1.
@invisicat Andy (invisicat) self-assigned this Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 00:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The mark-read API now accepts an optional typing indicator flag, exports its new option type, forwards the flag through gRPC, and tests default and explicit values. The package version and pinned BSR module digest are also updated.

Changes

Mark-read typing indicator

Layer / File(s) Summary
Mark-read option and request handling
src/types/messages.ts, src/index.ts, src/resources/messages.ts, tests/unit/messages.test.ts
Adds and exports MarkReadOptions, forwards typingIndicator through markRead with a false default, and tests both default and explicit values.
Release and schema pin updates
package.json, buf.gen.yaml
Bumps the package version to 0.2.1 and updates the pinned WhatsApp BSR commit digest.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: underthestars-zhy

Poem

A rabbit marks a message read,
With typing hops sent straight ahead.
False by default, true when shown,
New exports make the choice well-known.
A fresh release tag joins the thread.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a typingIndicator option to markRead in messages.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/typing-indicator

Comment @coderabbitai help to get the list of available commands.

@invisicat Andy (invisicat) added the release Wowowowow label Jul 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/unit/messages.test.ts (1)

6-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use an arrow function for the short test helper.

Convert makeResource to const makeResource = () => { ... }; for consistency with the repository’s TypeScript style.

As per coding guidelines, use arrow functions for callbacks and short functions.

Proposed refactor
-function makeResource() {
+const makeResource = () => {
   const calls: MarkReadRequest[] = [];
   const client = {
     markRead: (request: MarkReadRequest) => {
       calls.push(request);
       return Promise.resolve({});
     },
   } as unknown as MessageServiceClient;
   return { messages: new MessagesResource(client), calls };
-}
+};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/messages.test.ts` around lines 6 - 15, Convert the makeResource
test helper from a function declaration to an arrow-function constant,
preserving its existing client setup, calls tracking, and returned
MessagesResource behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unit/messages.test.ts`:
- Around line 6-15: Convert the makeResource test helper from a function
declaration to an arrow-function constant, preserving its existing client setup,
calls tracking, and returned MessagesResource behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1cedc002-10ba-4ebd-949d-2864b1b4e891

📥 Commits

Reviewing files that changed from the base of the PR and between fb842c3 and d90fc94.

⛔ Files ignored due to path filters (1)
  • src/generated/photon/whatsapp/v1/message_service.ts is excluded by !**/generated/**
📒 Files selected for processing (6)
  • buf.gen.yaml
  • package.json
  • src/index.ts
  • src/resources/messages.ts
  • src/types/messages.ts
  • tests/unit/messages.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Cursor Bugbot
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use explicit types for function parameters and return values when they enhance clarity
Prefer unknown over any when the type is genuinely unknown
Use const assertions (as const) for immutable values and literal types
Leverage TypeScript's type narrowing instead of type assertions

Files:

  • tests/unit/messages.test.ts
  • src/index.ts
  • src/resources/messages.ts
  • src/types/messages.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx}: Use meaningful variable names instead of magic numbers - extract constants with descriptive names
Use arrow functions for callbacks and short functions
Prefer for...of loops over .forEach() and indexed for loops
Use optional chaining (?.) and nullish coalescing (??) for safer property access
Prefer template literals over string concatenation
Use destructuring for object and array assignments
Use const by default, let only when reassignment is needed, never var
Always await promises in async functions - don't forget to use the return value
Use async/await syntax instead of promise chains for better readability
Handle errors appropriately in async code with try-catch blocks
Don't use async functions as Promise executors
Remove console.log, debugger, and alert statements from production code
Throw Error objects with descriptive messages, not strings or other values
Use try-catch blocks meaningfully - don't catch errors just to rethrow them
Prefer early returns over nested conditionals for error cases
Extract complex conditions into well-named boolean variables
Use early returns to reduce nesting
Prefer simple conditionals over nested ternary operators
Don't use eval() or assign directly to document.cookie
Avoid spread syntax in accumulators within loops
Use top-level regex literals instead of creating them in loops
Prefer specific imports over namespace imports

Files:

  • tests/unit/messages.test.ts
  • src/index.ts
  • src/resources/messages.ts
  • src/types/messages.ts
**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{test,spec}.{js,jsx,ts,tsx}: Write assertions inside it() or test() blocks
Avoid done callbacks in async tests - use async/await instead
Don't use .only or .skip in committed code
Keep test suites reasonably flat - avoid excessive describe nesting

Files:

  • tests/unit/messages.test.ts
**/index.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid barrel files (index files that re-export everything)

Files:

  • src/index.ts
🔇 Additional comments (6)
src/types/messages.ts (1)

154-167: LGTM!

src/index.ts (1)

92-92: LGTM!

src/resources/messages.ts (1)

6-6: LGTM!

Also applies to: 36-44

tests/unit/messages.test.ts (1)

1-4: LGTM!

Also applies to: 17-29

package.json (1)

3-3: LGTM!

buf.gen.yaml (1)

3-5: 🗄️ Data Integrity & Integration

Generated gRPC sources are already in sync

			> Likely an incorrect or invalid review comment.

@underthestars-zhy
Ryan Zhu (underthestars-zhy) merged commit 6b5cb84 into main Jul 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Wowowowow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants