Skip to main content

Bitly

Learn how to minify the long website links in your text messages using Bitly.

Before you begin

  1. Sign up with Bitly.
  2. Once you have logged in, click on the Account name displayed in the top right corner.
  3. Click on Settings and in the left navigation pane, select API.
  4. Click on Generate Token to create a new Access Token.
  5. Using the above Access Token, fetch the GUID for your group using their Get Groups API.
  6. The Access Token and Bitly Group's GUID are required in extension settings.

Extension settings

  1. Login to CometChat and select your app.
  2. Go to the Extensions section and enable the Bitly extension.
  3. Open the settings for this extension.
  4. Enter your Bitly Access Token and Group's GUID.
  5. Save your settings.

How does it work?

This extension uses the callExtension method provided by the CometChat SDK. You can call the extension as follows:

CometChat.callExtension("url-shortener-bitly", "POST", "v1/shorten", {
text: "Your message with URL https://yourdomain.com/very/very/long/url",
})
.then((response) => {
// minifiedText in response
})
.catch((error) => {
// Error occured
});