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

# onMessages()

> **onMessages**(`listener`): () => `void`

Subscribe to conversation updates from the actor's `MessageLog`. A
`snapshot` replaces the local log; `appended` adds the new messages. Returns
an unsubscribe function.

**Parameters**

| Parameter | Type |
| - | - |
| `listener` | (`u`) => `void` |

**Returns**

() => `void`

## The Message Stream

Each item is one of the agent's [stored messages](/docs/agent-sdk/interface/messages#storedmessage). The client types the items `unknown`. Every message the agent adds to [`this.messages`](/docs/agent-sdk/interface/messages) arrives in `appended`.

A listener added after the first snapshot is called at once with the current log, as a `snapshot`.
