Mark chat as unread after sending message

This commit is contained in:
Deep Koluguri 2026-06-19 12:42:13 -04:00
parent ed9a8eced9
commit ffb6638f04
1 changed files with 9 additions and 0 deletions

View File

@ -197,6 +197,15 @@ const handleSendMessage = async (req, res) => {
} }
const response = await client.sendMessage(targetJid, message); const response = await client.sendMessage(targetJid, message);
// Mark the chat as unread so it shows up as a notification/badge on the user's phone
try {
const chat = await client.getChatById(targetJid);
await chat.markUnread();
} catch (err) {
console.error('[WhatsApp Bot] Failed to mark chat as unread:', err);
}
res.json({ success: true, messageId: response.id._serialized, recipient: targetJid }); res.json({ success: true, messageId: response.id._serialized, recipient: targetJid });
} catch (error) { } catch (error) {