Skip to main content
The CardMessage class is used to create a card message for CometChat. It extends the InteractiveMessage class from CometChat.

Constructor

NameTypeDescription
receiverIdstringThe ID of the receiver
receiverTypestringThe type of the receiver
textstringThe text to be displayed on the card
cardActionsButtonElementThe actions to be performed when the card is interacted with

Class Usage

How to create an instance of the CardMessage class:

Key Properties and Methods

Image Url

The setImageUrl() method allows to set the image URL for the card.

Example

Below is an example that showcases the creation and manipulation of an instance of CardMessage:
In this example, a new instance of CardMessage is created. The text, card actions and image URL are retrieved, updated, and retrieved again. Then a new CardMessage instance is made from a JSON object, and the text is retrieved and logged.