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 "firstname.lastname@example.org" 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[Tracking] " - 'true' if you want to track data when a customer clicks on the URL. This feature is currently available to select customers. For early access, please fill this form.
In Parameter "ShortenUrlParams[ClickTrackingCallbackUrl]” - enter a valid URL to receive click tracking data
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
If you require any assistance, please feel free to get in touch with us at "email@example.com" and we would surely assist you.