Documentation

The simple to use SMS API Gateway lets you integrate the power ot Txtlocal in to your web-based application quickly and easily. The following section outlines how to send messages using a variety of programming languages. If you need assistance getting our API to work, we're happy to help.

Sending SMS

To connect to the API, you can POST or GET your query to the URL:
http://www.txtlocal.com/sendsmspost.php

For added security, connect to the API over SSL - replace http with https in the above URL.

You can take a look at some code examples to see the API in action. We have copy&paste examples for PHP, ASP, and many other langugaes to get you started.

info
A flag to switch on/off debug information.
View debug information.
json
If set to 1, this will return 'info' in JSON format.
test
This is the test mode. If test=1 then messages will not be sent and credits will not be deducted.
message
The text message body. This can be up to 612 characters in length. A single message is 160 characters, longer messages are 153 each (2=306,3=459,4=612). You can insert any merge data into this message from your database before submitting to Txtlocal. To insert a newline character use %n.
from
The "From Address" that is displayed when the message arrives on handset. Can only be alpha numeric or space. Min 3 chars, max 11 chars.
uname
Your txtlocal.com username.
pword
Your txtlocal.com password.
selectednums
A comma separated list of international mobile numbers. Each number must be PURELY numeric, no + symbols or hyphens or spaces. The numbers must start with the international prefix. In UK this would be 447xxxxxxxxx. View international prefixes.
custom
This is not mandatory. If set, you can record a custom ID against the the message batch, which will be passed back in the delivery receipt.
group
This is not mandatory. If set, you can send to a precreated Txtlocal.com group. You can get the required group ID from the REPORTS section of the control panel. Duplicates and optouts will be removed.
rcpurl
This is not mandatory. Alternate receipt URL. Instead of using the receipt URL in the Txtlocal Account Settings, receipts will be sent to this URL.
sched
This is not mandatory. The scheduled message date/time. In the format YYYY-MM-DD-HH-MM-SS (e.g 2008-03-28-14-56-00). Scheduled messages can be viewed and deleted via your Txtlocal online account.
validity
This is not mandatory. The time at which you wish the message to expire if it has not been received by the phone (i.e. Phone out of signal range or turned off). In the format MMDDHHmm (It cannot be greater than 48hours in the future).

Receiving SMS

To receive an SMS message to your platform, simply add the URL address of the script on your webserver using the Txtlocal Control Panel 'Inbox Settings' pages. We will POST the following variables to you.

You can take a look at some code examples to see the API in action.

sender
The mobile number of the handset.
content
The message content.
inNumber
The number the message was sent to (your inbound number).
email
Any email address extracted.
credits
The number of credits remaining on your Txtlocal account.
lat
The latitude of the handset (LBS only).
long
The longitude of the handset (LBS only).
rad
The radius of error for the location (LBS only).
lbscredits
The number of location credits remaining on your Txtlocal account (LBS only).

Receipt SMS

To receive an SMS message receipt to your platform, simply add the URL address of the script on your webserver using the Txtlocal account settings page. We will POST the following variables to you.
Note: you can include *#* within the URL and it will be replaced by the custom field.

You can take a look at some code examples to see the API in action.

number
The mobile number of the handset.
status
The message status. Either D for delivered, I for invalid or U for undelivered after 72 hours.
customID
The custom value passed during message send (if used).

Check Credit Balance

You can send us a POST request to check your credit balance on your account, by POSTing the following to
http://www.txtlocal.co.uk/getcredits.php

You can take a look at some code examples to see the API in action.

uname
Your Txtlocal username.
pword
Your Txtlocal password.

Inject Numbers

You can inject numbers and contact information directly in to a group on your account using an API call via a POST request to http://www.txtlocal.co.uk/tl_inject.php

You can take a look at some code examples to see the API in action.

uname
Your Txtlocal username.
pword
Your Txtlocal password.
group
The ID of the target group. You can get this from your control panel 'reports' section..
numbers
The mobile telephone number to insert, in international format.
firstname
The content to save as 'firstname'. Optional.
lastname
The content to save as 'lastname'. Optional.
custom1
The content to save as 'custom1'. Optional.
custom2
The content to save as 'custom2'. Optional.
custom3
The content to save as 'custom3'. Optional.