Skip to content

Sync conversations and messages

🎥 walkthrough: Syncing

This video provides a walkthrough of key concepts required to implement syncing correctly.

Sync a specific conversation

Get all new messages and group updates (name, description, etc.) for a specific conversation from the network.

Browser
await client.conversation.sync();

Sync new conversations

Get any new group chat or DM conversations from the network.

Browser
await client.conversations.sync();

Sync new welcomes, conversations with unread messages, and preferences

Use syncAll to sync the following from the network:

We recommend syncing messages for allowed conversations only. This ensures that spammy conversations with a consent state of unknown don't take up networking resources. This also ensures that unwanted spam messages aren't stored in the user's local database.

To sync conversations regardless of consent state, pass [ALLOWED, UNKNOWN, DENIED].

To sync preferences only, you can call preferences.sync. Note that preferences.sync will also sync welcomes to ensure that you have all potential new installations before syncing.

The method returns a summary that includes the total number of conversations and the number of conversations that were actually synced.

Browser
await client.conversations.syncAll(['allowed']);