The Message object

A message detail record (MDR) is generated for every message sent/received by Plivo.

An MDR object has the following attributes.

Attributes

message_uuid string

This is a 36 character string that uniquely identifies a message detail record.

message_time string

This is the exact timestamp at which an outbound message was initiated or an inbound message was received.

message_direction string

This attribute indicates the direction of the message. It is set to outbound for messages sent out from Plivo's platform. It is set to inbound for messages received on Plivo numbers.

message_state string

This attribute indicates the current status of the message.

Outbound messages could be in any of the following states: queued, sent, failed, delivered, undelivered.

All outbound messages are initially queued. A message is marked as failed if an internal error occurs before the message is passed on to downstream carriers. A message is marked as sent when the message is successfully passed on to downstream carrier. The message is marked delivered or undelivered based on the delivery receipt received from the carrier. Note that delivery receipts are not universally supported across countries, number types and mobile networks. The final status of a message may remain as sent in cases where delivery receipts are not received.

Inbound messages could be in any of the following states: received, delivered, undelivered.

All inbound messages are initially marked as received. If the Plivo phone number on which the message was received is associated with an Application, and the application has a valid message_url configured, then the message is forwarded to that url. The message is marked as delivered on a successful response from the message_url, else it is marked undelivered.

message_type string

This attribute is always set to sms at the moment.

from_number string

This attributes identifies the source address of the message. This could be a Plivo Phone number, short code, or alphanumeric sender id in case of outbound messages.

In case of inbound messages, this would be the phone number from which the message to the Plivo phone number was initiated.

to_number string

This is the destination phone number to which the message was sent. In case of inbound messages, this would be the Plivo phone number on which the message was received.

units integer

This attribute indicates the total number of units that a message was split into.

total_rate string

This is the charge applicable per unit of the message.

total_amount string

This is the total amount charged for this message. Typically, this would be equal to the product of total_rate and units.

error_code string

This is the Plivo SMS error code that helps identify the cause for a message delivery failure. For successfully delivered messages, this attribute is set to 000.

It is set to one of the error codes described here for failed and undelivered messages.

Response

{
  "error_code": "200",
  "from_number": "18552828641",
  "message_direction": "outbound",
  "message_state": "failed",
  "message_time": "2016-08-17 21:26:44+05:30",
  "message_type": "sms",
  "message_uuid": "85ce8068-6fab-4f0a-9dc7-d6c852cdde91",
  "resource_uri": "/v1/Account/{auth_id}/Message/85ce8068-6fab-4f0a-9dc7-d6c852cdde91/",
  "to_number": "19352326448",
  "total_amount": "0.00000",
  "total_rate": "0.00350",
  "units": 1
}