Join over 100,000 happy developers who have discovered how easy it is to integrate our SMS API with their website, app, software or CRM application. Simply send a mobile number and message to our gateway and the SMS text will be delivered in seconds.
We support all languages (including PHP, .NET, C#, Java, Python, Ruby) – you simply open a webpage on a URL to get started.
Our Platinum Partner Operator status guarantees the highest quality text service at up to 8,000 messages a second. What’s more, our SMS API can personalise messages, receive delivery receipts, schedule messages and pull results from mobile forms and surveys into your app. Our SMS gateway can also handle tickets, enabling you to send individual vouchers or tickets. Try sending a message using our API today.
Our receive SMS online API allows you to receive text messages from an inbox with our inbound SMS API. Using your API key, you can get the latest messages from one or more inboxes. Messages can either be returned as either JSON or XML for easy inclusion in your own app, CRM or system. Test our inbound SMS API and register for a API key today.
Cut and paste our SMS API code and your API key to start sending and receiving text messages in minutes. Our API gateway is fully supported with detailed documentation and full developer SMS code examples. See how you can integrate into our SMS API gateway and read all of our supporting documents here.
Using our SMS API, you can do much more than just send and receive text messages. You can manage contacts, create or delete contact groups, create respond forward SMS rules, form a short URL, retrieve SMS or MMS balances, and retrieve message reports. Textlocal’s SMS API is the most versatile and flexible API gateways on the planet. Sign up for a API key and try our gateway in minutes.
Refer to the code below to see how easily you can integrate our SMS API with your own software, CRM application or website in a language you already use.
<% apikey = "yourapikey" address = "http://api.txtlocal.com/send/?" message = "This is your message" message = Server.urlencode(message) numbers = "447123456789" sender = "Jims Autos" url = address & "apikey=" & apikey & "&numbers=" & numbers & "&message=" & message & "&sender=" & sender set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "POST", url, false xmlhttp.send "" msg = xmlhttp.responseText response.write(msg) set xmlhttp = nothing %>
<% apikey = "yourapikey" address = "http://api.txtlocal.com/send/?" message = "This is your message" message = Server.urlencode(message) numbers = "447123456789" sender = "Jims Autos" url = address & "apikey=" & apikey & "&numbers=" & numbers & "&message=" & message & "&sender=" & sender set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "GET", url, false xmlhttp.send "" msg = xmlhttp.responseText response.write(msg) set xmlhttp = nothing %>
<%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script runat="server" language="VB"> Sub Page_Load(sender As Object, e As EventArgs) Dim apikey As String = "YourapiKey" Dim SenderName As String = "MyName" Dim Number As String = "447123456789" Dim Message As String = "This is an API message" Dim URL As String = "https://api.txtlocal.com/send/?" Dim PostData As String = "apikey=" & apikey & "&sender=" & SenderName & "&numbers=" & Number & "&message=" & Message Dim req As HttpWebRequest = WebRequest.Create(URL) req.Method = "POST" Dim encoding As New ASCIIEncoding() Dim byte1 As Byte() = encoding.GetBytes(PostData) req.ContentType = "application/x-www-form-urlencoded" req.ContentLength = byte1.Length Dim newStream As Stream = req.GetRequestStream() newStream.Write(byte1, 0, byte1.Length) Try Dim resp As HttpWebResponse = req.GetResponse() Dim sr As New StreamReader(resp.GetResponseStream()) Dim results As String = sr.ReadToEnd() sr.Close() html.Text = results Catch wex As WebException Response.Write("SOMETHING WENT AWRY! Status: " & wex.Status & "Message: " & wex.Message & "") End Try End Sub </script>
<%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script runat="server" language="VB"> Sub Page_Load(sender As Object, e As EventArgs) Dim apiKey As String = "your apiKey" Dim SenderName As String = "MyName" Dim Number As String = "447123456789" Dim Message As String = "This is an API message" Dim URL As String = "https://api.txtlocal.com/send/?apikey=" & apiKey & "&sender=" & SenderName & "&numbers=" & Number & "&message=" & Message Dim req As HttpWebRequest = WebRequest.Create(URL) Try Dim resp As HttpWebResponse = req.GetResponse() Dim sr As New StreamReader(resp.GetResponseStream()) Dim results As String = sr.ReadToEnd() sr.Close() html.Text = results Catch wex As WebException Response.Write("SOMETHING WENT AWRY! Status: " & wex.Status & "Message: " & wex.Message & "") End Try End Sub </script>
using System; using System.Collections.Generic; using System.Net; using System.Collections.Specialized; namespace sendSMS { class sendSMS { public string sendSMS() { String message = HttpUtility.UrlEncode("This is your message"); using (var wb = new WebClient()) { byte[] response = wb.UploadValues("https://api.txtlocal.com/send/", new NameValueCollection() { {"apikey" , "yourapiKey"}, {"numbers" , "447123456789"}, {"message" , message}, {"sender" , "Jims Autos"} }); string result = System.Text.Encoding.UTF8.GetString(response); return result; } } } }
using System; using System.Collections.Generic; using System.Net; using System.Collections.Specialized; using System.IO; namespace sendSMS { class sendSMS { public string sendSMS() { String result; string apiKey = "your apiKey"; string numbers = "447123456789"; // in a comma seperated list string message = "This is your message"; string sender = "Jims Autos"; String url = "https://api.txtlocal.com/send/?apikey=" + apiKey + "&numbers=" + numbers + "&message=" + message + "&sender=" + sender; //refer to parameters to complete correct url string StreamWriter myWriter = null; HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); objRequest.Method = "POST"; objRequest.ContentLength = Encoding.UTF8.GetByteCount(url); objRequest.ContentType = "application/x-www-form-urlencoded"; try { myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(url); } catch (Exception e) { return e.Message; } finally { myWriter.Close(); } HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader sr = new StreamReader(objResponse.GetResponseStream())) { result = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } return result; } } }
function SendSMS(apiKey, Sender, Numbers, Message: String):string; const URL = 'https://api.txtlocal.com/send/?apikey=%s&sender=%s&numbers=%s&message=%s'; ResponseSize = 1024; var hSession, hURL: HInternet; Request: String; ResponseLength: Cardinal; begin hSession := InternetOpen('DrBob42', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); try Request := Format(URL,[apiKey,Sender,Numbers,HttpEncode(Message)]); hURL := InternetOpenURL(hSession, PChar(Request), nil, 0,0,0); try SetLength(Result, ResponseSize); InternetReadFile(hURL, PChar(Result), ResponseSize, ResponseLength); SetLength(Result, ResponseLength) finally InternetCloseHandle(hURL) end finally InternetCloseHandle(hSession) end end;
function getURLContent(const Url: string): string; var NetHandle: HINTERNET; UrlHandle: HINTERNET; Buffer: array[0..1024] of Char; BytesRead: dWord; begin Result := ''; NetHandle := InternetOpen('Delphi 5.x', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if Assigned(NetHandle) then begin UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0); if Assigned(UrlHandle) then { UrlHandle valid? Proceed with download } begin FillChar(Buffer, SizeOf(Buffer), 0); repeat Result := Result + Buffer; FillChar(Buffer, SizeOf(Buffer), 0); InternetReadFile(UrlHandle, @Buffer, SizeOf(Buffer), BytesRead); until BytesRead = 0; InternetCloseHandle(UrlHandle); end else { UrlHandle is not valid. Raise an exception. } raise Exception.CreateFmt('Cannot open URL %s', [Url]); InternetCloseHandle(NetHandle); end else { NetHandle is not valid. Raise an exception } raise Exception.Create('Unable to initialize Wininet'); end; u := 'https://api.txtlocal.com/send/?' + 'apikey=yourapikey' + '&message=message' + '&sender=sender' + '&numbers=447123456789'; GetUrlContent(u);
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; public class sendSMS { public String sendSms() { try { // Construct data String apiKey = "apikey=" + "yourapiKey"; String message = "&message=" + "This is your message"; String sender = "&sender=" + "Jims Autos"; String numbers = "&numbers=" + "447123456789"; // Send data HttpURLConnection conn = (HttpURLConnection) new URL("https://api.txtlocal.com/send/?").openConnection(); String data = apiKey + numbers + message + sender; conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Length", Integer.toString(data.length())); conn.getOutputStream().write(data.getBytes("UTF-8")); final BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); final StringBuffer stringBuffer = new StringBuffer(); String line; while ((line = rd.readLine()) != null) { stringBuffer.append(line); } rd.close(); return stringBuffer.toString(); } catch (Exception e) { System.out.println("Error SMS "+e); return "Error "+e; } } }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; public class sendSMS { public String sendSms() { try { // Construct data String apiKey = "apikey=" + URLEncoder.encode("yourapiKey", "UTF-8"); String message = "&message=" + URLEncoder.encode("This is your message", "UTF-8"); String sender = "&sender=" + URLEncoder.encode("Jims Autos", "UTF-8"); String numbers = "&numbers=" + URLEncoder.encode("447123456789", "UTF-8"); // Send data String data = "https://api.txtlocal.com/send/?" + apiKey + numbers + message + sender; URL url = new URL(data); URLConnection conn = url.openConnection(); conn.setDoOutput(true); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; String sResult=""; while ((line = rd.readLine()) != null) { // Process line... sResult=sResult+line+" "; } rd.close(); return sResult; } catch (Exception e) { System.out.println("Error SMS "+e); return "Error "+e; } } }
#!/usr/bin/perl use strict; use LWP::UserAgent; use HTTP::Request::Common; my $apikey = 'yourApikey'; my $sender = "Jims Autos"; my $numbers = "447123456789"; my $message = "This is your message"; my $ua = LWP::UserAgent->new(); my $res = $ua->request ( POST 'https://api.txtlocal.com/send/?', Content_Type => 'application/x-www-form-urlencoded', Content => [ 'apikey' => $apikey, 'numbers' => $numbers, 'message' => $message, 'sender' => $sender ] ); if ($res->is_error) { die "HTTP Errorn"; } print "Response:nn" . $res->content . "nn";
#!/usr/bin/perl use LWP::Simple; my $apiKey = "apikey=" . 'yourapiKey'; my $message = "&message=" . "This is your message"; my $sender = "&sender=" . "Jims Autos"; my $number = "&numbers=" . "447123456789"; my $getString = join "", "https://api.txtlocal.com/send/?", $apiKey, $message , $sender , $number; my $contents = get($getString); print "$contents";
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message details $numbers = array(447123456789, 447987654321); $sender = urlencode('Jims Autos'); $message = rawurlencode('This is your message'); $numbers = implode(',', $numbers); // Prepare data for POST request $data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message); // Send the POST request with cURL $ch = curl_init('https://api.txtlocal.com/send/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message details $numbers = urlencode('447123456789,447987654321'); $sender = urlencode('Jims Autos'); $message = rawurlencode('This is your message'); // Prepare data for POST request $data = 'apikey=' . $apiKey . '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message; // Send the GET request with cURL $ch = curl_init('https://api.txtlocal.com/send/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here echo $response; ?>
<?php require('textlocal.class.php'); $Textlocal = new Textlocal(false, false, 'your apiKey'); $numbers = array(447123456789); $sender = 'Jims Autos'; $message = 'This is your message'; $response = $textlocal->sendSms($numbers, $message, $sender); print_r($response); ?>
#!/usr/bin/env python import urllib.request import urllib.parse def sendSMS(apikey, numbers, sender, message): data = urllib.parse.urlencode({'apikey': apikey, 'numbers': numbers, 'message' : message, 'sender': sender}) data = data.encode('utf-8') request = urllib.request.Request("https://api.txtlocal.com/send/?") f = urllib.request.urlopen(request, data) fr = f.read() return(fr) resp = sendSMS('apikey', '447123456789', 'Jims Autos', 'This is your message') print (resp)
#!/usr/bin/env python import urllib.request import urllib.parse def sendSMS(apikey, numbers, sender, message): params = {'apikey': yourapiKey, 'numbers': numbers, 'message' : message, 'sender': sender} f = urllib.request.urlopen('https://api.txtlocal.com/send/?' + urllib.parse.urlencode(params)) return (f.read(), f.code) resp, code = sendSMS('apikey', '447123456789', 'Jims Autos', 'Test with an ampersand (&) and a £5 note') print (resp)
require "rubygems" require "net/https" require "uri" require "json" requested_url = 'https://api.txtlocal.com/send/?' uri = URI.parse(requested_url) http = Net::HTTP.start(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) res = Net::HTTP.post_form(uri, 'apikey' => 'yourApikey', 'message' => 'This is your message', 'sender' => 'Ben', 'numbers' => '447123456789') response = JSON.parse(res.body) puts (response)
require "rubygems" require "net/https" require "uri" require "json" apikey = "yourapiKey" numbers = "447123456789" message = "This is your message" sender = "Jims Autos" requested_url = 'https://api.txtlocal.com/send/?' + "apikey=" + apikey + "&numbers=" + numbers + "&message=" + URI.escape(message) + "&sender=" + sender uri = URI.parse(requested_url) http = Net::HTTP.start(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) res = http.request(request) response = JSON.parse(res.body) puts (response)
Public Sub Send() Dim username As String Dim password As String Dim result As String Dim myURL As String Dim Sender As String Dim numbers As String Dim Message As String Dim postData As String Dim winHttpReq As Object apikey = "yourAPIkey" Sender = "Jims Autos" numbers = "447123456789" Message = "This is your message" Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1") myURL = "https://api.txtlocal.com/send/?" postData = "apikey=" + apikey + "&message=" + Message + "&numbers=" + numbers + "&sender=" + Sender winHttpReq.Open "POST", myURL, False winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" winHttpReq.Send (postData) SendSMS = winHttpReq.responseText End Sub
Public Sub Send() Dim apikey As String apikey = "apikey=" + "yourapiKey" message As String message = "&message=" + "This is your message" Dim sender As String sender = "&sender=" + "Jims Autos" Dim numbers As String numbers = "&numbers=" + "447123456789" Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1") MyRequest.Open "GET", "https://api.txtlocal.com/send/?" +apikey + message + sender + numbers MyRequest.Send MsgBox MyRequest.ResponseText End Sub
Imports System.Web Imports System.IO Imports System.Net Imports System.Text Imports System.Resources Public Class sendSMS Public Function sendSMS() Dim apikey = "yourAPIkey" Dim message = "This is your message" Dim numbers = "447123456789" Dim strPost As String Dim sender = "Jims Autos" Dim url As String = "https://api.txtlocal.com/send/?" Dim strPost As String strPost = url + "apikey=" + apikey _ + "&numbers=" + numbers _ + "&message=" + WebUtility.UrlEncode(message) _ + "&sender=" + sender Dim request As WebRequest = WebRequest.Create(strPost) request.Method = "POST" Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPost) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = byteArray.Length Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse() dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() Console.WriteLine(responseFromServer) Console.ReadLine() reader.Close() dataStream.Close() response.Close() If responseFromServer.Length > 0 Then Return responseFromServer Else Return CType(response, HttpWebResponse).StatusDescription End If End Function End Class
Imports System.Net Imports System.Web Imports System.Collections.Specialized Imports System.IO Imports System.Text Public Class sendSMS Public Function sendSMS() Dim apikey = "yourapiKey" Dim message = "This is your message" Dim numbers = "447123456789" Dim strGet As String Dim sender = "Jims Autos" Dim url As String = "https://api.txtlocal.com/send/?" strGet = url + "apikey=" + apikey _ + "&numbers=" + numbers _ + "&message=" + WebUtility.UrlEncode(message) _ + "&sender=" + sender Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString(strGet) Console.WriteLine(result) Return result End Function End Class
Caution: Some users opt to place their request inside a code loop, while testing we highly recommend setting the test
parameter to true, as occasionally an infinite loop can occur and users can consume all their credits very quickly.
sender | Use this field to specify the sender name for your message. This must be at least 3 characters in length but no longer than 11 alphanumeric characters or 13 numeric characters. |
---|---|
message | The message content. This parameter should be no longer than 918 characters. See Helpful Information for message length details. The message also must be URL Encoded to support symbols like &. |
Login Parameters | |
username | The email address used to log into Textlocal. |
hash | Your secure hash can be found within Messenger in the main navigation under “Help->All Documentation“. Alternatively you can use the password parameter instead and use your Textlocal password in plain text. |
apiKey | This can be used instead of the username/hash/password. You can create them in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address. |
Optional Parameters | |
numbers | Comma-delimited list of mobile numbers in international format (i.e. 447123456789). Maximum of 10,000 numbers and error code 33 will be returned if exceeded. |
group_id | This parameter can be used in place of the numbers parameter in order to send to an entire contact group. This parameter should contain the ID of the relevant group, which can found either within Messenger (in the “Reports” – “Advanced Reports” – “List of Group ID’s” section) or by running the get_groups command. Additionally group 5 contains “contacts” and group 6 contains “opt-outs”. |
simple_reply | Set to true to enable the Simple Reply Service for the message. This will override any sender value, as a Simple Reply Service number will be used instead. |
schedule_time | This parameter can be used to specify a schedule date/time for your message, which should be provided in Unix timestamp format. Times should be provided in GMT. |
receipt_url | Use this field to specify an alternative URL to which the delivery receipt(s) will be sent. See handling receipts documentation. |
custom | This value will be set against the message batch and will passed back in the delivery receipts. This allows you to match delivery receipts to their corresponding messages. |
optouts | Can be set to true in order to check against your own opt-outs list and Textlocal’s global opt-outs database. Your message will not be sent to numbers within these lists. If not provided defaults to false. |
validity | Can be set, up to 72 hours in advance, to say after which time, you don’t want the message delivered. This should be in a Unix timestamp format. |
unicode | Set this value to true to specify that your message body will contain unicode characters. See Encoding/Decoding Unicode Documentation |
test | Set this field to true to enable test mode, no messages will be sent and your credit balance will be unaffected. If not provided defaults to false |
Note: While both numbers
and group_id
are optional parameters, one or the other must be included in the request for the message to be sent.
You can also send Link Tracked Surveys out via the API. View Sending Surveys via the API for more information.
In a world where SMS has become an extension of a software provider’s solution, the choice of provider for an API integration becomes less about the SMS and more about what is supporting your business. This is where Textlocal differentiates itself in operational terms. Rather than list what we see as benefits, let’s review what reasons our clients shared as they moved their SMS business to Textlocal.
One gambling client outlined that if there was large send to go out because of a national event they wanted to promote then they needed to highlight this to their previous supplier to ensure the messages could go out, meaning a lot of preparation before the event itself. With a technology stack that sends hundreds of SMS per second, that cumbersome activity has gone away.
One of our clients moved as their previous provider offered a 99.5% up time guarantee. This equates to 1.83 days a year of unplanned downtime, not much of a guarantee when you have a key message to send out and your reputation is on the line. With an operational history of over 99.999% up time (which is five minutes a year of downtime) you know the platform is going to be there for you.
How many businesses boast about innovation, though behind the scenes, they partner with mediocre SMS suppliers? As well as direct connections with UK network providers, we also have relationships with leading providers of other digital messaging channels – think RCS (Rich Communication Services) and social messaging platforms.
When you compete with other software providers, you may share an ideal of forward thinking and solution innovation. However, what you need to back this up with is an aligned supplier that delivers this same vision. With Textlocal you are assured that as we have access to new technologies through our Tier 1 network providers.
Our send SMS API is the world’s most scalable and reliable API for sending and receiving bulk, personalised text messages. It’s also the most supported too. With detailed documentation and a world-class mobile development team based in the UK. Read our SMS integrations documents to see how you can start using our API.
nTech provides innovative reality-based solutions and services which are optimised for rapid deployment. nTech offer bespoke solutions that enable their customers to achieve real results and return on investment.
As a user of the Textlocal API integration, nTech gave us an overview of how powerful the integration has been for their business as well as the ease of implementation.
We support a wide range of SMS integrations from SMS SMPP, our multichannel API as well as our one-time password SMS solutions. For further information on how our API can integrate with your business application or software contact our dedicated sales and support team today.