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.
AI Integration Quick Reference
AI Integration Quick Reference
set(uid:), set(guid:), set(limit:), set(categories:), set(types:), setTags(_:), set(unread:), setParentMessageId(parentMessageId:), set(messageID:), set(timeStamp:), hideReplies(hide:), hideDeletedMessages(hide:)MessagesRequest class fetches messages based on various parameters. It uses the Builder design pattern via MessagesRequestBuilder.
| Method | Description |
|---|---|
fetchNext() | Returns messages after the specified parameters |
fetchPrevious() | Returns messages before the specified parameters |
fetchPrevious()/fetchNext() repeatedly on the same object to get subsequent pages.
Both methods return an array of BaseMessage objects. Each message may be a TextMessage, MediaMessage, CustomMessage, Action, or Call. Use type checking to determine the specific type.
Number of messages fetched
Set the number of messages to fetch per request usingsetLimit(). Maximum is 100.
Messages for a user conversation
Useset(uid:) to fetch messages between the logged-in user and a specific user.
Messages for a group conversation
Useset(guid:) to fetch messages from a group.
If neither
set(uid:) nor set(guid:) is used, all messages for the logged-in user will be fetched across all conversations.Messages before/after a message
Useset(messageID:) to fetch messages before or after a specific message ID. Use fetchNext() to get messages after, or fetchPrevious() to get messages before.
Messages before/after a given time
Useset(timeStamp:) with a Unix timestamp to fetch messages before or after a specific time.
Unread messages
Useset(unread:) to fetch only unread messages.
Messages for multiple categories
Useset(categories:) with an array of category names. See Message structure and hierarchy for available categories.
Messages for multiple types
Useset(types:) with an array of type names.
Messages by tags
UsesetTags() with an array of tag names to fetch only messages with those tags.
Next Steps
Receive Messages
Listen for incoming messages in real-time
Threaded Messages
Organize conversations with message threads
Message Structure
Understand message categories and types