*** id: aa110427-d02f-4f05-930e-87f82e73eda7 title: Relay.Messaging.Message slug: /python/reference/messaging/message max-toc-depth: 3 ---------------- [relay-consumer]: /docs/server-sdk/v2/python/reference/consumer [relay-messaging-message]: /docs/server-sdk/v2/python/reference/messaging/message An object representing an SMS or MMS message. It is the parameter of both [`onIncomingMessage`][relay-consumer] and [`onMessageStateChange`][relay-consumer] Consumer handlers. ## Properties | Property | Type | Description | | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ | | `id` | string | The unique identifier of the message. | | `context` | string | The context of the message. | | `from_number` | string | The phone number the message comes from. | | `to_number` | 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 [`Relay.Messaging.Message`][relay-messaging-message] State Events for all the possible states. | | `body` | string | The content of the message. | | `media` | list | List of URLs media. | | `tags` | list | List 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. | Property | 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 call has failed. |