You can use Exotel's Compactix API to shorten a long URL and track customers' click data as well. Shortening a long URL will also reduce the number of characters and create your own short links in. Follow the steps below to set it up:
1. Use default keys and tokens available in your account to use this API. Get in touch with your Account Manager or drop an email to "hello@exotel.com" if you face any issues.
2. You can use the API with the following request parameters -
Set Parameter "long_url" with the long URL you want to shorten a URL.
Set Parameter "expire_in" with the duration(seconds) after which the short URL becomes invalid. Minimum is 60 seconds and the default is 31 days. max. value is 365 days
Set Parameter “tracking” to Whether to track the URLs present in the SMS. Can be: "true" or "false". "ShortenUrl" needs to be "true" for Tracking to work.
Set Parameter “callback_url” with the URL where you want to receive the tracking details. Once someone clicks on the shortened URL, Exotel will do a POST callback to your endpoint if the URL is set as a parameter in the API.
sid - The Sid (unique id) of the shortened URL
Short_url - The complete shortened URL
Short_code - Key of the shortened URL
Long_url - Original URL which is shortened
Tracking - Whether the short URL is being tracked or not
Custom_field - custom field passed in API request
Expires_at - Date Time in ISO format when link will expire
Created_time - Date Time in ISO format when URL is created
Last_viewed - Date Time in ISO format when link was visited last
Total_clicks - count of total views of short url
Account_sid - Exotel’s unique Account SID
Date_created - Date Time in ISO format when link was created
City - City where the shorten URL is clicked
Country - Country code where shorten URL is clicked
IP - IP address where shorten URL is clicked
Postal_code - Postal code where shorten URL is clicked
Region - Region where shorten URL is clicked
Accuracy_radius - Approximate accuracy radius where shorten URL is clicked
OS_version - OS version of the customer who clicked the shorten URL
OS_name - OS name of the customer who clicked the shorten URL
Device_name - The device name of the customer who clicked the shorten URL
Platform_type - Platform where shorten URL is clicked
Below is an example of a callback with the parameters-
Set Parameter “custom_field” to a Custom Field relevant to your use case while sending a long URL. E.g Order ID, Payment ID, Login Attempt etc. Any content / json body upto 1024 chars
Set Parameter “custom_domain” to the custom domain you can specify.Whether you want the short URL to start with the default domain- exo.tl or you want to provide a custom domain of your own choice.
Note: Clients will have to route the traffic on their custom domain to exo.tl domain, this is a change on your domain management system
On successful execution of the API, you will be given a short URL in response that can be used by you. Read more about the API response on Exotel Developer Portal
If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888