Skip to content

Commit 525daff

Browse files
Merge pull request #419 from judsonjuniorr/improvement/contacts-saving
Implement contact upsert in messaging-history.set
2 parents 4bb81b9 + b2c51b4 commit 525daff

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/whatsapp/services/whatsapp.service.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,7 @@ export class WAStartupService {
17341734
{
17351735
messages,
17361736
chats,
1737+
contacts,
17371738
}: {
17381739
chats: Chat[];
17391740
contacts: Contact[];
@@ -1846,6 +1847,17 @@ export class WAStartupService {
18461847
);
18471848
}
18481849

1850+
await this.contactHandle['contacts.upsert'](
1851+
contacts
1852+
.filter((c) => !!c.notify ?? !!c.name)
1853+
.map((c) => ({
1854+
id: c.id,
1855+
name: c.name ?? c.notify,
1856+
})),
1857+
database,
1858+
);
1859+
1860+
contacts = undefined;
18491861
messages = undefined;
18501862
chats = undefined;
18511863
} catch (error) {

0 commit comments

Comments
 (0)