Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/pages/inboxes/sync-and-syncall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,32 @@ client.conversations.syncAllConversations(consentState = listOf(ConsentState.ALL
try await client.conversations.syncAllConversations(consentState: [.allowed])
```

:::

### Sync a limited number of messages per conversation

To protect from spam, you can sync just the first few messages of new conversations. For example, you can sync all conversations with an `unknown` consent state, but limit it to the first 5 messages per conversation.

:::code-group

```js [Browser]
await client.conversations.syncAll({ consentState: ["unknown"], numMessages: 5 });
```

```js [Node]
await client.conversations.syncAll({ consentState: ["unknown"], numMessages: 5 });
```

```tsx [React Native]
await client.conversations.syncAllConversations({ consentState: ["unknown"], numMessages: 5 });
```

```kotlin [Kotlin]
client.conversations.syncAllConversations(consentState = listOf(ConsentState.UNKNOWN), numMessages = 5)
```

```swift [Swift]
try await client.conversations.syncAllConversations(consentState: [.unknown], numMessages: 5)
```

:::