Quick Send SMS
This API is to send SMS messages using the Cellcast API. The API detects any invalid contact numbers and return which numbers are invalid or unsubscribed on the response body, ensuring that messages are sent only to valid and subscribed numbers.
Parameters for Send SMS API
Headers Parameters
Parameters | Description |
---|---|
Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Request Body Parameters
Name | Example | Description |
---|---|---|
sender | #SharedNum# or Sender ID (Custom ID) | Sender ID (Custom ID): Valid characters: A-Z a-z 0-9, space, and Dash (-). A numeric sender ID can be a maximum length of 16 digits. An alpha-numeric Sender ID can be a maximum length of 11 characters. If 'sender' is left blank, the system will default to '#SharedNum#'. *Note: Price increases to 1.3 credits per SMS for Custom ID and dedicated numbers. |
message | SMS Text goes here | String - Required field. To add a new line to the message, use "\r\n" in the message string with only double quotes. |
contacts | ["+61400000000"] | JSON encoded Array - Required field. To send multiple SMS messages, provide the recipient numbers in a JSON-encoded array, such as ["+61400000000", "+61400000001"]. You can include up to 1,000 numbers in a single API call. Supported number formats include : "+61400000000", "61400000000", "0400000000", "400000000" |
countryCode | 61 | Allowed values: 61 |
longUrl | [{"longUrl": "www.google.com", "shortUrl": "goo"}] | Generate a unique short link that redirects to the specified long URL. Include this link in your message using the format gosite.au/ (for example, gosite.au/goo). This will embed the generated short link in your message. Note: shortUrl must be at least three alphanumeric characters. |
scheduleAt | 2024-08-14T14:58:00.981Z | Leave blank for immediate delivery. Your schedule time should be in Y-m-d H:i:s format UTC+0 Time |
delay | 60000 | Leave blank for immediate delivery. Your delay time should be in miliseconds. Allowed max 86400000 miliseconds (24 Hours) |
Code Samples
Post https://api.cellcast.com/api/v1/gateway
bash
curl --location 'https://api.cellcast.com/api/v1/gateway' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{API_KEY}}' \
--data '{
"message": "Test Message Visit gosite.au/goo ",
"contacts": [
"+61400000000"
],
"sender": "+61400000001",
"longUrl": [
{
"longUrl": "www.google.com",
"shortUrl": "goo"
}
]
}'
js
const axios = require("axios");
const sendSMS = async () => {
try {
const response = await axios.post(
"https://api.cellcast.com/api/v1/gateway",
{
message: "Test Message Visit gosite.au/goo",
contacts: ["+61400000000"],
sender: "+61400000001",
longUrl: [
{
longUrl: "www.google.com",
shortUrl: "goo"
}
]
},
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer {{API_KEY}}",
},
}
);
console.log(response.data);
} catch (error) {
console.error(error.response.data);
}
};
Replace with the actual API key that you own.
Responses
Response Body
Name | Example | Description |
---|---|---|
MessageId | 675161d8a000000000000000 | A unique identifier for the message, automatically generated by the system. |
Contact | 400000000 | The contact number formatted by the system after processing the request. |
Number | +61400000000 | The contact number provided in the request body. |
200 Success
json
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": true,
"message": "Request is being processed",
"message_type": "toast",
"data": {
"queueResponse": [
{
"Contact": "400000000",
"MessageId": "6752c2575e08b2d1eca6d294",
"Result": "Message added to queue.",
"Number": "+61400000000"
}
],
"message": "success register all valid contacts to queue",
"invalidContacts": [],
"unsubscribeContacts": [],
"totalValidContact": 1,
"totalInvalidContact": 0,
"totalUnsubscribeContact": 0
},
"error": {}
}
400 Bad Request
json
{
"code": 400,
"message": "Contacts must either start with 61 or +61 and be exactly 11 digits long (e.g., 614xxxxxxxx or +614xxxxxxxx), or be 9 digits without the area code (e.g., 4xxxxxxxx)",
"stack": "APIError: Contacts are required."
}
422 Unprocessable Entity (Credit is too Low)
json
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": false,
"message_type": "toast",
"message": "Your balance is too low for this request, please recharge.",
"data": {},
"error": {
"errorMessage": "Your balance is too low for this request, please recharge."
}
}
401 Unauthorized
json
{
"code": 401,
"message": "Token expired",
"stack": "APIError: Token expired ...."
}