Skip to content

Commit ccd784e

Browse files
committed
feat(contact): add full snapshot resyncAppState prior to mutation
1 parent 1609f44 commit ccd784e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,6 +3796,16 @@ export class BaileysStartupService extends ChannelStartupService {
37963796
}
37973797
contactPayload.pnJid = jid;
37983798

3799+
// Ensure local collection LTHash is 100% in sync with WhatsApp Cloud before mutating
3800+
try {
3801+
if (typeof (this.client as any).resyncAppState === 'function') {
3802+
this.logger.info(`[saveContact] Syncing full critical_unblock_low snapshot from WhatsApp Cloud...`);
3803+
await (this.client as any).resyncAppState(['critical_unblock_low'], true);
3804+
}
3805+
} catch (syncErr) {
3806+
this.logger.warn(`[saveContact] resyncAppState warning: ${syncErr}`);
3807+
}
3808+
37993809
this.logger.info(`[saveContact] Attempting chatModify for PN jid=${jid} with payload=${JSON.stringify(contactPayload)}`);
38003810

38013811
const result = await this.client.chatModify(

0 commit comments

Comments
 (0)