Inbound Read
Estimated reading: 3 minutes
625 views
Base URL
https://cellcast.com.au/api/v3/inbound-read
Method: POST
Parameters
Header Parameters | Description |
---|---|
APPKEY | Please add provided APPKEY – linked to your Cellcast account. |
Content-Type | application/json |
API Parameters
Name | Example | Description |
---|---|---|
message_id | Response of Message ID | The Message ID for the inbound message. We are consider first “message_id” parameter. |
date_before | Date timestamp | An optional timestamp – mark all as read before this timestamp. If not given, all messages will be marked as read. |
You can use one parameter at a time. If you want to change status using message_id then you just need to pass message_id. If you want to mark all as read before given timestamp then you can pass only “date_before” parameter.
You can set the status of inbound messages of your account.
Successful Responses
Code | Status | Description |
---|---|---|
200 | SUCCESS | You have <<Total Responses>> response(s) |
Successful Responses look like
{
"meta": {
"code": 200,
"status": "SUCCESS"
},
"msg": "Inbound messages have been marked as read.",
"data": []
}
Error Response
Status | Code | Description |
---|---|---|
AUTH_FAILED | 400 | You are not a registered user |
Error Responses look like
{
"meta": {
"code": 401,
"status": "AUTH_FAILED"
},
"msg": "APPKEY you have provided is invalid",
"data": []
}
PHP Code Example
You can call following function to get SMS responses.
function setSmsInboundStatus($timestamp) {
try {
$url = 'https://cellcast.com.au/api/v3/inbound-read'; //API URL
$fields = array(
'message_id' => $message_id, //here goes your inbound message ID
);
// If you want to mark all inbound message as read optionally before a certain date.
//$fields = array(
// 'date_before' => $date_before, //here goes your inbound message ID
//);
$headers = array(
'APPKEY: <>',
'Accept: application/json',
'Content-Type: application/json',
);
$ch = curl_init(); //open connection
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (!$result = curl_exec($ch)) {
$response_error = json_decode(curl_error($ch));
return json_encode(array("status" => 400, "msg" => "Something went to wrong, please try again", "result" => $response_error));
}
curl_close($ch);
return json_encode(array("status" => 200, "msg" => "Successfully set status", "result" => json_decode($result)));
} catch (\Exception $e) {
return json_encode(array("status" => 400, "msg" => "Something went to wrong, please try again.", "result" => array()));
}
}
Call Function
//Call function to get sms status function
$response_status = setSmsInboundStatus(<>);