InboxMessage

Package: com.salesforce.marketingcloud.messages.inbox

Type: Data Class (Kotlin)

SDK Version: 11.0.0

Description 

The InboxMessage class is a data class from the Salesforce Marketing Cloud Unified SDK that represents an inbox message within the marketing cloud messaging system. It encapsulates all the properties and metadata associated with messages stored in the Marketing Cloud inbox.

Class Declaration 

1data class InboxMessage(
2    val id: String,
3    requestId: String? = null,
4    messageHash: String? = null,
5    val subject: String? = null,
6    val title: String? = null,
7    val alert: String? = null,
8    val sound: String? = null,
9    val media: InboxMessage.Media? = null,
10    val startDateUtc: Date? = null,
11    val endDateUtc: Date? = null,
12    val sendDateUtc: Date? = null,
13    val url: String?,
14    val custom: String? = null,
15    val customKeys: Map<String, String>? = null,
16    val subtitle: String? = null,
17    val inboxMessage: String? = null,
18    val inboxSubtitle: String? = null,
19    var notificationMessage: NotificationMessage? = null,
20    viewCount: Int = 0,
21    val messageType: Int?,
22    var deleted: Boolean = false
23)

Constructor 

Primary Constructor 

The class has a single primary constructor with the following parameters:

ParameterTypeDefaultDescription
idStringRequiredUnique identifier for the message
requestIdString?nullOptional request identifier
messageHashString?nullOptional message hash
subjectString?nullMessage subject
titleString?nullMessage title
alertString?nullAlert text
soundString?nullSound identifier
mediaInboxMessage.Media?nullAssociated media content
startDateUtcDate?nullMessage start date (UTC)
endDateUtcDate?nullMessage end date (UTC)
sendDateUtcDate?nullMessage send date (UTC)
urlString?RequiredAssociated URL
customString?nullCustom data string
customKeysMap<String, String>?nullCustom key-value pairs
subtitleString?nullMessage subtitle
inboxMessageString?nullInbox-specific message content
inboxSubtitleString?nullInbox-specific subtitle
notificationMessageNotificationMessage?nullAssociated notification message
viewCountInt0Number of times viewed
messageTypeInt?RequiredType identifier for the message
deletedBooleanfalseDeletion status flag

Properties 

All properties are annotated with @JvmField for Java interoperability.

Immutable Properties (val) 

id: String 

Unique message identifier.

subject: String? 

Message subject text.

title: String? 

Message title.

alert: String? 

Alert text for the message.

sound: String? 

Sound identifier associated with the message.

media: InboxMessage.Media? 

Media content associated with the message.

startDateUtc: Date? 

Message start date in UTC.

endDateUtc: Date? 

Message end date in UTC.

sendDateUtc: Date? 

Message send date in UTC.

url: String? 

Associated URL for the message.

custom: String? 

Custom data string.

customKeys: Map<String, String>? 

Custom key-value pairs for additional metadata.

subtitle: String? 

Message subtitle.

inboxMessage: String? 

Inbox-specific message content.

inboxSubtitle: String? 

Inbox-specific subtitle.

messageType: Int? 

Type identifier for the message.

Mutable Properties (var) 

notificationMessage: NotificationMessage? 

Associated notification message object.

deleted: Boolean 

Deletion status flag (default: false).

read: Boolean 

Read status of the message (derived property).

Methods 

As a Kotlin data class, InboxMessage automatically provides the following methods:

copy() 

Creates a copy of the message with optionally modified properties.

1fun copy(
2    id: String = this.id,
3    requestId: String? = this.requestId,
4    messageHash: String? = this.messageHash,
5    // ... all other parameters
6): InboxMessage

equals(other: Any?): Boolean 

Compares this message with another object for equality.

hashCode(): Int 

Generates a hash code for the message.

toString(): String 

Returns a string representation of the message.

Component Functions 

Component functions for destructuring declarations (e.g., component1(), component2(), etc.).

Nested Types 

InboxMessageType 

1enum InboxMessageType : Enum<InboxMessage.InboxMessageType>

Represents the type of an inbox message.

Media 

1data class Media

Represents media content associated with an inbox message.

Related Classes 

  • NotificationMessage (com.salesforce.marketingcloud.notifications) - Associated notification message type

See Also