Skip to main content

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​

PropertyTypeDescription
IdstringThe unique identifier of the message.
ContextstringThe context of the message.
FromstringThe phone number the message comes from.
TostringThe destination number of the message.
DirectionstringThe direction of the message: inbound or outbound.
StatestringThe current state of the message. See Relay.Messaging.Message State Events for all the possible states.
BodystringThe content of the message.
Mediastring[]Array of URLs media.
Tagsstring[]Array of strings with message tags.
SegmentsnumberNumber of segments of the message.
ReasonstringReason why the message was not sent.
Present only in case of failure.

Events​

State Events​

To track the state of a message.

EventDescription
MsgQueuedThe message has been queued in Relay.
MsgInitiatedRelay has initiate the process to send the message.
MsgSentRelay has sent the message.
MsgDeliveredThe message has been successfully delivered. Due to the nature of SMS and MMS, receiving a delivered event is not guaranteed, even if the message is delivered successfully.
MsgUndeliveredThe message has not been delivered. Due to the nature of SMS and MMS, receiving a undelivered event is not guaranteed, even if the message fails to be delivered.
MsgFailedThe call has failed.