![]() |
![]() |
HTTP Plain
The URL for WA API used to send messages using HTTP GET is:
Primary access point:
http://api.nusasms.com/api/v3/sendwa/plain
New Documentation WA API here : https://cdev.nusasms.com/#nusasms-api-whatsapp
WA API Parameter specifications
AUTHENTICATION | user | Client username for NusaSMS system login |
password | Client password for NusaSMS system login | |
MESSAGE | SMSText | Message body |
RECIPIENTS | GSM |
Message destination address, must be international format without leading 0 or + Example: 6281123456789 |
COMMAND | output |
Desired output, support values are (optional): xml: values are formatted as xml json: values are formatted as json If no output parameter is specified, xml formatting will be used |
URL Query String Parameters
Parameter | Description |
username | Username |
password | Password |
GSM | Recipient GSM number in international format, eq. 6285100101698) |
text | text message to send (max 1000 chars) |
Examples: Send plain SMS (Output XML)
http://api.nusasms.com/api/v3/sendwa/plain?username=user&password=password&GSM=6285100803380&text=testing+wa+api
Examples:
1.Send plain SMS (Output JSON)
http://api.nusasms.com/api/v3/sendwa/plain?username=user&password=password&GSM=6285100803380&text=testing+wa+api&output=json
Results Example
- Success Result Sample:
XML
<?xml version="1.0" encoding="UTF-8"?> <results> <result> <status>0</status> <messageid>175041319203754627</messageid> <destination>6285100803380</destination> </result> </results>
JSON
{"results":[{"status":"0","messageid":"175041319203754627","destination":"6285100803380"}]}
- Wrong User/Password
XML
<?xml version="1.0" encoding="UTF-8"?> <results> <result> <status>-5</status> <messageid></messageid> <destination>6285100803380</destination> </result> </results>
JSON
{"results":[{"status":"-5","messageid":"","destination":"6285100803380"}]}
- Missing Destination Number
XML
<?xml version="1.0" encoding="UTF-8"?> <results> <result> <status>-13</status> <messageid></messageid> <destination>085100803380</destination> </result> </results>
JSON
{"results":[{"status":"-13","messageid":"","destination":"6285100803380"}]}
Additional HTTP GET commands use following syntax:
Primary access point:
http://api.nusasms.com/api/command
Currently, available commands are:
CREDITS – return your available account credits
DR – return the current status of message
output – Json, XML
Examples: Check available credits
http://api.nusasms.com/api/command?user=user&password=password&cmd=CREDITS&type=wa&output=json
API CALLBACK
Another method for collecting Delivery Status / Message status is by registering URL Call Back API in menu Account Setting on your web app account http://app.nusasms.com.
CallBack API URL will call with HTTP GET with follwing values like this examples: {“ref_no”:”053380444905641291″,”status”:”D”,”sent_date”:”2017-09-25 17:49:05.0″,”err_code”:”0″}
HTTP Method Response
Status | Value | Description |
ALL_RECIPIENTS_PROCESSED | 0 | Request was successful (all recipients) |
SEND_ERROR | -1 | Error in processing the request |
NOT_ENOUGH_CREDITS | -2 | Not enough credits on a specific account |
NETWORK_NOTCOVERED | -3 | Targeted network is not covered on specific account |
INVALID_USER_OR_PASS | -5 | Username or password is invalid |
MISSING_DESTINATION_ADDRESS | -6 | Destination address is missing in the request |
BALANCE_EXPIRED | -7 | Balance has expired |
REJECTED | -10 | OTP messages that do not use an OTP route will be REJECTED |
INVALID_DESTINATION_ADDRESS | -11 | Number is not recognized by NusaSMS platform |
MISSING_MESSAGE | -12 | Message is missing in the request |
INVALID_DESTINATION_ADDRESS | -13 | Number is not recognized by NusaSMS platform |
SYNTAX_ERROR | -22 | Incorrect XML format, caused by syntax error |
ERROR_PROCESSING | -23 | General error, reasons may vary |
COMMUNICATION_ERROR | -26 | General API error, reasons may vary |
INVALID_SENDDATETIME | -27 | Invalid scheduling parametar |
INVALID_DELIVERY_REPORT_PUSH_URL | -28 | Invalid PushURL in the request |
INVALID_CLIENT_APPID | -30 | Invalid APPID in the request |
DUPLICATE_MESSAGEID | -33 | Duplicated MessageID in the request |
SENDER_NOT_ALLOWED | -34 | Sender name is not allowed |
IP_ADDRESS_FORBIDDEN | -40 | Client IP Address Not In White List |
SPAM_PATTERN | -77 | More than 10 same message send to the same recipeints in 1 day |
LIMIT REACHED FOR DESTINATION NUMBER | -78 | Sending messages to the same number has reached the limit in 24 hours |
REJECTED ROUTE | -88 | Operator Rejected The Request |
GENERAL_ERROR | -99 | Error in processing request, reasons may vary |
PHP SAMPLE CODE
?>
Java Sample Code
System.out.println(e.toString());