AI Integration Quick Reference
AI Integration Quick Reference
- Kotlin
- Java
Send Message in a Thread
Any message type (TextMessage, MediaMessage, or CustomMessage) can be sent in a thread. Set the parentMessageId using setParentMessageId() to indicate which thread the message belongs to.
- Java
- Kotlin
setParentMessageId().
Receiving Real-Time Messages
UseMessageListener to receive real-time thread messages. Check if the received message belongs to the active thread using getParentMessageId().
- Java
- Kotlin
Fetch Thread Messages
UseMessagesRequestBuilder with setParentMessageId() to fetch messages belonging to a specific thread. Call fetchPrevious() to get messages (max 100 per request).
- Java
- Kotlin
Avoid Threaded Messages in User/Group Conversations
UsehideReplies(true) to exclude threaded messages when fetching messages for a conversation.
- Java
- Kotlin
cometchat-uid-1 excluding all the threaded messages belonging to the same conversation.
Next Steps
Send Messages
Learn how to send text, media, and custom messages
Receive Messages
Handle real-time message events with listeners
Message Structure
Understand message objects and their properties
Reactions
Add emoji reactions to messages