Send SMS Gateway API – JAVA

This command can be used to send text messages to either individual numbers or entire contact groups.

Sample Request

                    
  1. public static void main(String[] args) {
  2. String url = "http://serverURL/rest/services/sendSMS/sendGroupSms";
  3. String authKey="yourAuthKey";
  4. String message=null;
  5. message=URLEncoder.encode("Hello for test");
  6. String senderId="MSGTST";
  7. String routeId="1";
  8. String mobileNos="9999999999,8888888888";
  9. String smsContentType="english";
  10. String scheduledTime="";
  11. String groupName="";
  12. String signature="";
  13. System.out.println(message);
  14. SendSmsDemo send=new SendSmsDemo();
  15. String s=send.sendSmsGet(url, authKey, message, senderId, routeId, mobileNos, smsContentType,scheduledTime,signature,groupName);
  16. System.out.println(s);
  17. }
  18. }
  19. //{" response":"success","responseCode":"3001"}
                    
  1. public static void main(String[] args) {
  2. String url = "http://serverURL/rest/services/sendSMS/sendGroupSms";
  3. String authKey="yourAuthKey";
  4. String message=null;
  5. message="Hello for test";
  6. String senderId="MSGTST";
  7. String routeId="1";
  8. String mobileNos="9999999999,8888888888";
  9. String smsContentType="english";
  10. String scheduledTime="";
  11. String groupName="";
  12. String signature="";
  13. System.out.println(message);
  14. SendSmsDemo send=new SendSmsDemo();
  15. String s=send.sendSmsPost(url, authKey, message, senderId, routeId, mobileNos, smsContentType,scheduledTime,signature,groupName);
  16. System.out.println(s);
  17. }
  18. }
  19. //{" response":"success","responseCode":"3001"}
                    
  1. public static void main(String[] args) {
  2. String url="http://serverURL/rest/services/sendSMS/sendGroupSmsXmlApi";*/
  3. String authKey="yourAuthKey";
  4. String message=null;
  5. message="Hello for test";
  6. String senderId="MSGTST";
  7. String routeId="1";
  8. String mobileNos="9999999999,8888888888";
  9. String smsContentType="english";
  10. String scheduledTime="";
  11. String groupName="";
  12. String signature="";
  13. System.out.println(message);
  14. SendSmsDemo send=new SendSmsDemo();
  15. String s=send.sendSmsXml(url, authKey, message, senderId, routeId, mobileNos, smsContentType,scheduledTime,signature,groupName);
  16. System.out.println(s);
  17. }
  18. }
  19. //{" response":"success","responseCode":"3001"}

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.

Parameters

sender If you have a promotional account, do not send this parameter. If you have a transactional account, use this field to specify the sender name for your message. Sender name must be 6 alpha characters and should be pre-approved by Textlocal. In the absence of approved sender names, use the default 'TXTLCL'
message The message content. This parameter should be no longer than 766 characters. See Helpful Information for message length details. The message also must be URL Encoded to support symbols like &.
Login Parameters (Additional Information)
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.
Optional Parameters
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.
numbers Comma-delimited list of mobile numbers in international format (i.e. 918123456789).
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".
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.
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 51: Error Code's for Missing Parameters:

Errors

Error Codes Description
3001 * for Success
3002 * Invalid URL
3003 * Invalid User/Password
3004 * Invalid Message Type
3005 * Invalid Message
3006 * Invalid Destination
3007 * Invalid Source
3008 * Invalid DLR Field
3009 * Authentication Failed
3010 * Internal Error
3011 * Insufficient Balance
3012 * Responce Time Out
3013 * Invalid Request Content Type
3014 * Missing Mobile Number
3015 * SMs Content for Approval
3016 * Missing Required Parameter
3017 * FAIL
3018 * Expired Account
3019 * Null Pointer Exception code
3020 * Empty User Name
3021 * Empty Password
3022 * User Name not Available
3023 * Session Expired
3024 * Already Exist
3025 * Empty Group Name
3026 * Empty Contact Name
3027 * Empty Mobile Number
3028 * Empty Group Id
3029 * Empty City Name
3030 * Empty Occupation
3041 * Empty E-Mail Id
3042 * Group not Exist
3043 * Empty Message
3044 * Empty Route Id
3045 * Empty Sender Id
3047 * Empty Draft Id
3048 * Empty First Name
3049 * Empty Last Name
3050 * Empty Balance
3051 * Empty Role Id
3052 * For User Name Length
3053 * Empty Expiry Date/td>
3054 * Invalid Date
3055 * Empty Client Id
3056 * Invalid Status
3057 * Empty Country Name
3058 * Empty State Name
3059 * Session Expired
3060 * Empty Date
3061 * Access Denied
3062 * Empty Old Password
3063 * Password not Maching
3064 * Empty SMS
3065 * Empty Amount
3066 * Empty Address
3067 * Empty RequestId
3068 * Empty Group and MobileNo
3069 * Empty Description
3070 * Fail to Change RoleId
3071 * Empty CallerId
3072 * Empty File URL and Draft
3073 * Empty Duration
3074 * Invalid Request
3075 * Invalid Aoudio file
3076 * Missing Upload File

Warnings

Warning Codes
3 Invalid number.
For Any Help Call Us Anywhere Anytime On   +91-94068-11127
Call Us +91-94068-11127