Creating a Txtly

Txtly is basically a shortened URL which can be used in text messages so that SMS would not exceed the characters. API to create a Txtly link is as follows:

curl -X POST \
'<BASE_URL>&method=txtly.create&url=&token=xyz&title=xyz&advanced=1'

NOTE: It is mandatory to either provide a URL or attachment that has to be compressed to a short link.

API Parameter Specifications

The API parameter specifications are described in the following sections.

Mandatory Parameters

The mandatory parameters in the HTTP API are tabulated below:

Parameter Description Expected Values
URL URL of your SMS Service URL
method Predefined method txtly.create
url URL that requires to be shortened and tracked Long URL (url_encoded)

Optional Parameters

The Optional parameters in the HTTP API are tabulated below:

Parameter Description Expected Values
Format Output format should be as specified by this variable XML/PHP/JSON/JSONP. Default response will be in JSON
Token http://msg.mn/heel Here heel is the token. It is unique for each txtly This can customized word representing your brand/compnay. If not provided a random unique token is generated
Title A significant title to your txtly If not provided, your txtly will not contain any title
Advanced advanced analytics gives an option to track who (Recipient mobile numbers) visited the page 1- will enable advanced analytics/0(default) - will disable advanced analytics
Track Location Track gives the city and state details of URL visitor 1- will enable location tracking/0(default) - will disable location tracking
Attach media file that requires to be compressed to a short link. Provide the media file in a CURL request
callback callback URL along with parameters to extract customer device/IP details http://TestDomain.com/TestFile.php?os={platform}&mobile={mobile} For raw response data format. If you want to get response in JSON format, then use (json) tag before callback URL. For eg. (json)http://TestDomain.com/TestFile.php?os={platform}&mobile={mobile}

Callback Parameters to be used in URL

Replaceable Parameter Description Example
client_ip IP from which the URL was accessed 156.151.23.65
host Domain name of the URL Example.com
query_string Query string of the URL http://example.com/over/there?name=ferret
user_agent User agent used by the URL Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10
browser Browser in which the URL was accessed msie
browser_version Version of the browser in which the URL was accessed 11.0
browser_lang Language of the operating system in which the URL was accessed English
browser_engine Browser engine in which the URL was accessed Trident
resolution Resolution with which the URL was accessed 1024*768
platform Operating system of the device in which the URL was accessed Android OS
platform_version Version of the operating system of the device in which the URL was accessed 5.0
device_type Type of device in which the URL was accessed phone
device_brand Brand of the device in which the URL was accessed Motorola
device_version Version number of the device in which the URL was accessed XT1068
device_model Model name of the device in which the URL was accessed HTC Dream
touch_enabled If or not the device from where the URL was accessed is touch enabled or not yes
latitude Latitude coordinates from where the URL was accessed 12.9667° N
longitude Longitude coordinates from where the URL was accessed 77.5667° E
country Country from where the URL was accessed India
region State from where the URL was accessed Karnataka
city City from where the URL was accessed Bangalore
created requested time in unixtimestamp 1426243175
mobile Short URL recepient mobile number 9999999999
os_code code of the OS from where the URL was accessed (AN) for Android

Example Responses

JSON

{
    "status": "OK",
    "message": "Details saved Successfully",
    "token": "5yx1",
    "id":"33527",
    "txtly": "http://msg.mn/bKX6yf" 
}

Error Response

{
    "status": "E500",
    "message": "Please provide url to redirect"
}

Response Data

Field Description
status It indicates the success or failure of your request.
message It indicates the success or failure message.
token Returns the unique token of that txtly
txtly compressed url that is ready to use
id ID of the txtly created

Expected Error Codes

Code Description
E500 Please provide url to redirect
E501 Txtly Already Exists. Please try another one.
E502 Please attach a file
E503 Invalid file format. Upload valid file.
E504 File size exceed. Maxmium 50000 Kb.
E505 File upload failed. Please try again.