feat(whatsapp): add sendReadReceipts config option

Add option to disable automatic read receipts for WhatsApp messages.
When set to false, Clawdbot will not mark messages as read (blue ticks).

Closes #344

Changes:
- Add sendReadReceipts to WhatsAppConfig and WhatsAppAccountConfig types
- Add sendReadReceipts to zod schemas for validation
- Add sendReadReceipts to ResolvedWhatsAppAccount with fallback chain
- Pass sendReadReceipts through to monitorWebInbox
- Gate sock.readMessages() call based on config option

Default behavior (true) is preserved - only explicitly setting false
will disable read receipts.
This commit is contained in:
Christian A. Rodriguez
2026-01-13 22:01:55 -04:00
committed by Peter Steinberger
parent 44a237b637
commit 7a683a4b62
5 changed files with 28 additions and 14 deletions

View File

@@ -26,6 +26,8 @@ export async function monitorWebInbox(options: {
authDir: string;
onMessage: (msg: WebInboundMessage) => Promise<void>;
mediaMaxMb?: number;
/** Send read receipts for incoming messages (default true). */
sendReadReceipts?: boolean;
}) {
const inboundLogger = getChildLogger({ module: "web-inbound" });
const inboundConsoleLog = createSubsystemLogger("gateway/channels/whatsapp").child("inbound");
@@ -139,7 +141,11 @@ export async function monitorWebInbox(options: {
});
if (!access.allowed) continue;
if (id && !access.isSelfChat) {
if (
id &&
!access.isSelfChat &&
options.sendReadReceipts !== false
) {
const participant = msg.key?.participant;
try {
await sock.readMessages([{ remoteJid, id, participant, fromMe: false }]);