Group Texting HTTP SMS API Documentation
- Sending SMS Messages Via API
- Understanding The Two Incoming Message APIs
- Check Amount of Credits Via API
- Check Keyword Availability Via API
- Buy More Credits Via API
- Rent a Keyword Via API
- Setup a Keyword Via API
Sending SMS Messages:
The SMS text message sending API may be accessed via an HTTP call to the following web service URL: https://app.grouptexting.com/api/sending
Example call: https://app.grouptexting.com/api/sending/?user=USERNAME&pass=PASSWORD &phonenumber=PHONENUMBER&subject=SUBJECT&message=MESSAGE
Parameters (may be passed via GET or POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
PhoneNumber | (Required) Up to 15 digit phone number to send message to. |
Subject | (Required) The subject of your message (leave null if no subject) Maximum 13 characters |
Message | (Required) The body of your message (cannot exceed 160 characters) |
Please note: Messages cannot exceed 160 characters combined subject and message field. Subjects are always limited to 13 characters.
The following are the codes that a send message API call can return. Any negative codes represent unsuccessful attempts to send messages.
1 | Message Sent |
-1 | Invalid user or password (make sure your account is API allowed) |
-2 | Credit Limit Reached |
-5 | Local Opt Out (the recipient/number is on your opt-out list.) |
-7 | Invalid message or subject (exceeds maximum number of characters and/or contains invalid characters - see a list of valid characters below) |
-104 | Globally Opted Out Phone Number (the phone number has been opted out from all messages sent from our long code). To opt this number in please text HELP or Your Keyword to our long code using that phone. |
-106 | Incorrectly Formatted Phone Number (number must be 10 digits) |
-10 | Unknown Error (please contact our support dept.) |
Please Note: Our servers impose a limit on the number of simultaneous connections that you may make from your server to ours per second. To avoid having your IP blocked, please do not attempt to make more than 2 simultaneous HTTP connections per second to our servers. Please also make sure that you close each connection after opening one when making your HTTP request. If you are running a multithreaded application please also be aware of the limit that is imposed. If your application exceeds this limit you may receive a rate limiting error, with the HTTP status code 503 in the header and your request will not be processed. If you believe you are being incorrectly rate limited please contact support.
When sending multiple request we strongly suggest using the following logic in order to avoid this limitation:
- Open Connection
- Begin Loop
- Make Request
- Close Loop
- Close Connection
The list of allowed characters for messages is: a-z, A-Z, 0-9 and these special characters: .,:;!?()~=+-_\/@$#&%
The following characters count as two characters when used: ~ @ # % + = / \ \r\n
API Text Message Sending Language Examples:
PHP
<?php $ch=curl_init('https://app.grouptexting.com/api/sending'); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&phonenumber= 2125551234&subject=test&message=test message"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>
C#
string ret=string.Empty; WebRequest w=WebRequest.Create("https://app.grouptexting.com/api/sending"); w.Method="POST"; w.ContentType="application/x-www-form-urlencoded"; using(Stream writeStream = w.GetRequestStream()) { UTF8Encoding encoding = new UTF8Encoding(); byte[] bytes = encoding.GetBytes("user=username&pass=userpassword& phonenumber=2125551234&subject=test &message=test message"); writeStream.Write(bytes, 0, bytes.Length); } using (HttpWebResponse r = (HttpWebResponse) w.GetResponse()) { using (Stream responseStream = r.GetResponseStream()) { using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) { ret = readStream.ReadToEnd(); } } } MessageBox.Show(ret); /* result of API call*/
PHP - Send Multiple Messages
<?php
/* The below code snippet is a sample and not functional. Its purpose is to illustrate how to send multiple requests to our service using one connection */
= curl_init('https://app.grouptexting.com/api/sending');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
foreach ( as ) {
= "user=username&pass=userpassword&phonenumber=" . $message['phone'] . "&subject=" . $message['subject'] . "&message=" . $message['message'];
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$data = curl_exec($ch);
}
curl_close($ch);
?>
Understanding The Difference Between The Keyword Submission API And The Inbox Replies API
Group Texting allows you to implement your own APIs to receive and/or forward incoming messages to your server. Please check out the list of parameters which Group Texting Texting sends to your server, which your APIs must accept.
When someone sends in your keyword [space] message or just replies without a keyword within 12 hours of you sending a message to them, the Inbox Reply API is used where the variable is called from. If someone sends in only your keyword then the Keyword API is invoked and that variable is called Phone Number.
**Please note that if you are testing your API implementation with the same phone number again and again, when you send in your keyword submission and you get a reply back then the keyword reply is considered as an outgoing message. Consequently, if you send in keyword [space] message again through the same phone number, The Inbox Reply API will be invoked and NOT the Keyword API.
Many of our API clients use different scripts to process forwarded messages (messages that are replies or keyword [space] message) vs just keywords. This is the cause of the difference between the name of the variables.
If you have Send Unique Requests Checked then your Keyword URL will only be called once and not your Forwarding URL in cases when a message is considered to be a keyword submission and not a reply to an outbound message from your account.
If you have Wait for Response From My Server Checked then the system will wait for output to send back to the person who texted in. We suggest that you have both these Checked as it would work for most applications.
Receiving Keyword Submissions:
Group Texting allows SMS messages to be received using HTTP through the means of keywords on our long code. This page details the format of the HTTP requests which are sent by the Group Texting SMS Server to allow the receipt of SMS text messages by external software systems.
The Group Texting SMS Server will push received SMS messages by making an HTTP GET request to the provided URL to indicate the receipt of an SMS message. You can input this URL on the Keywords section of your Group Texting account.
Example URL:
http://www.yourdomain.com/receivesms.php?PhoneNumber=5554443333&Message=Hello%20my%20friend
Message Format
On receipt of an SMS we will send an HTTP GET request to your server, using the parameters included in the table below:
PhoneNumber | Phone number message originated from. |
Message | The body of your message that was texted in by the originating phone number prefaced by your keyword. |
Example Request Sent
http://www.yourdomain.com/receivesms.php?PhoneNumber=5554443333&Message=Hello%20my%20friend
Response To The Server
When the GET post is made to your server, your script must output your SMS response in plain text format (max 160 characters) that will be sent back to the originating phone number through our long code. This response must be given in a timely manner (sub 60 seconds) or it will be abandoned. Your server must also respond with a 200 OK Status. No additional calls to our servers are necessary.
The list of allowed characters for messages is: a-z, A-Z, 0-9 and these special characters: .,:;!?()~=+-_\/@$#&%
The following characters count as two characters when used: ~ @ # % + = / \ \r\n
Receiving Inbox Message Replies:
All replies to your inbox will be forwarding to the URL you specify. The Group Texting SMS Server will push received SMS messages by making an HTTP GET to the provided URL.
Example URL:
http://www.yourdomain.com/receivesms.php?From=5554443333&Message=Hello%20my%20friend
Example Request Sent
We will send an HTTP GET request to your server, using the parameters:
from | Phone number message originated from. |
message | The body of receiving message that was texted in by the originating phone number. |
http://www.yourdomain.com/sms.php?from=5554443333&message=Hello%20World
Options
Send unique request: Check this if you have both keyword URL and forwarding URLs setup and you do not wish to receive duplicate message forwards.
Wait for response from my server: If you require an incoming reply to have an auto-reply, select this option. We will send this response as an auto-reply via HTTP GET.
Whether you have the Wait For Response From My Server option turned on or off, your server must respond with a 200 OK Status within 60 seconds or it will be abandoned.
The list of allowed characters for messages is: a-z, A-Z, 0-9 and these special characters: .,:;!?()~=+-_\/@$#&%
The following characters count as two characters when used: ~ @ # % + = / \ \r\n
Please note: If you have a keyword and both the keyword URL and forwarding URLs are setup with the same URL, check should click "Send Unique Request" so we only send one GET request.
Check Credit Balance
You may check credit balances using our API via an HTTP call to the following web service URL:
https://app.grouptexting.com/api/credits/check/
Parameters (may be passed via GET or POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
The following are the codes that a send message API call can return. Any negative codes represent unsuccessful attempts to check credits amount.
Any non-negative number | The amount of credits available |
-1 | Invalid user or password (make sure your account is API allowed) |
-10 | Unknown Error (please contact our support dept.) |
Check Keyword Availability
The keyword availability check API may be accessed via an HTTP call to the following web service URL:
https://app.grouptexting.com/api/keyword/check/
Parameters (may be passed via GET or POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
Keyword | (Required) The keyword to be checked |
The following are the codes that a send message API call can return. Any negative codes represent unsuccessful attempts to check keyword availability.
1 | The keyword is available |
0 | The keyword is not available |
-1 | Invalid user or password (make sure your account is API enabled) |
-2 | Request declined because it is less than $5.00 minimum purchase. |
-10 | Unknown Error (please contact our support dept.) |
Buy More Credits
The credit purchase API may be accessed via an HTTPS call to the following web service URL:
https://app.grouptexting.com/api/credits/buy/
Parameters (must be passed via POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
FirstName | (Required) The first name on the card |
LastName | (Required) The last name on the card |
Address | (Required) The billing street address |
City | (Required) The billing address city |
State | (Required) The billing address state/province |
Zip | (Required) The billing address zip code |
Country | (Required) The billing address country |
Type | (Required) Card type: 'MC' for MasterCard, 'Visa', 'AX' for American Express, 'DS' for Discover, 'JCB' |
CCNumber | (Required) Card number |
CCCode | (Required) Card Security Code (CV2) |
Expm | (Required) Card's expiration month, two digits |
Expy | (Required) Card's expiration year, two digits |
Credits | (Required) Amount of credits to buy |
The following are the codes that a send message API call can return. Any negative codes represent unsuccessful attempts to buy credits.
1 | The request succeeded |
0 | The request was declined |
-1 | Invalid user or password (make sure your account is API allowed) |
-10 | Unknown Error (please contact our support dept.) |
Rent a Keyword
The keyword rental API may be accessed via an HTTPS call to the following web service URL:
https://app.grouptexting.com/api/keyword/rent/
Parameters (must be passed via POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
FirstName | (Required) The first name on the card |
LastName | (Required) The last name on the card |
Address | (Required) The billing street address |
City | (Required) The billing address city |
State | (Required) The billing address state/province |
Zip | (Required) The billing address zip code |
Country | (Required) The billing address country |
Type | (Required) Card type: 'MC' for MasterCard, 'Visa', 'AX' for American Express, 'DS' for Discover, 'JCB' |
CCNumber | (Required) Card number |
CCCode | (Required) Card Security Code (CV2) |
Expm | (Required) Card's expiration month, two digits |
Expy | (Required) Card's expiration year, two digits |
Keyword | (Required) The keyword to rent |
Please note: After you rent a Keyword, you may want to update the default autoreply, which is 'Thank you for joining our list.'
The following are the codes that a keyword configuration API call can return. Any negative codes represent unsuccessful attempts to rent a keyword.
2 | The request succeeded |
1 | The keyword is not available |
0 | The request was declined |
-1 | Invalid user or password (make sure your account is API allowed) |
-10 | Unknown Error (please contact our support dept.) |
Configure a Keyword
The keyword configuration API may be accessed via an HTTPS call to the following web service URL:
https://app.grouptexting.com/api/keyword/setup/
Parameters (must be passed via GET or POST and values must be properly URL encoded)
User | (Required) Your Group Texting Username |
Pass | (Required) Your Group Texting Password |
Keyword | (Required) Keyword that you want to configure |
Group | (Optional) Customers who text in your keyword will be added to the group you provide |
Autoreply | (Optional) Customers that text in your Keyword to our long code will receive this message. The autoreply is limited to 160 characters. Each confirmation return text that is sent back requires 1 credit. If you do not update this field, we will send out our default autoreply, 'Thank you for joining our list.' |
(Optional) We will forward incoming messages to the email address for free | |
URL | (Optional) We will call this URL when keyword is received |
The following are the codes that a send message API call can return. Any negative codes represent unsuccessful attempts to rent a keyword.
1 | Updated Successfully |
-1 | Invalid user or password (make sure your account is API allowed) |
-2 | Invalid Keyword |
-3 | Invalid Group Name |
-4 | Invalid Email |
-5 | Invalid URL |
-7 | Invalid autoreply message (message is blank or message exceeds maximum number of characters or message contains invalid characters) |
-10 | Unknown Error (please contact our support dept) |
API Rent A Keyword Language Examples:
PHP
<?php $ch=curl_init('https://app.grouptexting.com/api/keyword/setup/'); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,"user=username&pass=userpassword&group=test&url=http://test.com/test"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $data = curl_exec($ch); print($data); /* result of API call*/ ?>