> ## Documentation Index
> Fetch the complete documentation index at: https://baileys.wiki/llms.txt
> Use this file to discover all available pages before exploring further.

# Histórico

> Receba conversas e contatos anteriores, e puxe mais histórico sob demanda.

Após conectar, o socket baixa e processa seus chats, contatos e mensagens existentes via `messaging-history.set`.

## Tratando o payload

```ts theme={null}
sock.ev.on('messaging-history.set', ({
  chats: newChats,
  contacts: newContacts,
  messages: newMessages,
  syncType,
}) => {
  // Persista no seu store
})
```

## Pedir histórico completo

```ts theme={null}
import makeWASocket, { Browsers } from '@whiskeysockets/baileys'

const sock = makeWASocket({
  browser: Browsers.macOS('Desktop'),
  syncFullHistory: true,
})
```

<Note>
  Sincronização completa aumenta tempo de inicialização e memória em contas grandes.
</Note>

## Desabilitar sincronização

```ts theme={null}
const sock = makeWASocket({
  shouldSyncHistoryMessage: () => false,
})
```

## Sincronização sob demanda

```ts theme={null}
await sock.fetchMessageHistory(/* count, oldestMsgKey, oldestMsgTimestamp */)
```
