TinyURL

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

TinyURL helps you convert your long website links into short, manageable URLs that are reliable, secure and never expire.

Before you begin:

  1. Sign up at TinyURL
  2. Once you have logged in, click on Account in the top right corner.
  3. In the left navigation pane, select API.
  4. Create an API Token by giving it a name and permission to Create TinyURL.
  5. Make note of the API Token as it will be required in Extension's settings.

Settings

  1. Login to the CometChat Dashboard.
  2. Select one of your apps.
  3. On the Extensions page, enable TinyURL.
  4. Click on the settings button and enter your TinyURL API token.
  5. If you have chosen a paid plan, you can also save your BYO Domain or Subdomain registered with TinyURL. By default, it will be set to tiny.one.
  6. Save your settings once done.

How does it work?

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

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

body.put("text", "Your message with URL https://yourdomain.com/very/very/long/url");

CometChat.callExtension("url-shortener-tinyurl", "POST", URL, body,
new CometChat.CallbackListener < JSONObject > () {
    @Override
    public void onSuccess(JSONObject jsonObject) {
        // minifiedText from the extension
    }
    @Override
    public void onError(CometChatException e) {
        // Some error occured
    }
});
CometChat.callExtension(slug: "url-shortener-tinyurl", type: .post, endPoint: "/v1/shorten", body: ["text": "Your message with URL https://yourdomain.com/very/very/long/url"], onSuccess: { (response) in
        // minifiedText from the extension
      }) { (error) in
        // Some error occured
      }
    }

Did this page help you?