Skip to main content
This page contains React Native SDK code examples for Security extensions. For feature documentation, setup instructions, and extension settings, see Security Extensions.

How to Use Extensions with SDK

1

Enable in Dashboard

Login to CometChat Dashboard, select your app, then go to Chat & Messaging → Features and enable the extension.
2

Implement SDK methods

Use the code examples below to schedule messages for automatic deletion.
3

Build your UI

Update your UI to indicate which messages will disappear and when.

Disappearing Messages

Send messages that automatically disappear after a specified time interval.

Schedule Message for Deletion

CometChat.sendMessage(textMessage) // Can be any type of message
  .then(message => {
    CometChat.callExtension('disappearing-messages', 'DELETE', 'v1/disappear', {
      msgId: message.getId(), // The id of the message that was just sent
      timeInMS: 1633521809051 // Time in milliseconds. Should be a time from the future.
    }).then(response => {
      // Successfully scheduled for deletion
    });
  
    // Logic to display the sent message on the screen.
    // ...
  }).catch(error => {
    // Error occured
  });