For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuidesClick-to-Call
ReferenceGuidesClick-to-Call
  • Core
    • Overview
  • SignalWire Client
    • Overview
    • Notifications
    • Client
    • Utility functions
  • Video
    • Overview
    • LocalOverlay
    • RoomSession
    • RoomSessionDevice
    • RoomSessionPlayback
    • RoomSessionRecording
    • RoomSessionScreenShare
    • RoomSessionStream
    • RoomDevice
    • RoomScreenShare
  • Chat
    • Overview
    • Client
      • Events
        • disconnect
        • getAllowedChannels
        • getMembers
        • getMemberState
        • getMessages
        • off
        • on
        • once
        • publish
        • removeAllListeners
        • setMemberState
        • subscribe
        • unsubscribe
        • updateToken
    • ChatMember
    • ChatMemberEntity
    • ChatMessage
    • ChatMessageEntity
  • PubSub
    • Overview
    • Client
    • PubSubMessage
  • WebRTC
    • Overview
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
ChatClientMethods

getMessages

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

off

Next
Built with
  • getMessages(params): Promise<{ cursor: PagingCursor; messages: ChatMessageEntity[] }>

See PagingCursor documentation and ChatMessageEntity documentation for more details.

Returns the list of messages that were sent to the specified channel.

Parameters

params
objectRequired

Configuration object for getting messages

params.channel
stringRequired

Channel for which to retrieve the messages.

params.cursor
PagingCursor

Cursor for pagination. See PagingCursor for more details.

Returns

Promise<{ cursor: PagingCursor; messages: ChatMessageEntity[] }>

See PagingCursor documentation and ChatMessageEntity documentation for more details.

Example

1const m = await chatClient.getMessages({ channel: "chan1" });
2
3m.messages.length; // 23
4m.messages[0]; // the most recent message
5m.messages[0].member; // the sender
6m.messages[0].content; // the content
7m.messages[0].meta; // the metadata (if any)
8
9m.cursor.next; // if not null, there are more messages.
10
11// Get the next page using the cursor
12const next = await chatClient.getMessages({
13 channel: "chan1",
14 cursor: {
15 after: m.cursor.after,
16 },
17});