Get Responses

Estimated reading: 2 minutes 460 views

Base URL

https://cellcast.com.au/api/v3/send-mms

Method: GET

Parameters

Header ParametersDescription 
APPKEYPlease add provided APPKEY – linked to your Cellcast account 
Content-Typeapplication/json 

API Parameters

NameExampleDescription
pagePage numberPass page number.Default value is 1
typeResponse of MMSpass ‘mms’ value to get only responses of sent MMS

Successful Responses

CodeStatusDescription
200SUCCESSYou have <<Total Responses>> response(s)
ResponseDescription
fromRecipient Mobile Number that sent the reply message.
bodyInbound message body.
received_atReceived date and time.
original_bodyOriginal outgoing MMS message body.
original_message_idOriginal MMS message ID. Returned when originally sending the message.
message_idThe Message ID for the inbound message.
Successful Response look like
				
					{
    "meta": {
        "code": 200,
        "status": "SUCCESS"
    },
    "msg": "You have 1 response(s)",
    "data": {
        "page": {
            "count": 1,
            "number": 1
        },
        "total": "1",
        "responses": [
            {
                "from": "+614NNNNNNNN",
                "body": "Received ",
                "received_at": "2019-04-08 17:37:49",
                "original_body": "Please reply Thank You",
                "original_message_id": "A21741CB-9B8E-3956-A1CE-NNNNNNNNNN", // Outbound ID
                "message_id": "dba864ec-e486-4647-82c4-d0b94771080b", // Response Message ID(inbound_id)
                "subaccount_id": "" // Sub account email address
            }
        ]
    }
}
				
			

Error Response

StatusCodeDescription
AUTH_FAILED400You are not a registered user
NOT_FOUND400No Response are available!
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 MMS responses.

				
					function getMmsResponses($page = 1) {
    try {
        $url = 'https://cellcast.com.au/api/v3/get-responses?page=' .$page .'&type=mms'; //API URL
        $headers = array(
            'APPKEY: <<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_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 4);
        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 received", "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 mms status function
$response_status = getMmsResponses(<<page_number>>);