Quick Reference for AI Agents & Developers
- Send text:
CometChat.sendTextMessage(message:onSuccess:onError:) - Send media:
CometChat.sendMediaMessage(message:onSuccess:onError:) - Receive messages:
CometChat.addMessageListener("UNIQUE_ID", self) - Fetch history:
MessagesRequest.MessageRequestBuilder().build()→messagesRequest.fetchPrevious(onSuccess:onError:) - Message types:
TextMessage,MediaMessage,CustomMessage,InteractiveMessage(all extendBaseMessage) - Related: Send Message · Receive Message · Typing Indicators
Message Data Models
All message types in CometChat inherit from theBaseMessage class. Understanding these data models is essential for working with messages.
BaseMessage Properties
TheBaseMessage class contains properties common to all message types:
TextMessage
ExtendsBaseMessage with:
MediaMessage
ExtendsBaseMessage with:
CustomMessage
ExtendsBaseMessage with:
Attachment
Success & Failure Responses
Send Message Success
When a message is sent successfully, you receive the complete message object with server-assigned properties:- Swift