/** * Gets a single message by it's ID. * * @param string|int $messageId * * @return \SimpleSoftwareIO\SMS\IncomingMessage */ public function getMessage($messageId) { $rawMessage = $this->plivo->get_message(['record_id' => $messageId]); $incomingMessage = $this->createIncomingMessage(); $this->processReceive($incomingMessage, $rawMessage); return $incomingMessage; }
/** * Get Specific Message Details * * @param $uuid * @return array */ public function getMessage($uuid) { if (empty($uuid)) { return 'No UUID specified'; } $data = ['record_id' => $uuid]; return $this->plivo->get_message($data); }
<?php require 'vendor/autoload.php'; use Plivo\RestAPI; $auth_id = "Your AUTH_ID"; $auth_token = "Your AUTH_TOKEN"; $p = new RestAPI($auth_id, $auth_token); $params = array('record_id' => '0936ec98-7c4c-11e4-9bd8-22000afa12b9'); // Fetch the details $response = $p->get_message($params); // Print the response print_r($response['response']); // Print the number of SMS units print "Units : {$response['response']['units']}"; // Print the status of the message print "Message State : {$response['response']['message_state']}"; ?> <!-- Sample Output ( [api_id] => 0a7cf0e6-a264-11e4-a2d1-22000ac5040c [from_number] => 1111111111 [message_direction] => outbound [message_state] => delivered [message_time] => 2014-12-05 10:57:54+04:00 [message_type] => sms [message_uuid] => 0936ec98-7c4c-11e4-9bd8-22000afa12b9 [resource_uri] => /v1/Account/XXXXXXXXXXXX/Message/0936ec98-7c4c-11e4-9bd8-22000afa12b9/ [to_number] => 2222222222 [total_amount] => 0.02600