AI Integration Quick Reference
AI Integration Quick Reference
Overview
CometChatCardBubble renders a card message — a message with category: "card". A card message carries a block of Card Schema JSON that is created and sent server-side (via the Platform (REST) API or the Dashboard Bubble Builder) and delivered to clients like any other message. Card messages are receive-only: the UI Kit renders them, it does not send them.
The bubble is render-only, mirroring CometChatTextBubble: the kit performs zero transformation. It stringifies the raw payload from message.getCard() and hands it to the prebuilt CometChatCardView renderer (@cometchat/cards-react), then forwards user actions back to your app. It never parses or mutates the card body, and never performs an action itself — your app owns all action behavior (opening URLs, navigating to chats, API calls, etc.).
In the message list, card messages are routed to this bubble automatically by the built-in Card plugin — no configuration is required. See Plugins → Built-in Plugins.
Where cards fit in the message hierarchy
card is a top-level message category, alongside message, custom, action, and call.
Usage
Card messages render automatically insideCometChatMessageList. To render one directly — for example in a custom layout — pass the SDK CardMessage to the bubble:
onCardAction callback:
Props
message
The developer card message (category: "card"). The bubble reads the raw card payload from message.getCard(). Required.
themeMode
Theme mode forwarded to theCometChatCardView renderer.
themeOverride
Optional theme overrides forwarded to the renderer.onCardAction
Direct callback for card actions. Fired in addition to theui:card/action UI event, so an app embedding the bubble directly can receive actions without subscribing to the event bus. Receives the message and the clicked action.
Card Actions
When a user clicks an action inside a card (a button, link, etc.), the bubble forwards the raw action to your app through two channels — it never handles the action itself:- The optional
onCardActionprop, when provided. - The
ui:card/actionUI event, published on the event bus with themessageand the clickedaction. This is the only channel that can reach a card rendered by the kit (e.g. a nested agent card) where no prop is reachable.
Fallback
Whenmessage.getCard() is absent or empty, the renderer is not invoked. Instead the bubble renders a plain-text fallback, resolving the first available of:
message.getFallbackText()message.getText()- The localized
"Card Message"string
CSS Selectors
The card body itself is styled by the
CometChatCardView renderer; use themeMode / themeOverride to theme it.
Next Steps
Plugins
How the Card plugin routes card messages to this bubble
Event System
Subscribe to the ui:card/action event
Message Bubble
The wrapper that hosts bubble content
Theming
Customize colors, fonts, and spacing