> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Interactive Message

> Custom Interactive Message — CometChat documentation.

The `CustomInteractiveMessage` class is used to create an interactive message that can be sent via CometChat. It extends the `InteractiveMessage` class from CometChat.

### Constructor

| Name         | Type       | Description                                          |
| ------------ | ---------- | ---------------------------------------------------- |
| receiverId   | string     | The ID of the receiver                               |
| receiverType | string     | The type of the receiver                             |
| jsonObject   | JSONObject | This parameter takes json object for interactiveData |

### Class Usage

How to create an instance of the `CustomInteractiveMessage` class:

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    JSONObject jsonObject = new JSONObject();
     try {
       jsonObject.put("text", "custom Interactive message");
     } catch (JSONException e) {
       throw new RuntimeException(e);
     }

    CustomInteractiveMessage customInteractiveMessage = new CustomInteractiveMessage(receiverId,receiverType, jsonObject); //receiverType could be user/group
    ```
  </Tab>
</Tabs>

### Send Custom Interactive Message

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    customInteractiveMessage.setSender(CometChatUIKit.getLoggedInUser());
    customInteractiveMessage.setReceiver(user); // set Receiver user/group object

    CometChatUIKit.sendCustomInteractiveMessage(customInteractiveMessage, false, new CometChat.CallbackListener<CustomInteractiveMessage>() {
              @Override
              public void onSuccess(CustomInteractiveMessage customInteractiveMessage) {

               }
              @Override
              public void onError(CometChatException e) {
                    e.printStackTrace();
              }
        });
    ```
  </Tab>
</Tabs>
