Skip to main content

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 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.

StateDescription
queuedThe message has been queued in Relay
initiatedRelay has initiate the process to send the message
sentRelay has sent the message
deliveredThe 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
undeliveredThe 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
failedThe message has failed