Skip to content

Self-chat mode: all incoming whatsapps from any sender are marked as read instantly #35

@tmustier

Description

@tmustier

Hi again (2/2),

Another self-chat mode quirk: clawdis sends read receipts (blue ticks) for every incoming whatsapp message I receive.

In two-phone mode this makes sense, because the bot is a separate entity that "reads" the message. In self-chat mode, this means everyone who messages me sees blue ticks instantly, and I can't see which of my messages are unread.

I'd patched this locally by auto-detecting self-chat mode and skip sending read receipts. Local implementation duplicates computing isSelfChatMode (like in #34); but if both make it in would instead extract to a shared helper (see below for both cases).

Happy to submit a small PR alongside the other one if this looks right!

Thomas

Issue writeup

  • Expected: In self-chat mode, read receipts behave normally (sent when I actually view messages on my phone)
  • Actual: All incoming WhatsApp messages are immediately marked as read
  • Cause: sock.readMessages() is called unconditionally for all processed messages
  • Proposed fix: Detect self-chat mode and skip read receipts.
  • Implementation:
     // src/utils.ts or src/config/config.ts
     export function isSelfChatMode(selfE164: string | null, allowFrom?: string[]): boolean {
       if (!selfE164 || !allowFrom?.length) return false;
       return allowFrom.some((n) => normalizeE164(n) === selfE164);
     }
  • Else, standalone fix is to recompute isSelfChatMode in src/web/inbound.ts
  const isSelfChatMode = selfE164 && allowFrom?.some((n) => normalizeE164(n) === selfE164);

  if (id && !isSelfChatMode) {
    await sock.readMessages([...]);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions