Relay.Messaging.Message
Relay.Messaging.Message
An object representing an SMS or MMS message. It is the parameter of both onIncomingMessage and onMessageStateChange Consumer handlers.
Properties
| Property | Type | Description | 
|---|---|---|
| Id | string | The unique identifier of the message. | 
| Context | string | The context of the message. | 
| From | string | The phone number the message comes from. | 
| To | string | The destination number of the message. | 
| Direction | string | The direction of the message: inboundoroutbound. | 
| State | string | The current state of the message. See Relay.Messaging.MessageState Events for all the possible states. | 
| Body | string | The content of the message. | 
| Media | string[] | Array of URLs media. | 
| Tags | string[] | Array of strings with message tags. | 
| Segments | number | Number of segments of the message. | 
| Reason | string | Reason why the message was not sent. Present only in case of failure. | 
Events
State Events
To track the state of a message.
| Event | Description | 
|---|---|
| MsgQueued | The message has been queued in Relay. | 
| MsgInitiated | Relay has initiate the process to send the message. | 
| MsgSent | Relay has sent the message. | 
| MsgDelivered | The message has been successfully delivered.  Due to the nature of SMS and MMS, receiving a deliveredevent is not guaranteed, even if the message is delivered successfully. | 
| MsgUndelivered | The message has not been delivered.  Due to the nature of SMS and MMS, receiving a undeliveredevent is not guaranteed, even if the message fails to be delivered. | 
| MsgFailed | The call has failed. |