Skip to main content
GIFs are a great way to change the tone or convey emotions in your conversations. Here’s a guide which helps to implement Gifphy in an easy and quick way. Let’s get started!

Before you begin

1

Create a Giphy app

Sign up at Giphy and create a new app.
2

Select API access

Select API and click Next.
3

Save your API key

Enter your app name and description, create the app, then copy the API key.

Extension settings

1

Open your CometChat app

Login to CometChat and select your app.
2

Enable Giphy

Go to Chat & Messaging —> Features, under Extentions and enable Giphy.
3

Add your API key

Open the extension settings, paste your Giphy API key, and save.

How does it work?

This extension uses the callExtension method provided by the CometChat SDK. You can perform the following actions using this method:
  • Get trending GIFs: Fetch a curated list of trending GIFs.
  • Search for GIFs: Search GIFs by keywords and language.
To list and show the most trending GIFs on Giphy, all you have to do is include the following parameters in your request.
keyValueDescription
offsetnumberSince you can get paginated results for trending GIFs, you can provide an offset and fetch results accordingly
limitnumberThe number of trending GIFs that you want to fetch
Once you have set the above parameters, you can make a call to the extension as follows:
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

Apart from listing the trending ones, the extension also allows searching for a particular GIF using the following parameters:
keyvalueDescription
offsetnumberSince you can get paginated results for searches, you can provide an offset and fetch results accordingly.
limitnumberThe number of GIFs that you want to fetch as part of the search.
lang2-letter ISO 639-1 language identifier(Optional) Defaults to en. (Example values: es, fr, it.)
querystringSearch term
Once you have all the above parameters, you can make a call to the extension as follows:
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
  });