Skip to main content
When it connects, the session performs a history sync (backfill), fetching previous chats, contacts and messages. These events reflect that process.
Delivery to the webhook differs considerably from delivery to RabbitMQ for these events. Some history events are suppressed in the webhook to avoid a flood of calls during the backfill, and one of them is converted into another event. Read the details below carefully.

Delivery summary

history.message.upsert and history.message.received

These are the events for the messages fetched by the backfill.
These events are not delivered to the webhook — they are suppressed to avoid a flood of calls during the backfill. They are only available via RabbitMQ (when configured).
The message data follows the same format as messages.received (id, from, to, type, timestamp, etc.), except that it is:
  • without media — media is filtered out during the sync;
  • with normalized JIDs.

history.messages.sent

These are the messages sent from another device identified during the history sync.
In the webhook, this event does not arrive with the name history.messages.sent. Messages sent from another device are only delivered if they are recent (less than 5 minutes old), and they are converted into the messages.received event with fromMe: true.Via RabbitMQ, the event keeps its original name history.messages.sent.
On both channels, data.isMetaAI is always false: history sync does not carry the Meta AI signal.

history_sync

Delivered normally to the webhook. It is the backfill’s completion/summary signal, with the synced aggregates.
array
required
Synced chats. Each item follows the format of chats.update.
array
required
Synced contacts. Each item follows the format of contacts.update.
array
required
Synced messages. Each item follows the history message format.

appstate.agent.update

Delivered to the webhook. Represents changes to linked devices/agents (multi-device) during the AppState sync.
number
Index of the device/agent. Optional.
string
Name of the device/agent. Optional.
string
Device identifier. Optional.
boolean
true when the device/agent was removed. Optional.