Skip to main content
Let users save important messages and revisit them later.

Extension settings

1

Open your CometChat app

Login to CometChat and select your app.
2

Enable Save Message

Go to Chat & Messaging —> Features, under Extentions and enable Save Message.

How does it work?

Save message extension provides you the ability to:
  • Save messages: Allow users to save messages for later.
  • Unsave messages: Remove saved messages when no longer needed.
  • Fetch saved messages: Retrieve all saved messages for a user.
Saved messages are private and visible only to the user who saved them.

Choose Your Integration Method

Choose the integration method that best suits your needs:

UI Kit Builder

  • Enable it in both Dashboard and UI Kit Builder settings, then you can use the Message Shortcuts extension in your custom chat experience.

Widget Builder

  • Enable it in both Dashboard and Widget Builder settings, then you can use the Message Shortcuts extension in your custom chat widget.

UI Kits

  • Enable it in the Dashboard settings, then you can use the Message Shortcuts extension in your custom chat experience built with our UI Kits.

SDK

  • Enable it in the Dashboard settings, then you can use the Message Shortcuts extension in your custom chat experience built with our SDK.

Code

1. Save a message

To save a message, use the callExtension method provided by the SDK to make an HTTP POST request with the parameters as shown below. You need to pass the msgId of the message that has to be saved.
CometChat.callExtension('save-message', 'POST', 'v1/save', {
    "msgId": 111
}).then(response => {
    // { success: true }
})
.catch(error => {
    // Error occured
});

2. Unsave a message

To unsave a message, use the callExtension method provided by the SDK to make an HTTP DELETE request with the parameters as shown below. You need to pass the msgId of the message that needs to be unsaved.
CometChat.callExtension('save-message', 'DELETE', 'v1/unsave', {
    "msgId": 111
}).then(response => {
    // { success: true }
})
.catch(error => {
    // Error occured
});

3. Fetch saved messages

To fetch the saved messages for a user, use the callExtension method provided by the SDK to make an HTTP GET request with the query parameters as shown below.
const URL = `v1/fetch`;
CometChat.callExtension('save-message', 'GET', URL, null).then(response => {
    // {savedMessages: []}
})
.catch(error => {
    // Error occured
});