There are two ways to get messages in the CometChat Unreal SDK:Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Fetch history — pull previous messages for a conversation using async nodes
- Real-time push — listen for new messages as they arrive via the
OnMessageReceiveddelegate
How Messages Flow
Fetch User Messages
Retrieve the message history for a 1:1 conversation.- Blueprint
- C++
Call the Get Messages Async node.
On Success returns a
| Parameter | Type | Description |
|---|---|---|
| Uid | FString | The UID of the other user in the conversation |
| Limit | int32 | Maximum number of messages to return (default: 50) |
TArray<FCometChatMessage> — an array of messages sorted by timestamp.Fetch Group Messages
Retrieve the message history for a group conversation, with pagination support.- Blueprint
- C++
Call the Get Group Messages Async node.
On Success returns two outputs:
| Parameter | Type | Description |
|---|---|---|
| Guid | FString | The group’s unique identifier |
| Limit | int32 | Maximum messages per page (default: 50) |
| Before Message Id | int32 | Pass 0 for the first page. For subsequent pages, pass the NextCursor value from the previous response’s FCometChatPagination. |
TArray<FCometChatMessage>— the messages for this pageFCometChatPagination— pagination metadata includingHasMoreandNextCursor
Pagination
TheFCometChatPagination struct tells you where you are in the message history:
| Property | Type | Description |
|---|---|---|
Total | int32 | Total messages available in the conversation |
Count | int32 | Messages returned in this page |
PerPage | int32 | Page size that was requested |
HasMore | bool | true if there are older messages to fetch |
NextCursor | int32 | Pass this as BeforeMessageId to get the next page |
Real-Time: Incoming Messages
To receive messages as they arrive (without polling), bind to theOnMessageReceived delegate on the Subsystem.
- Blueprint
- C++
- Get a reference to the CometChat Subsystem
- Drag off and search for On Message Received
- Use Bind Event to connect it to a custom event
- The custom event receives an
FCometChatMessageparameter
The
OnMessageReceived delegate fires for all conversations — both 1:1 and group. Use ReceiverType to distinguish between them, and ConversationId to route messages to the right chat window.Next Steps
Users
Fetch user profiles and track presence.
Groups
Create, join, and leave groups.
Real-Time Events
All five real-time delegates explained in detail.