Shared Short Codes

The premium SMS platform provided by aql.com is a flexible way of receiving messages via short codes, identifying the source network provider and sending the appropriate billing messages to gain revenue.

Connection Details

The premium SMS platform provided by aql.com is a flexible way of receiving messages via short codes, identifying the source network provider and sending the appropriate billing messages to gain revenue.

https://gw.aql.com/sms/gw-premium.php

Although we do offer the standard HTTP gateway, we do prefer that your application uses the HTTPS gateway as it prevents sensitive details being sniffed across the internet.

Overview of Transactions

The basic process for making a billing request for a user is:

  • End user sends a text message to your keyword on the short code.
  • Our system records the message details and sends the appropriate response depending on how your keyword is set up. To bill a user this should be set to httppost.
  • Your application decides whether to bill the end user, if so, posting back to our gateway with a message to send back, as well as the unique identifier.
  • Once the message has been accepted, when we receive a delivery notification we can optionally post back to your application notifying you that the message was accepted / rejected from the phone.

During step three, when your application posts to our gateway it can flag whether to close use of the key again. This prevents further billing to this end user without an addition MO being received through the short code.

Note, even if the message is accepted at the end users phone, it is still possible that payment will not be taken. This can be due to a variety of reasons, such as the end user rejecting the payment/the phone not having sufficient credit at the time the message is received.

Gateway Details

When we receive a MO (Mobile Originated) message to a keyword assigned to your account, we will send the details on to you by the method specified on aql.com.

In order to bill your customers this would need to be set to HTTP POST, this POST will contain the following details:

Variable Name Description
Variable Name: request_type Description: This is the type of request, in this case it will be set to new
Variable Name: shortcode Description: The short code number
Variable Name: sender Description: The sender phone number
Variable Name: message Description: The message that was sent
Variable Name: timestamp Description: The timestamp of when the message was received
Variable Name: msgkey Description: A unique key associated with the MO message. This is needed for billing

Once your application has received these details, it can either ignore the request and not send back response thus not charging the end user or send back a HTTP post back to our server requesting that the end user is charged (at the tariff associated with the short code).

The details that your application would need to post back to our gateway area:

Variable Name Description
Variable Name: username Description: Your aql.com username
Variable Name: password Description: Your aql.com password
Variable Name: shortcode Description: The short code associated with the request
Variable Name: destination Description: The destination number (Must be exactly the same as the number sent by using previous request)
Variable Name: type Description: Must be set to either text or flash or wap_si
Variable Name: msgkey Description: msgkey sent with the original request
Variable Name: status Description: Final status of request, either open or close
Variable Name: report Description: Request delivery report, either yes or no
Variable Name: user_ref Description: This is an identifier for the request; it can be set to any alphanumeric string, up to 20 characters

Depending on the type defined, the following fields may be required:

For the Types Text or Flash

Variable Name Description
Variable Name: data Description: Message data (max 160 characters)

For the Types wap_si

Variable Name Description
Variable Name: wapname Description: The Name data used in the WAP push
Variable Name: wapurl Description: The URL of the WAP document
Variable Name: msg_limit Description: This is the number of messages the request can span (1, 2 or 3)

Note that if the status of the request is set to open, it allows further billing requests to be made using the same msgkey and destination number in the future. In this case, the user reference can be changed for each following charge request. This allows your application to identify each request (and associated delivery report). However, if the status is set to close, this will prevent further billing attempts being made using the msgkey and destination number combination. To allow further billing in this case, a new MO message must be received on the short code, giving a new msgkey.

When using the wap_si type, the msg_limit field is used to limit the number of billing messages sent, as if the combined length of the URL and name exceed 96 characters, the push will have to span two messages. If the message has to span two messages, two billing messages will be sent, hence charging the end user twice. The default limit is set at one message, and if the limit is reached, the error GW-MSGLIMIT_REACHED will be given.

If report was set to yes, when we receive a delivery report back from the destination mobile, another request will be made to your application sending the following HTTP Post details:

Variable Name Description
Variable Name: request_type Description: This is the type of request, this case it will be set to report
Variable Name: user_ref Description: This is the user_ref submitted in the original billing request sent by you
Variable Name: msgkey Description: A unique key associated with the MO message. This will allow you to match the report with the original request
Variable Name: status Description: The status of the message

HTTP Gateway Error Codes

Below is a table of response codes from the HTTP interface:

Error Code Description
Error Code: GW-NO_AUTH_DETAILS Description: No authentication details were provided
Error Code: GW-AUTH_ERROR Description: There was an error in authenticating based on the details provided
Error Code: GW-KEY_INVALID Description: The key provided was invalid (must only contain characters a-z, A-Z, 0-9)
Error Code: GW-SHORTCODE_NOTFOUND Description: The short code was not found associated with your account
Error Code: GW-SHORTCODE_INACTIVE Description: The short code is inactive – contact support for details
Error Code: GW-SHORTCODE_CLOSEDGW Description: The key for this transaction has been closed for use
Error Code: GW-SHORTCODE_CLOSEDCLIENT Description: The key for this transaction has been closed by the client
Error Code: GW-SHORTCODE_FAIL Description: Details for the short code could not be retrieved
Error Code: GW-OK Description: Message accepted
Error Code: GW-FAIL Description: There was an error in queuing the message. Please contact support
Error Code: GW-STATUS_INVALID Description: The status provided was invalid / missing
Error Code: GW-USER_REF_INVALID Description: The User reference you provided was invalid / missing
Error Code: GW-MSGLIMIT_INVALID Description: The value provided was not a valid number (1, 2 or 3)
Error Code: GW-TYPE_INVALID Description: The message type was invalid (either text, flash or wap_si)
Error Code: GW-DATA_INVALID Description: The data field was missing
Error Code: GW-WAPNAME_INVALID Description: The wapname field was missing
Error Code: GW-WAPURL_INVALID Description: The wapurl field was missing
Error Code: GW-ENCODE_FAIL Description: The gateway failed to encode the binary message
Error Code: GW-MSGLIMIT_REACHED Description: The binary message needed to span more messages than the limit set
Error Code: GW-REPORT_INVALID Description: The report field was invalid (should be yes or no)

Status Descriptions

Possible values of the status variable are:

Status Description
Status: phonesent Description: The destination phone has accepted the message
Status: phonefail Description: The destination phone has rejected the message
Status: smscsent Description: The destination network has accepted the message on behalf of the destination number
Status: smscfail Description: The destination network has rejected the message on behalf of the destination number
Status: fail Description: The message has failed

An Example Flow of Requests During a Billing Transaction

This is the message from the mobile to the short code (this is a dump of the variables posted):

array(7) {
    ["request_type"] => string(3) "new"
    ["shortcode"] => string(4) "1000"
    ["sender"] => string(12) "447789123456"
    ["message"] => string(14) "This is a test"
    ["timestamp"] => string(19) "2004-01-26 16:07:43"
    ["msgkey"] => string(32) "966cf073923aa0793d1ecabbd10ba1bf"
}

Your application would then post back details similar to the following (N.B. all fields are required), which would initiate the MT billing request:

array(11) {
    ["username"] => string(7) "testaccount"
    ["password"] => string(5) "testpwd"
    ["shortcode"] => string(4) "1000"
    ["destination"] => string(12) "447789123456"
    ["type"] => string(4) "text"
    ["data"] => string(30) "This is the MT Billing message"
    ["msgkey"] => string(32) "966cf073923aa0793d1ecabbd10ba1bf"
    ["status"] => string(4) "open"
    ["report"] => string(3) "yes"
    ["user_ref"] => string(6) "123abc"
}

As in the MT billing request a status report was requested, when we receive any form of delivery confirmation, another HTTP POST would be made similar to the following:

array(4) {
    ["request_type"] => string(6) "report"
    ["user_ref"] => string(4) "123abc"
    ["msgkey"] => string(32) "966cf073923aa0793d1ecabbd10ba1bf"
    ["status"] => string(9) "phonesent"
}

If, at a later date, you wish to bill the client again (e.g. a subscription service), you would need to send another MT Billing request, for example:

array(11) {
    ["username"] => string(7) "testaccount"
    ["password"] => string(5) "testpwd"
    ["shortcode"] => string(4) "1000"
    ["destination"] => string(12) "447789123456"
    ["type"] => string(4) "text"
    ["data"] => string(39) "This is the MT Billing message number 2"
    ["msgkey"] => string(32) "966cf073923aa0793d1ecabbd10ba1bf"
    ["status"] => string(5) "close"
    ["report"] => string(3) "yes"
    ["user_ref"] => string(6) "456abc"
}

In this case again, a status report was requested, therefore you would receive a similar delivery confirmation as before:

array(4) {
    ["request_type"] => string(6) "report"
    ["user_ref"] => string(4) "456abc"
    ["msgkey"] => string(32) "966cf073923aa0793d1ecabbd10ba1bf"
    ["status"] => string(9) "phonesent"
}

After this, as the status was set to close, no further billing requests would be possible to this number using the msgkey. A new MO message would have to be received.

Technical Support

For technical support and further queries about the Premium SMS platform, please launch a support ticket, by going to the address: http://support.aql.com using your aql username and password to login.

AutoJemma®

How can I help you today?

Can't find what you're looking for, ask a question below!

Additional Details

AutoJemma® can make mistakes, please verify any critical information.