📬Programmatic SMS API

If you would like to use our programmatic SMS API, do note that set-up with Nomsa team will need to be done. Please contact us here .

1. How to send demo SMS via our API

If you want to test sending demo SMS via our API please follow instruction below.

1. Visit Nomsa.gov.kh here and register with your .gov.kh mail 2. Create your API Key: visit this for more information Generate your API Key

It's almost done, now you can send demo SMS via by using our demo credential below

Demo credential Label: nomsa-sms-demo

curl --location --request POST 'https://api.nomsa.gov.kh/v1/transactional/sms/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{apikey}}
--data '{
  "body": "Demo OTP: 1234",
  "recipient": "+8559123511",
  "label": "nomsa-sms-demo"
}'

Response

{
    "id": "145",
    "credentialsLabel": "nomsa-sms-demo",
    "recipient": "855961234567",
    "body": "Demo OTP: 1234",
    "message_id": "NOMSA-TEST@IwSs5KCQMNBUQNEnh-93CptNyqBBOm",
    "created_at": "2024-01-18T07:26:55.989Z",
    "updated_at": "2024-01-18T07:26:56.775Z",
    "status": "UNSENT",
    "error_code": null,
    "accepted_at": "2024-01-18T07:26:56.774Z",
    "sent_at": null,
    "delivered_at": null,
    "errored_at": null,
    "remainingMessage": "You have SMS demo 9 left"
}

Please kindly note that we allow testing demo SMS via API only for our UAT environment

Rate Limit

If you have sent out 10 message you will reach out rate limit.

{
    "code": "rate_limit",
    "message": "You are reach out of SMS demo rate limit, Please contact Nomsa team For more information"
}

We allow only 10 message for each user to testing demo SMS via API on our UAT environment if you want to send SMS via API and setup your own credential please reach out to us to set up Nomsa SMS credential.

2. How to send SMS

curl --location 'https://api.nomsa.gov.kh/v1/transactional/sms/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{apikey}} \
--data '{
  "body": "Greeting from MCS",
  "recipient": "+8559123511",
  "label": "credentail-name"
}'

Response

{
    "id": "26",
    "credentialsLabel": "credentail-name",
    "recipient": "+8559123511",
    "body": "Greeting from DGC",
    "message_id": "MTPCXua0l_66aGE8j2zlrftKuPhPwXHkW2",
    "created_at": "2023-10-04T04:33:56.247Z",
    "updated_at": "2023-10-04T04:33:56.615Z",
    "status": "SENT",
    "error_code": null,
    "accepted_at": "2023-10-04T04:33:56.615Z",
    "sent_at": null,
    "delivered_at": null,
    "errored_at": null
}

3. GET SMS by ID

curl --location 'https://api.nomsa.gov.kh/v1/transactional/sms/{{smsId}}' \
--header 'Authorization: Bearer {{apikey}}' \

Response

{
    "id": "26",
    "credentialsLabel": "credentail-name",
    "recipient": "+8559123511",
    "body": "Greeting from DGC",
    "message_id": "MTPCXua0l_66aGE8j2zlrftKuPhPwXHkW2",
    "created_at": "2023-10-04T04:33:56.247Z",
    "updated_at": "2023-10-04T04:33:56.615Z",
    "status": "DELIVERED",
    "error_code": null,
    "accepted_at": "2023-10-04T04:33:56.615Z",
    "sent_at": null,
    "delivered_at": null,
    "errored_at": null
}

4. List all SMS

curl --location 'https://api.nomsa.gov.kh/v1/transactional/sms' \
--header 'Authorization: Bearer {{apikey}}' \
--header 'Content-Type: application/json'

Response

{
    "has_more": false,
    "data": [
        {
            "id": "27",
            "credentialsLabel": "credentail-name",
            "recipient": "+855962234519",
            "body": "Greeting from MCS",
            "message_id": "MTPC3VrS-c5Vm-2AjtVhNKi8VhKj9fbSyZ",
            "created_at": "2023-10-04T04:36:49.400Z",
            "updated_at": "2023-10-04T04:36:49.839Z",
            "status": "UNSENT",
            "error_code": null,
            "accepted_at": "2023-10-04T04:36:49.839Z",
            "sent_at": null,
            "delivered_at": null,
            "errored_at": null
        },
        {
            "id": "26",
            "credentialsLabel": "credentail-name",
            "recipient": "+8559123511",
            "body": "Greeting from MCS",
            "message_id": "MTPCXua0l_66aGE8j2zlrWlKuPhPwXHkW2",
            "created_at": "2023-10-04T04:33:56.247Z",
            "updated_at": "2023-10-04T04:33:56.615Z",
            "status": "UNSENT",
            "error_code": null,
            "accepted_at": "2023-10-04T04:33:56.615Z",
            "sent_at": null,
            "delivered_at": null,
            "errored_at": null
        }
}

Last updated