Skip to main content

URL Shortening & Click Tracking

Shorten URLs in your SMS messages and track click-through analytics.

How It Works​

When you enable URL shortening, Exotel replaces long URLs in your SMS body with short links. You can optionally track when recipients click these links.

Parameters​

Add these parameters to any Send SMS request:

ParameterRequiredTypeDescription
ShortenUrlYesBooleantrue to enable URL shortening
ShortenUrlParams[Header]ConditionalStringRequired for India. The DLT-registered header that is part of the whitelisted Shortened URL on the DLT platform. Must exactly match the header registered on DLT to avoid message failure
ShortenUrlParams[CustomDomain]OptionalStringCustom domain to use for short URLs instead of the default exo.tl. If absent or empty, exo.tl is used. Note: you must route traffic from your custom domain to exo.tl in your DNS settings
ShortenUrlParams[Tracking]OptionalBooleantrue to enable click tracking. ShortenUrl must also be true
ShortenUrlParams[ClickTrackingCallbackUrl]OptionalStringWebhook URL to receive click events when a recipient clicks the shortened URL
ShortenUrlParams[TimeToExpiry]OptionalIntegerDuration in minutes after which the short URL expires. Minimum: 1 minute. Default: 31 days. Maximum: 365 days

Example Request​

curl -u '<api_key>:<api_token>' -X POST https://api.exotel.com/v1/Accounts/<your_sid>/Sms/send \
-d "From=EXOTEL" \
-d "To=+919876543210" \
-d "Body=Check out our sale: https://shop.example.com/sale/winter-2024?utm_source=sms" \
-d "DltEntityId=1234567890" \
-d "ShortenUrl=true" \
-d "ShortenUrlParams[Header]=EXOTEL" \
-d "ShortenUrlParams[Tracking]=true" \
-d "ShortenUrlParams[ClickTrackingCallbackUrl]=https://your-server.com/sms-clicks" \
-d "ShortenUrlParams[TimeToExpiry]=4320"

The long URL in the Body will be replaced with a short link like https://exo.tl/abc123.

Click Tracking Callback​

When a recipient clicks the shortened link, Exotel sends a POST request to your ClickTrackingCallbackUrl with the following parameters:

FieldDescription
sidUnique ID of the shortened URL
short_urlThe complete shortened URL
short_codeKey (slug) of the shortened URL
long_urlThe original URL that was shortened
TrackingWhether tracking is enabled for this URL
custom_fieldCustom field value passed in the SMS API request
Expires_atDateTime (ISO 8601) when the short link expires
Created_timeDateTime (ISO 8601) when the URL was created
Last_viewedDateTime (ISO 8601) when the link was last visited
Total_clicksTotal number of times the short URL has been clicked
Account_sidExotel Account SID
Country_codeCountry code of the SMS recipient
Date_createdDateTime (ISO 8601) when the URL was created
Sms_sidUnique ID of the SMS message, for cross-referencing
ToPhone number of the recipient who clicked the link
cityCity where the link was clicked
CountryCountry where the link was clicked
IPIP address of the click
Postal_codePostal code of the click location
RegionRegion where the link was clicked
Accuracy_radiusApproximate accuracy radius of the geolocation
OS_versionOS version of the device that clicked the link
OS_nameOS name of the device
Device_nameDevice name of the clicker
Platform_typePlatform type (mobile, desktop, etc.)

Best Practices​

  • Set TimeToExpiry to match your campaign duration — expired links show a generic page
  • Use click tracking to measure SMS campaign effectiveness
  • The DLT-registered header in ShortenUrlParams[Header] must match your approved sender ID
  • Short URLs count toward the 2000-character Body limit but are significantly shorter than the original

Try It​