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: inbound or outbound |
state | string | The current state of the message. See State 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.
State | Description |
---|---|
queued | The message has been queued in Relay |
initiated | Relay has initiate the process to send the message |
sent | Relay has sent the message |
delivered | The 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 |
undelivered | The 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 |
failed | The message has failed |