[BUG] chats.update / initial history sync discard the archived flag before it reaches webhooks or the database
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 67/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, typescript
Hướng nghiên cứu
Start in whatsapp.baileys.service.ts and compare the chats.update and messaging-history.set handlers with the compiled path cited in the issue. Then inspect the Prisma Chat model and the findChats flow. Done means archived state reaches webhook payloads, persists on Chat rows, and is returned by findChats, with the relevant migration and tests or reproduction checks passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
📋 Bug Description
When a chat is archived/unarchived on the phone (or any linked device), Baileys emits the change via chats.update with an archived: true/false field. Evolution's chats.update handler in whatsapp.baileys.service.ts (WHATSAPP-BAILEYS integration) discards every field except remoteJid before forwarding to the webhook or writing to the DB:
"chats.update": async (e) => {
const chatsRaw = e.map(chat => ({ remoteJid: chat.id, instanceId: this.instanceId }));
this.sendDataWebhook('chats.update', chatsRaw);
for (const chat of e)
await this.prismaRepository.chat.updateMany({
where: { instanceId: this.instanceId, remoteJid: chat.id, name: chat.name },
data: { remoteJid: chat.id },
});
}
(from compiled dist/api/integrations/channel/whatsapp/whatsapp.baileys.service.js, v2.3.7)
The messaging-history.set handler (emits chats.set) does the same trim, and additionally only forwards chats not already in the Chat table — so even a fresh reconnect can't backfill archive state for chats Evolution already knows about.
The Chat Postgres table also has no archived column at all:
Table "public.Chat"
id | remoteJid | labels | createdAt | updatedAt | instanceId | name | unreadMessages
So there is currently no way for an integrator to learn a chat's real archived state via webhook, DB, or GET /chat/findChats/:instance — it's dropped at the earliest point in Evolution's own pipeline.
🔄 Steps to Reproduce
- Connect an instance (WHATSAPP-BAILEYS) with the
chats.updatewebhook enabled. - Archive (or unarchive) any chat directly on the linked phone.
- Inspect the delivered
chats.updatewebhook payload. - Check the
Chatrow for thatremoteJidviaGET /chat/findChats/:instanceor Postgres directly.
✅ Expected Behavior
chats.update carries the chat's current archived boolean, it's persisted on the Chat row, and findChats returns it — so integrators can mirror the phone's real archived list instead of maintaining a local-only flag.
❌ Actual Behavior
chats.update/chats.set payloads only ever contain {remoteJid, instanceId[, name]}. archived is silently discarded.
🌍 Environment
- OS: Ubuntu (Docker host)
- Evolution API version: 2.3.7
- Integration: WHATSAPP-BAILEYS
- Database: PostgreSQL 13
📝 Additional Context / Proposed Fix
Sketch of a fix, for whoever picks this up:
- Add
archived Boolean @default(false)to theChatPrisma model (migration). - In
chats.update, forwardarchived: chat.archivedin the webhook payload and include it in thechat.updateManywrite. - In
messaging-history.set, same field addition; consider also letting already-known chats'archived/pinned/muteEndTimerefresh on reconnect, since today only brand-new chats get forwarded at all. - Confirm
findChatsselects/returns the new column once it exists.
Related: #2495 looks like a different symptom in the same area (write-side archiveChat endpoint erroring) — this is the read side: archive state never reaching the integrator in the first place.
- Ngôn ngữ chính
- TypeScript
- Star
- 9.9k
- Fork
- 7.4k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của evolution-foundation/evolution-api
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
evolution-foundation/evolution-api#2723 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
evolution-foundation/evolution-api#2704 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
evolution-foundation/evolution-api#2702 · 2 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[BUG] Cloud API: a single unknown wamid in a `statuses` batch silently drops the whole batch (`return` instead of `continue`)Có thể đã có người làm @vin1i đã nhận 58 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
evolution-foundation/evolution-api#2700 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[BUG] Chatwoot integration duplicates messages when a device re-delivers the same key.id — getExistingSourceIds exists but is never called on the live pathCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
evolution-foundation/evolution-api#2675 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của evolution-foundation/evolution-api
Issue tương tự
-
Manager flashes an empty "errorOccurred" dialog while redirecting a logged-out user to loginĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openremote/openremote#3487 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
coollabsio/jean#867 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ehmpathy/rhachet-roles-bhuild#616 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
📘 Docs supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(cli): theme file home-directory check uses startsWith (sibling dirs pass, Windows casing fails)Đang mởarea/core kind/bug priority/p2 status/bot-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
google-gemini/gemini-cli#29955 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày