}}
    Show / Hide Table of Contents

    Non-Personalised Messaging

    With non-personalised messaging, each phone number added to the destinations list receives the same message content as received by others. In this section, we wil be looking at how to send non-personalised messages.

    In the discussions that follow, we will be looking at how to construct the request data values in form of key=value pairs. Then depending on whether the HTTP GET or POST will be used, the request data values will be appended or added as part of the request when submitting to the following SMS request URL

    https://api.smsonlinegh.com/v5/message/sms/send
    

    Request Data Parameters

    To send SMS, applications making requests must set values for mandatory and or optional parameters. For both non-personalised and Personalised SMS, the mandatory parameters are key, text, type, sender, and to.

    The values for the parameters must be set as key=value pairs separated by &. For example,

    key=API_KEY&text=MESSAGE_TEXT&type=MESSAGE_TYPE&sender=SENDER_ID&to=PHONE_NUMBER,PHONE_NUMBER
    

    When sending the request using the HTTP GET method, the key=value pairs data must be appended to the base request URI https://api.smsonlinegh.com/v5/message/sms/send separated by ?.

    For example:

    https://api.smsonlinegh.com/v5/message/sms/send?key=API_KEY&text=MESSAGE_TEXT&type=MESSAGE_TYPE&sender=SENDER_ID&to=PHONE_NUMBER,PHONE_NUMBER
    

    WIth HTTP POST method however, the data values should not be appended to the request URI. A brief description of the required parameters is discussed as follows.

    API Key

    This is a unique API access key that identifies the account making the request.

    Parameter Info Description
    Parameter Name key
    Parameter Type String
    Required Yes

    Set the account API Key in the request data values as key=YOUR_API_KEY

    Message Text

    This is the message text that should be sent to the recipients.

    Parameter Info Description
    Parameter Name text
    Parameter Type String
    Required Yes

    Set in request data values as text=MESSAGE_TEXT. For example, text=Hello world!

    If the HTTP GET method will be used to send the request by appending the data values to the request URI, then the message text should be URL encoded before setting to text parameter. That is, text=Hello+world%21.

    Message Type

    A numerical value that specifies the type of SMS to be sent. SMS message types are discussed at Message Types.

    Parameter Info Description
    Parameter Name type
    Parameter Type Integer
    Required Yes

    Set in request data values as type=MESSAGE_TYPE. For example, type=0. A reference to the message types that can be set can found at Message Types.

    Sender

    This is a short name that is shown on recipients' phone as the sender of the message. It is limited to a maximum of 11 characters. It must be emphasised that whitespaces will also be counted as characters.

    Parameter Info Description
    Parameter Name sender
    Parameter Type String
    Required Yes

    This value for the message sender name must be set to the sender parameter as sender=SENDER_ID. If the HTTP GET method will be used to send the request by appending the data values to the request URI, then the Sender ID must be URL encoded before setting it to the sender parameter.

    Note

    The value set as sender must exist in the list of user message sender names. If the name has not been added in user message sender names, then the message will not be submitted. The sender name must be requested from the user account under SMS Messaging menu option.

    Destinations

    The message destinations are the phone numbers that will receive the message. Multiple phone numbers should be separated with comma. It should be set the the parameter name to.

    Parameter Info Description
    Parameter Name to
    Paramter Type String
    Required Yes

    The message destinations should be set in request data values as to=PHONE_NUMBER. If there are multiple phone numbers, they should be separated with a comma. Eg., to=PHONE_NUMBER,PHONE_NUMBER,PHONE_NUMBER.

    Submitting Request

    The following example shows a request data for sending the message Hello world! to some phone numbers.

    key=API_KEY&text=Hello world!&type=0&sender=SENDER_ID&to=0246314915,233242053072,0207729851
    

    Submitting with HTTP GET

    When submitting request with HTTP GET method, the request data should be appended to the request URI separated by ?. This method requires that you URL encode the values for key, text, and sender.

    GET https://api.smsonlinegh.com/v5/message/sms/send?key=API_KEY&text=Hello+world%21&type=0&sender=SENDER_ID&to=0246314915,233242053072,0207729851
    Content-Type: application/x-www-form-urlencoded
    Accept: application/json
    

    Submitting with HTTP POST

    With HTTP POST request submission, the request data need not be appended to the request URI. It should be added as part of the request body.

    When using the POST method, it is not necessary to URL encode values for the parameters.

    POST https://api.smsonlinegh.com/v5/message/sms/send
    Content-Type: application/x-www-form-urlencoded
    Accept: application/json
    
    key=API_KEY&text=Hello world!&type=0&sender=SENDER_ID&to=0246314915,233242053072,0207729851
    
    Back to top