Create a new brand, Start your business now!

Learn how to publish and retrieve data from SMS123.net by using our API integration

Introduction

The API we provide programmatic access to SMS123 features and data. In designing the API, our goal was to make it simple, intuitive, and predictable. The standards used in this API are widely accepted standards such as using POST to access the API and XML format for the returned data.
We use POST HTTP request instead of GET is because it has no restrictions on data length. Thus, the output can contain long sentences that returned by the API.
POST supports binary data type as well. Hence the possibilities of user uploading images to change their logo.
For security concern, POST is a little safer because the parameters are not stored in browser history and web server logs unlike GET.
By using POST, the URL will remain clean because the data will not be displayed in URL.

GET method send SMS

https://www.sms123.net/api/send.php?apiKey=[APIKEY]&recipients=[RECIPIENTS]&messageContent=[MESSAGE]&referenceID=[CUSTOMREFERENCEID]

[APIKEY] API Key. (Find your API key at www.sms123.net My Account > Settings)
[RECIPIENTS] Recipient mobile number.
- Mobile number with country code.
- Once recipient one request.
- One recipient one request.
- You can use semi-colon(;) to separate each recipient without space when sending multiple recipients.
[MESSAGE] Message body.
- A single SMS may contain 160 characters, or 70 characters for Unicode.
- Concatenated SMS may contains 152 characters, or 63 characters for Unicode.
- All Malaysia mobile number will be minus 7 characters “RM0.00” at the beginning of each SMS content.
- Maximum of 10 concatenated SMS.

As per SKMM guidelines, you shall include price information at the beginning of each SMS. You shall use either “Free msg/RM0.00/Msj ini percuma” at the beginning of the SMS content. For more information, please read our Terms & Conditions.
[CUSTOMREFERENCEID] An unique reference id from your system to avoid duplicate request.
[STATUS] Show the status for send SMS (ok / error)
[MSGCODE] Show code to represent particular status.
[REFERENCEID] Your reference for any future enquiries.
[BALANCE] Your account current balance.
[DATA] Each recipient sending reference ID.


Request and Response format


Request

https://www.sms123.net/api/send.php?apiKey=[APIKEY]&recipients=[RECIPIENT]&messageContent=[MESSAGE]&referenceID=[CUSTOMREFERENCEID]

Response

{"status":"[STATUS]","msgCode":"[MSGCODE]","statusMsg":"[ STATUSMSG]","referenceID":"[ REFERENCEID]"," balance":"[ BALANCE]", "data": "[DATA]" }

*Response array encoded with JSON

Example code for request and response


Request

  • Single recipient
    https://www.sms123.net/api/send.php?apiKey=22f277843206d477d3cd4ae1c9220bc3&messageContent=Testing%123&recipients= 6010xxxxxxx&referenceID=ba63ht12opab6

  • Multiple recipients
    https://www.sms123.net/api/send.php?apiKey=22f277843206d477d3cd4ae1c9220bc3&messageContent=Testing%123&recipients= 6010xxxxxxx;6012xxxxxxx&referenceID=iyr340hbc6ja0b

Response

  • Single recipient - Successful
    {"status":"ok","msgCode":"E00001","statusMsg":"Completed successfully.","referenceID":["q5c502192aa869"],"balance":8901,"data":[{"recipients":"6010xxxxxxx","referenceID":"q5c502192aa869"}]}

  • Multiple recipients - Successful
    {"status":"ok","msgCode":"E00001","statusMsg":"Completed successfully.","referenceID":["q5c5021c306a95","q5c5021c306ae8"],"balance":8901,"data":[{"recipients":"6010xxxxxxx","referenceID":"q5c5021c306a95"},{"recipients":"6012xxxxxxx","referenceID":"q5c5021c306ae8"}]}

  • Unsuccessful
    {"status":"error","msgCode":"E00242","statusMsg":"invalid recipient(s).","invalidRecipients":["6010999999999"]}
*Response array encoded with JSON

Status Code List

Status Code Description
E00001 Completed successfully.
E00081 Account not active yet. Please contact our support.
E00242 Invalid recipient(s).
E00243 Please enter your message.
E00249 Maximum 10 SMS per recipient(s).
E00248 Please enter at least one recipient.
E00250 Insufficient balance.
E00253 Maximum 100 recipient(s).
E00359 Invalid API Key.
E00366 The message content contains international brand(s).
BE00035 The message not allow to send without company name.
BE00036 The message not allow to send without whitelisted.
BE00096 Duplicated reference id found.
BE00128 Completed successfully(low balance).

SMS123 Add Template through API

Post to SMS123


  • Post details are as below:
    URL: https://www.sms123.net/api/smsAddTemplate.php

  • Variable should be passed in with format below:
    Sample Data In
    {"apiKey ":"abc88888888acbde","email":"[email protected]","templateTitle":" AddTemplate02Jun2020","messageContent":"Hi, add template through api on 02 June 2020.","referenceId":"567890"}

    Param Data Type Description Sample
    apiKey Varchar API Key. (Find your API key at www.sms123.net My Account > Settings) abc88888888acbde
    email Varchar Email. (Find your API key at www.sms123.net My Account > Settings) [email protected]
    templateTitle Varchar Template title to be add AddTemplate02Jun2020
    messageContent Text Message content wanted to submit for whitelist Hi, add template through api on 02 June 2020.
    referenceId Varchar Reference ID to be return for you when status callback 567890

  • To be more secure, only POST method is accepted, GET method will not be accepted.

    ** apiKey, email, templateTitle and messageContent is necessary to pass in, but referenceId is not compulsary. If referenceId is passed from your site, we will return the same referenceId when callback for template status.
    ** Add template through API will be consider as submitted.

Return submitted template status to client site


  • Perform steps below to allow callback status after we approved or rejected your template:
    1. Pass your return URL to u
      [your website URL]/[your file path]
      For example: https://www.sms123.net/callback/receiveCallbackStatus.php
      https://www.sms123.net => [website URL]
      callback/receiveCallbackStatus.php => [file path]

    2. Tick the checkbox name as "Enable SMS Add Template Status Callback" at settings -> SMS Template Status Through API Callback section

  • Details below will be returned:
    Sample Data Return
    {"action":"templateStatusCallback","actionCode":"E00101","status":"Approved"," messageContent":"Hi, add template through api on 02 June 2020.","referenceId":"567890"}

    Param Data Type Description Sample
    action String Return command templateStatusCallback
    actionCode String Return Code E00101
    status String Template status Approved
    messageContent String Whitelisted message content Hi, add template through api on 02 June 2020.
    referenceId String Reference ID you passed to us when submit template 567890

    *Response array encoded with JSON

Status Code List

Status Code Description
E00101 Approved
E00102 Rejected
E00103 Others

GET method to get Account Balance

https://www.sms123.net/api/getBalance.php?apiKey=[APIKEY]&email=[EMAIL]

[APIKEY] API Key. (Find your API key at www.sms123.net My Account > Settings)
[EMAIL] Email. (Find your API key at www.sms123.net My Account > Settings)

Request and Response format


Request

https://www.sms123.net/api/getBalance.php?apiKey=[APIKEY]&email=[EMAIL]

Response

{"status":"[STATUS]","msgCode":"[MSGCODE]","statusMsg":"[ STATUSMSG]"," balance":"[ BALANCE]"}

*Response array encoded with JSON

Example code for request and response


Request

https://www.sms123.net/api/getBala[email protected]gmail.com

Response

{"status":"ok","msgCode":"E00001","statusMsg":"Completed successfully.","balance":"120.22"}

*Response array encoded with JSON

Status Code List

Status Code Description
E00001 Completed successfully.