Skip to main content

SMS API

Use this endpoint for sending a single transactional SMS. Examples of this could be sending a verification code to a user via SMS or another similar type of notification.

Basic Example​

GET https://cuetechnologies.sms-console.com/json?action=message_send&username=userx&password=passwordy&to=27820123456&from=12345&text=URL+encoded+text+string&client_reference=REF123456

Parameters​

ParameterValue exampleRequiredDescription
actionmessage_sendRequiredSet to message_send for this endpoint
username<your_username>RequiredYour account username
password<your_password>RequiredYour account password
to27821230000RequiredRecipientʼs phone number
from27821230000RequiredSender ID – this can be any value and can be used as an internal reference
textYour OTP is: 12345RequiredURL Encoded message text content
client_referenceREF123456OptionalYour own reference code that will be returned in status updates.
charsetOptionalDefaults to GSM 7 bit (Advanced)
auto_detect_encodingOptionalDefault to “yes”, this ensures that is special characters are used the system will encode the message correctly. This may incur extra costs.
report_maskOptionalDefaults to 19, only used with report_url
report_urlOptionalIf provided, our system will call this URL with a delivery status update for the message

Example HTTP Responses​

200

{
"status": 1,
"message": "Sent",
"details": "8beda1a8–5c12–489f-0107–123000000003"
}

Response Codes​

The API will return a JSON object with a status and message field. The status field indicates the overall success or failure of the request.

Status CodeMessageDescription
1SentThe message was successfully sent.
2QueuedThe message has been queued for sending.
-1System ErrorAn unexpected error occurred on the server.
-2Authentication FailedThe username or password provided is incorrect.
-3No CreditYour account has insufficient credit to send the message.
-4Invalid DestinationThe recipient's phone number is invalid.
-5Invalid Sender IDThe 'from' parameter is invalid or not allowed for your account.
-6Invalid ParameterA required parameter is missing or an invalid value was provided for a parameter.
-7Duplicate Client ReferenceThe client_reference provided has already been used.
-8Message Too LongThe message text exceeds the maximum allowed length.
-9Blacklisted DestinationThe recipient's phone number is on a blacklist.
-10Account SuspendedYour account has been suspended.
-11Feature Not EnabledThe requested feature is not enabled for your account.
-12Missing Required ParameterA parameter marked as 'Required' was not provided.
-13Invalid ActionThe 'action' parameter is invalid.
-14Invalid Character SetThe 'charset' parameter is invalid.
-15Invalid Report MaskThe 'report_mask' parameter is invalid.
-16Invalid Report URLThe 'report_url' parameter is invalid.

Delivery Reports via API​

When sending a message with Cue, you can also provide a URL to receive a callback with the delivery status update of this message. If using HTTPS, you need to add two additional fields to your request:

  • report_url: The HTTP URL for us to request when the status changes
  • report_mask: Which status messages you would like to receive

What is a report mask?​

The report mask is what is known as a bitmask field indicating which status messages you want to receive.

What are the different delivery status codes?​

Status CodeDescription
1Delivered
2Undelivered
4Queued at network
8Sent to network
16Failed at network

How to calculate the report mask?​

To calculate the report mask, you need to pick the status codes you want to receive, and then add them together! And that’s your report mask.

For example, I want to know whether my message was delivered or failed. (1, 2, and 16)

report_mask = 1 + 2 + 16 = 19

So, in your next request, send report_mask=19 and we’ll send you these status messages where applicable.

Give me an example:​

Ok, so we want to send a message and receive status reports to our server when the message is delivered or fails.

Our request parameters will look like this:

ParameterExample Value
usernamemyusername
passwordmypassword
to27821340000
from271112221113
textHello there, we are testing delivery reports!
report_mask19
report_urlhttp://myserver.com/receive_report.php?myMessageId=12345&status=%d

The resulting URL (once we encode the data) for the request will look like this:

https://cuetechnologies.sms-console.com/json?action=message_send&username=myusername&password=mypassword&to=27821340000&from=271112221113&text=Hello+there%2C+we+are+testing+delivery+reports%21&report_mask=19&report_url=http%3A%2F%2Fmyserver.com%2Freceive_report.php%3FmyMessageId%3D12345%26status%3D%25d