From 27dc49f2c36d1c33b159c429a8210435eeaa2b3b Mon Sep 17 00:00:00 2001 From: Jesus Date: Mon, 7 Oct 2024 17:41:43 +0200 Subject: [PATCH] Fix unread for chat creation --- .../channel/whatsapp/whatsapp.baileys.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index cfe828fd..19aef748 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -627,7 +627,12 @@ export class BaileysStartupService extends ChannelStartupService { const chatsToInsert = chats .filter((chat) => !existingChatIdSet?.has(chat.id)) - .map((chat) => ({ remoteJid: chat.id, instanceId: this.instanceId, name: chat.name })); + .map((chat) => ({ + remoteJid: chat.id, + instanceId: this.instanceId, + name: chat.name, + unreadMessages: chat.unreadCount !== undefined ? chat.unreadCount : 0, + })); this.sendDataWebhook(Events.CHATS_UPSERT, chatsToInsert);