TheTexting SMS API for sending text messages

0 9

Most users find integration a difficult process. On the internet, there are thousands of queries and different forums are flooded with questions related to integration of an SMS API. Writing this post has a purpose to fulfill, we want masses to know that integration with an SMS API is a matter of few minutes.

Hundreds and thousands of SMS gateway providers have made life easy for all developers.

About TheTexting SMS Gateway:

As an SMS gateway, TheTexting is a trusteforname by various businesses. Sending high volumes of text messages while integrating your systems with an SMS API has been convenient for all end users now.

TheTexting has provided developers with developer tool thats can be attained from the given link.
URL: https://www.thetexting.com/developers/Documentation/SendMessage

Understand the Basics first:

First and foremost, if you want to use an SMS API then you need to have an authentication key. To have an Authentication Key of TheTexting, you need to visit www.thetexting.com from where you need to enter into the “Account’s Area”.

Note: Only registered users can get an access to the account area.

However, you can still sign up at https://www.thetexting.com/Area/Web/Index The registration for a new account doesn’t require any FEE. Once done with the signup, you will be handed over free credit to send messages from your account.

IMPORTANT: All requests to TheTexting must be submitted to the base URL. TheTexting provides you with an option of a response as a JSON object, or an XML string - you get to choose which response by selecting the appropriate base URL for your request.


HTTP Methods

All requests are submitted through the HTTP POST or GET method using UTF-8 encoding and URL encoded values.
Expected "Content-Type" for POST is "application/x-www-form-urlencoded".

However, we also support "application/json", "application/jsonrequest", "application/x-javascript", "text/json", "text/javascript", "text/x-javascript", "text/x-json" when posting parameters as a JSON object.


All requests require your API credentials (api_key & api_secret number), which you can find under "API Settings" in TheTexting Dashboard.

api_keyRequired. Your API Key. Ex: api_key=2f0ihf5656lfu03jl
api_secretRequired. Your API Secret. Ex: api_secret=cluol3434qwfc0lg
fromRequired (Paid) / Optional (Trial). For Paid Account: The number that has been purchased and associated to your account. For Trial Account: Either skip this parameter or use 'test' or 'sandbox' and your message will be sent using a shared number.
toRequired. Mobile number in international format, and one recipient per request. Ex: to=17327572923 when sending to CA (USA).
textRequired. Body of the text message (with a maximum length of 3200 characters), UTF-8 and URL encoded value.
typeOptional. This can be omitted for text (default), but is required when sending a Unicode message (unicode) message.


JSON (success)

  1. {
  2.    "Response": {
  3.       "message_id": "10011",
  4.       "message_count": 1,
  5.       "price": 0.0055
  6.    },
  7.    "ErrorMessage": "",
  8.    "Status": 0
  9. }
Copy the Code

XML (success)

  1. <TheTexting xmlns:i="<a href="https://www.w3.org/2001/XMLSchema-instance"><font color="#ff0000">http://www.w3.org/2001/XMLSchema-instance</font></a>">
  2. <ErrorMessage/>
  3. <Response>
  4. <message_count>1</message_count>
  5. <message_id>10012</message_id>
  6. <price>0.0055</price>
  7. </Response>
  8. <Status>0</Status>
  9. </TheTexting>
Copy the Code

JSON (Failed)

  1. {
  2. "Response": null,
  3. "ErrorMessage": "Parameters Missing",
  4. "Status": 2
  5. }
Copy the Code

XML (Failed)

  1. <TheTexting xmlns:i="<a href="https://www.w3.org/2001/XMLSchema-instance"><font color="#ff0000">http://www.w3.org/2001/XMLSchema-instance</font></a>">
  2. <ErrorMessage>Parameters Missing</ErrorMessage>
  3. <Response i:nil="true"/>
  4. <Status>2</Status>
  5. </TheTexting>
Copy the Code

Respond Codes

Code Meaning
0 Request is successful
1 Request has failed.
2 Parameters are missing.
3 Credentials are invalid.
4 Parameters are invalid.
5 Result has returned empty.
6 Status is invalid.

Sample code for C#

  1. var client = new RestClient("https://www.thetexting.com/rest/sms/json/message/send");
  2. var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddHeader("cache-control", "no-cache"); request.AddParameter("application/x-www-form-urlencoded", "api_secret=apisecret123&api_key=apikey123&from=987654321&to=123456789&text=Sample%20Message%20Text&type=text", ParameterType.RequestBody);
  3. IRestResponse response = client.Execute(request);
Copy the Code

Protocols Supported:


We hope that this effort of compiling all relevant information will serve all readers and developers.

Integration today is a simple process that non-developers are also doing it on their own.

Visit our blog site to know more about the SMS API usage.

You have to log in before you can reply Login | Sign Up

Points Rules