InboxFeature
@objc(SFInboxFeature)
public final class InboxFeature : NSObject, SFMCModule
extension InboxFeature: Subscriber
extension InboxFeature: Publisher
extension InboxFeature: InboxFeatureApi
extension InboxFeature: InboxFeatureProtocol
Main entry point for the Inbox feature module.
-
Requests the Inbox Feature Module when it’s operational and safe to use. The provided callback will be invoked with the Inbox Feature Module when it’s ready. All Inbox feature module-related API calls should be made within this function.
Declaration
Swift
@objc public static func requestSdk(_ callback: @escaping (_ inboxFeature: InboxFeatureApi?) -> Void)Parameters
callbackA callback that will receive the Inbox Feature Module when it’s operational/ready.
-
Returns all active Inbox messages already downloaded.
Active messages are within their start and end dates and are not deleted.
Declaration
Swift
public func getAllMessages() -> [InboxMessage]Return Value
Inbox messages, or an empty array when the module is not operational or Inbox is disabled.
-
Returns unread active Inbox messages already downloaded.
Declaration
Swift
public func getUnreadMessages() -> [InboxMessage]Return Value
Unread Inbox messages, or an empty array when the module is not operational or Inbox is disabled.
-
Returns active Inbox messages marked as read.
Declaration
Swift
public func getReadMessages() -> [InboxMessage]Return Value
Read Inbox messages, or an empty array when the module is not operational or Inbox is disabled.
-
Returns active Inbox messages marked as deleted.
Declaration
Swift
public func getDeletedMessages() -> [InboxMessage]Return Value
Deleted Inbox messages, or an empty array when the module is not operational or Inbox is disabled.
-
Returns the count of all active Inbox messages already downloaded.
Useful for inbox count badges or other interface elements, without having to fetch messages directly.
Declaration
Swift
public func getAllMessagesCount() -> IntReturn Value
The number of messages, or
0when the module is not operational or Inbox is disabled. -
Returns the count of unread active Inbox messages already downloaded.
Useful for inbox count badges or other interface elements, without having to fetch messages directly.
Declaration
Swift
public func getUnreadMessagesCount() -> IntReturn Value
The number of messages, or
0when the module is not operational or Inbox is disabled. -
Returns the count of active Inbox messages marked as read.
Useful for inbox count badges or other interface elements, without having to fetch messages directly.
Declaration
Swift
public func getReadMessagesCount() -> IntReturn Value
The number of messages, or
0when the module is not operational or Inbox is disabled. -
Returns the count of active Inbox messages marked as deleted.
Useful for inbox count badges or other interface elements, without having to fetch messages directly.
Declaration
Swift
public func getDeletedMessagesCount() -> IntReturn Value
The number of messages, or
0when the module is not operational or Inbox is disabled.
-
Marks an Inbox message as read.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled. A deleted message stays deleted. The read state is synced to the server on the next status update.
Declaration
Swift
public func markMessageRead(id: String) -> BoolParameters
idThe Inbox message identifier.
Return Value
trueif the message was marked read.falseif the module is not operational, Inbox is disabled, or the identifier is unknown. -
Marks an Inbox message as deleted.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled. Deletion takes precedence over read when the status is synced to the server.
Declaration
Swift
public func markMessageDeleted(id: String) -> BoolParameters
idThe Inbox message identifier.
Return Value
trueif the message was marked deleted.falseif the module is not operational, Inbox is disabled, or the identifier is unknown. -
Marks an Inbox message as read.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled.
Declaration
Swift
public func markMessageRead(message: InboxMessage) -> BoolParameters
messageThe Inbox message to mark as read.
Return Value
trueif the message was marked read.falseif the module is not operational, Inbox is disabled, or the message is unknown. -
Marks an Inbox message as deleted.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled.
Declaration
Swift
public func markMessageDeleted(message: InboxMessage) -> BoolParameters
messageThe Inbox message to mark as deleted.
Return Value
trueif the message was marked deleted.falseif the module is not operational, Inbox is disabled, or the message is unknown. -
Marks all active Inbox messages as read.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled.
Declaration
Swift
public func markAllMessagesRead() -> BoolReturn Value
trueif messages were marked read.falseif the module is not operational, Inbox is disabled, or there were no unread messages. -
Marks all active Inbox messages as deleted.
This state is persisted locally and is reset if the SDK’s data is reset, for example after the app is deleted and reinstalled.
Declaration
Swift
public func markAllMessagesDeleted() -> BoolReturn Value
trueif messages were marked deleted.falseif the module is not operational, Inbox is disabled, or there were no messages to delete.
-
Reloads Inbox messages from each operational producer (Marketing Cloud Engagement, Mobile App Messaging, or both).
Manual refresh is limited to one request per minute. A call made before that interval elapses, while Inbox is disabled, or while the module is not operational completes with
falseandMessageProducer/inboxFeature.During server-side throttling a producer may answer
429 - Too Many Requests. That failure is delivered throughcompletionand is not sent toInboxResponseDelegate.The completion is invoked once for each expected producer. Success and failure from a producer are delivered on the main queue. A refused refresh stays on the calling thread.
Declaration
Swift
public func refreshMessages(_ completion: ((Bool, MessageProducer) -> Void)?)Parameters
completionOptional one-shot callback. Pass
nilto refresh without completion callbacks. Registering a completion does not replace anInboxResponseDelegate. -
Registers for successful Inbox downloads.
The SDK retains
delegateuntilunregisterInboxResponseDelegate(_:). No-op if the module is not operational. Failures are not delivered here. Use therefreshMessagescompletion for refresh outcomes.Declaration
Swift
public func registerInboxResponseDelegate(_ delegate: InboxResponseDelegate)Parameters
delegateThe object to notify after a producer persists Inbox messages.
-
Removes a previously registered response delegate.
No-op if the module is not operational or the delegate was not registered.
Declaration
Swift
public func unregisterInboxResponseDelegate(_ delegate: InboxResponseDelegate)Parameters
delegateThe delegate to remove.
-
Records that the user opened an Inbox message.
No-op if the module is not operational or Inbox is disabled. This does not mark the message as read. Call
markMessageRead(message:)to update read state.Declaration
Swift
public func trackMessageOpenEvent(_ message: InboxMessage)Parameters
messageThe Inbox message that was opened.
-
Records a tap on an Inbox message call to action or button.
No-op if the module is not operational or Inbox is disabled.
Declaration
Swift
public func trackMessageInteractionEvent(_ message: InboxMessage, interaction: InboxMessageInteraction)Parameters
messageThe Inbox message that was tapped.
interactionThe tapped object. Use
InboxInteractionType/ctafor the message action andInboxInteractionType/buttonwith the button identifier for a button.
-
Enables or disables Inbox processing for this app.
Disabling Inbox cancels a refresh that is still waiting for producers. It does not delete messages already downloaded. While Inbox is disabled, reads return empty results, mutations return
false, analytics no-op, andrefreshMessagescompletes withfalse. No-op if the module is not operational.Declaration
Swift
public func setInboxEnabled(_ enabled: Bool)Parameters
enabledPass
trueto enable Inbox, orfalseto disable it. -
Returns whether Inbox processing is enabled.
Declaration
Swift
public func isInboxEnabled() -> BoolReturn Value
truewhen Inbox is enabled.falsewhen it is disabled or the module is not operational.
InboxFeature Class Reference