# useAblyMessages Subscribe to the raw `Ably.InboundMessage` stream from the transport's tree. Messages are appended in arrival order. Use when you need to inspect channel-level metadata (serials, raw headers) that the codec layer would otherwise hide. Most applications should use [`useView`](https://ably.com/docs/ai-transport/api/react/use-view.md) instead, which returns decoded domain messages. This hook must be used within a [`TransportProvider`](https://ably.com/docs/ai-transport/api/react/providers.md#TransportProvider) or a [`ChatTransportProvider`](https://ably.com/docs/ai-transport/api/react/providers.md#ChatTransportProvider). #### React ``` import { useAblyMessages } from '@ably/ai-transport/react'; function RawLog() { const messages = useAblyMessages(); return
{messages.map((m) => `${m.serial} ${m.name}`).join('\n')}
; } ```
## Parameters | Prop | Required | Description | Type | | --- | --- | --- | --- | | transport | Optional | Transport to subscribe to. Defaults to the nearest provider when omitted. | `ClientTransport` | | skip | Optional | When `true`, skip all subscriptions and return an empty array. | Boolean |
## Returns `Ably.InboundMessage[]` The accumulated raw Ably messages in chronological order. The array grows as messages arrive. ## Example ```react import { useAblyMessages } from '@ably/ai-transport/react'; function ChannelTrace() { const raw = useAblyMessages(); return ( ); } ``` ## Related Topics - [Providers](https://ably.com/docs/ai-transport/api/react/providers.md): TransportProvider and ChatTransportProvider for the AI Transport React integration. - [useClientTransport](https://ably.com/docs/ai-transport/api/react/use-client-transport.md): Read a ClientTransport from the nearest TransportProvider in the AI Transport React integration. - [useView](https://ably.com/docs/ai-transport/api/react/use-view.md): Subscribe to a paginated, branch-aware view of the AI Transport conversation tree from React. - [useCreateView](https://ably.com/docs/ai-transport/api/react/use-create-view.md): Create an independent View over the AI Transport conversation tree from React, with its own branch selections and pagination. - [useTree](https://ably.com/docs/ai-transport/api/react/use-tree.md): Stable structural query callbacks for the AI Transport conversation tree from React. - [useActiveTurns](https://ably.com/docs/ai-transport/api/react/use-active-turns.md): Subscribe to active turns on the AI Transport channel from React. - [useChatTransport](https://ably.com/docs/ai-transport/api/react/use-chat-transport.md): Read a ChatTransport and its underlying ClientTransport from the nearest ChatTransportProvider in AI Transport. - [useMessageSync](https://ably.com/docs/ai-transport/api/react/use-message-sync.md): Wire AI Transport message updates into Vercel useChat's message state from React. ## Documentation Index To discover additional Ably documentation: 1. Fetch [llms.txt](https://ably.com/llms.txt) for the canonical list of available pages. 2. Identify relevant URLs from that index. 3. Fetch target pages as needed. Avoid using assumed or outdated documentation paths.