Example of simple concatenated SMS form which uses our HTTP POST API.
*note - the bash script is also a notification script which can be used by Nagios users. For more information, please see here.
Server Response Codes
When an sms request is posted to our gateway, it will issue one of the following responses,
which you can log or echo to your client or trigger an event.
AQSMS-NOAUTHDETAILS = The username and password were not supplied
AQSMS-AUTHERROR = The username and password supplied were incorrect
AQSMS-NOCREDIT = The account specified did not have sufficient credit
AQSMS-OK = The message was queued on our system successfully
AQSMS-NOMSG = No message or no destination number were supplied
AQSMS-CREDIT = <number of messages> The output if the string cmd=credit is added to
the query - allowing users to track their account balance via our http interface : eg.
http://gw.aql.com/sms/postmsg.php?username=yourusername&password=yourpassword&cmd=credit
This means that you can use the aql textback service and log the clients data
via your own server and database rather than the data being stored on our system.
We can also offer support and consultancy on this subject. In addition we can
accept your SIM cards for incorporation into our modem banks. This will allow
us to accept text messages on your own private number without the need for a keyword. Contact
us for prices.
Delivery Notification via HTTP GatewayDefinition modification :
to_num = comma seperated list of mobile numbers. Please make sure the whole list conains no spaces
e.g. to_num=4477111111,4477222222,4477333333Server Response Code modifications:
AQSMS-OK:x = From the list above, x messages were queued on our system successfully. This response code will be received in place of AQSMS-OK
If any of the numbers are invalid, this gateway will still send messages to the valid numbers. The 'x' reflects the number of VALID mobile numbers that messages were queued for. It is recommended that all mobile numbers be validated before they are sent to the gateway.
When sending messages via our systems, it is possible to track the delivery status of each message. This can be accomplished by appending an extra variable to the postmsg.php request:
Along with setting the username, password, destination number, message (and optionally the originator), the variable "dlrurl" can be specified which includes an URL Encoded address of a script on your server, with 2 optional parameters included. An example of this use is shown below:
Sending a message with the following details:
username=test
password=test
to_num=447740123456
orig=aql
message=this is my message
dlrurl = http://test.aql.com/deliveryreport.php?reportcode=%code&destinationnumber=%dest&myreference=123
The dlrurl has 2 special values in it - %code and %dest - these are substituted for the real report code and destination number. Any other variables can be set by you for your own tracking of the message submitted, for example myreference in this case.
%dest = destination number of message
%code = delivery report code
The %code values are:
1 = Delivered to Handset
2 = Rejected from Handset
4 = Buffered in transit (phone probably off / out of reception)
8 = Accepted by SMSC
16 = Rejected by SMSC
All of the details of the message have to be encoded for sending via a HTTP
GET request, so put together - the final request looks like:
http://gw.aql.com/sms/postmsg.php? username=test&password=test&to_num=447740123456&orig=aql& message=this+is+my+message&dlrurl=http%3A%2F%2Ftest.aql.com%2Fdeliveryreport.php%3Freportcode%3D%25code%26destinationnumber%3D%25dest%26myreference%3D123
Once the message gets processed, our system would simply call the address set by dlrurl, substituting %code for the delivery code value and the same for the %dest value. So, if the message were successfully delivered to the handset, your system would receive the following request:
http://test.aql.com/deliveryreport.php?reportcode=1& destinationnumber=447740123456