Use the SDK to easily incorporate inbox functionality into your mobile app. All active inbox messages download to the mobile device each time the app is brought to the foreground.
Marketers can create an
Inbox Only message to deliver the message silently to the inbox or an
Inbox+Alert message to include a push notification with the inbox message.
Implement Inbox Functionality
Find convenience methods for refreshing the inbox and getting, reading, and deleting messages in InboxMessages Methods.
To display inbox-only messages sent from Marketing Cloud, use the UITableView datasource provided by the SDK in a UIViewController. Your UIViewController creates an inbox in your app to display these messages. The SDK adds messages to the datasource after they are downloaded.
Manage the selection of rows in your tableview using the basic UITableView delegate provided by the SDK. Otherwise, your app must implement a UITableView delegate.
Example: Inbox Implementation
This example includes a simple implementation of an inbox using the SDK as the datasource and delegate.
For additional control, presentation, and usability, implement your own datasource and delegate using the support offered by the SDK.
Inbox Messaging Public Properties
SDK offers the following convenience methods:
getDeletedMessages. Each method returns an
Array of dictionary (e.g. [String: AnyObject])
Below are the public properties within the dictionary that can be used by the consuming application
The remaining properties within the dictionary (e.g.
contentType, messageDeleted, messageHash, requestId, statusDirty) are used internally by the SDK. It is not recommended to use these within a consuming application, as they are subject to change.
Alert + Inbox Messages
The Alert + Inbox was designed to allow a tap on an Inbox Push Notification to take user to an Inbox message, where the Inbox data is added to the Push notification payload. Due to payload size restrictions from Apple, all the Inbox fields cannot be added to the
Push payload, but the user can be redirected to the message without any issues and all fields are available when returned to the Inbox.
subject along with
statusDirty are not available initially in Alert + Inbox Message Dictionary.
When is the Inbox Messages refreshed ?
Inbox Messages are refreshed
When the application comes to the foreground
When triggered by an Inbox + Alert
When the SDK’s “refresh inbox” method is called manually by the consuming application
Sort Inbox Messages by Sent Date
To sort inbox messages in your custom inbox implementation, use the value of
sendDateUtc from the inbox message returned by
sfmc_getAllMessages and other getters.
To sort your UITableView data source array of Inbox messages, use an NSSortDescriptor for the key
sendDateUtc. Sort your data source array with this descriptor, and then reload your UITableView.
Refresh Inbox Messages When Application in Foreground
When the consuming application is in
foreground and an Alert + Inbox notification is received, it is recommended that the consuming application call the
refreshMessages method to retrieve the inbox messages so that it will be reflected on the UI. See LearningApp for sample implementation.