AI Integration Quick Reference
AI Integration Quick Reference
Message categories and types:
- message →
text,image,video,audio,file - custom → Developer-defined types (e.g.,
location,poll) - card →
CardMessage(receive-only rich cards) - action →
groupMember(joined/left/kicked/banned),message(edited/deleted) - call →
audio,video
message, custom, card, action, call) and has a specific type within that category.
Message Hierarchy
Categories Overview
| Category | Types | Description |
|---|---|---|
message | text, image, video, audio, file | Standard user messages |
custom | Developer-defined | Custom data (location, polls, etc.) |
card | CardMessage | Receive-only rich, structured cards |
action | groupMember, message | System-generated events |
call | audio, video | Call-related messages |
Checking Message Category and Type
UsegetCategory() and getType() to determine how to handle a received message:
- TypeScript
- JavaScript
Standard Messages (message Category)
Messages with category message are standard user-sent messages:
| Type | Description |
|---|---|
text | Plain text message |
image | Image attachment |
video | Video attachment |
audio | Audio attachment |
file | File attachment |
Custom Messages (custom Category)
Custom messages allow you to send data that doesn’t fit the default categories. You define your own type to identify the message (e.g., location, poll, sticker).
Card Messages (card Category)
A message with category card is a CardMessage — a rich, structured card rendered from Card Schema JSON.
Card messages are receive-only: they cannot be sent from the SDK. They are created and sent exclusively via the Platform (REST) API or the Dashboard Bubble Builder, and delivered through the onCardMessageReceived callback of the MessageListener.
| Method | Return Type | Description |
|---|---|---|
getCard() | object | The raw Card Schema JSON payload. Pass it to the CometChatCardView renderer. |
getText() | string | Preview text for notifications and the conversation list. |
getFallbackText() | string | Fallback text used for accessibility or when the renderer fails. |
getTags() | Array<string> | Tags associated with the message. |
Action Messages (action Category)
Action messages are system-generated events. They have a type and an action property:
Type: groupMember — Actions on group members:
joined— Member joined the groupleft— Member left the groupkicked— Member was kickedbanned— Member was bannedunbanned— Member was unbannedadded— Member was addedscopeChanged— Member’s scope was changed
message — Actions on messages:
edited— Message was editeddeleted— Message was deleted
Call Messages (call Category)
Call messages track call events with types audio or video. The status property indicates the call state:
| Status | Description |
|---|---|
initiated | Call started |
ongoing | Call accepted and in progress |
canceled | Caller canceled |
rejected | Receiver rejected |
unanswered | No answer |
busy | Receiver on another call |
ended | Call completed |
Next Steps
Send Messages
Send text, media, and custom messages
Receive Messages
Listen for incoming messages in real time
Card Messages
Receive and render rich, structured card messages
Message Filtering
Advanced message filtering with RequestBuilder