You can use Exotel's SMS API to shorten a long URL in SMS and you can track customer's click data as well. Shortening a long URL will also reduce the number of characters in SMS and allow you to stick to the 160 characters limit for SMS. Follow steps below to set it up:
1. Get in touch with your Account Manager or drop an email to "[email protected]" to enable URL shortening services for your account
2. While making the API Request to send SMS, make below changes to your SMS request -
Set Parameter "ShortenUrl" - 'true' if you want to shorten a URL, To provide flexibility, we allow you to set it to 'false' as well don't want to shorten any particular SMS.
Set Parameter "ShortenUrlParams[CustomDomain] " - with the custom domain you want the short URL to start with. If custom domain is not present or empty, we will use the default domain(exo.tl), If custom domain is given in the request it will be used to form the short URL . 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
Set Parameter "ShortenUrlParams[Tracking] " - 'true' if you want to track data when a customer clicks on the URL. This feature is currently available to select customers.
In Parameter "ShortenUrlParams[ClickTrackingCallbackUrl]” - enter a valid URL to receive click tracking data
You can also use sample requests available on our developer portal to use the feature and use the sample collection from Postman.
3 . Below would be the API response , SMS will be delivered with a short URL . eg - https://exo.tl/vhdpzv . The Short URL has a validity of 1 month.
4. Whenever someone clicks on the shortened URL, the following data would appear in the URL provided in "ShortenUrlParams[ClickTrackingCallbackUrl] -
- 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 URL is being tracked or not
- Custom_field - custom field passed in SMS 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
- Country_code - Country code of the customer who received the SMS
- Date_created - Date Time in ISO format when link was created
- Sms_sid - The Sid (unique id) of the SMS, this SID can be used to track the SMS
- To - Contact number of the customer who clicked on the URL
- 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 - Aproximate 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 - Device name of the customer who clicked the shorten URL
- Platform_type - Platform where shorten URL is clicked
If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888