Skip to main content
This page contains React Native SDK code examples for User Engagement extensions. For feature documentation, setup instructions, and extension settings, see User Engagement 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

Configure settings (if required)

Some extensions require API keys or additional configuration. Open the extension settings in the Dashboard.
3

Implement SDK methods

Use the code examples below to call extension APIs and extract extension data from messages.
4

Build your UI

Create UI components to display extension data (e.g., polls, stickers, GIFs).

Giphy

Add GIFs from Giphy to your conversations.
const URL = "v1/trending?offset=1&limit=15";
CometChat.callExtension("gifs-giphy", "GET", URL, null)
  .then((response) => {
    // GIFs data from Giphy
  })
  .catch((error) => {
    // Error occured
  });

Search for GIFs

const URL = "v1/search?offset=1&limit=15&query=awesome";
CometChat.callExtension("gifs-giphy", "GET", URL, null)
  .then((response) => {
    // GIFs data from Giphy
  })
  .catch((error) => {
    // Error occured
  });

Message Translation

Translate messages into 70+ languages.

Translate Message

CometChat.callExtension('message-translation', 'POST', 'v2/translate', {
  msgId: 12,
  text: "Hey there! How are you?",
  languages: ["ru", "hi", "mr"]
})
  .then(result => {
    // Result of translations
  })
  .catch(error => {
    // Some error occured
  });

Polls

Create and vote on polls in conversations.

Creating a Poll

CometChat.callExtension('polls', 'POST', 'v2/create', {
  question: "Which OS do you use?",
  options: ["Windows", "Ubuntu", "MacOS", "Other"],
  receiver: "cometchat-uid-1",
  receiverType: "user"
})
  .then(response => {
    // Details about the created poll
  })
  .catch(error => {
    // Error occured
  });

Voting in a Poll

CometChat.callExtension('polls', 'POST', 'v2/vote', {
  vote: "3",
  id: "d5441d53-c191-4696-9e92-e4d79da7463",
})
  .then(response => {
    // Successfully voted
  })
  .catch(error => {
    // Error Occured
  });

Getting Results

CometChat.callExtension('polls', 'GET', 'v2/results?id=' + POLL_ID, null)
  .then(results => {
    // Poll results
  })
  .catch(error => {
    // Some error occured
  });

Reminders

Set reminders for messages or custom events.

Set Message Reminders

CometChat.callExtension('reminders', 'POST', 'v1/reminder', {
  about: 1,
  isCustom: false,
  timeInMS: 1638351344989
})
  .then(response => {
    // Reminder created successfully
  })
  .catch(error => {
    // Some error occured
  });

Set Personal Reminders

CometChat.callExtension('reminders', 'POST', 'v1/reminder', {
  about: "Drinking water",
  isCustom: true,
  timeInMS: 1638351344989
})
  .then(response => {
    // Reminder created successfully
  })
  .catch(error => {
    // Some error occured
  });

List Reminders

CometChat.callExtension('reminders', 'GET', 'v1/fetch', null)
  .then(response => {
    // reminders array
  })
  .catch(error => {
    // Some error occured
  });

Delete Reminders

CometChat.callExtension('reminders', 'DELETE', 'v1/reminder', {
  reminderId: "e9cda52a-3839-4fd5-a010-b70db136f0f1"
})
  .then(response => {
    // Reminder deleted successfully
  })
  .catch(error => {
    // Some error occured
  });

Stickers

Load and send stickers in conversations.

Loading Stickers

CometChat.callExtension('stickers', 'GET', 'v1/fetch', null)
  .then(stickers => {
    // Stickers received
  })
  .catch(error => {
    // Some error occured
  });

Stipop

Access Stipop’s sticker platform.
const qs = `?lang=${lang}&limit=${limit}&pageNumber=${pageNumber}&countryCode=${countryCode}`;

CometChat.callExtension('stickers-stipop', 'GET', 'v1/trending' + qs, null)
  .then(response => {
    // Stickers in response
  })
  .catch(error => {
    // Error occured
  });

Search for Stickers

const qs = `?lang=${lang}&limit=${limit}&pageNumber=${pageNumber}&query=${query}`;

CometChat.callExtension('stickers-stipop', 'GET', 'v1/search' + qs, null)
  .then(response => {
    // Stickers in response
  })
  .catch(error => {
    // Error occured
  });

Tenor

Add GIFs from Tenor to your conversations.
const URL = "v1/trending?offset=1&limit=15";
CometChat.callExtension("gifs-tenor", "GET", URL, null)
  .then((response) => {
    // GIFs data from Tenor
  })
  .catch((error) => {
    // Error occured
  });

Search for GIFs

const URL = "v1/search?offset=1&limit=15&query=awesome";
CometChat.callExtension("gifs-tenor", "GET", URL, null)
  .then((response) => {
    // GIFs data from tenor
  })
  .catch((error) => {
    // Error occured
  });