Event Tracking
Add a Thumbnail to Your App Inbox
Control App Badging
Push Messages in the Marketing Cloud Engagement REST API Reference
Transactional Push Messages in the Marketing Cloud Engagement REST API Reference
Use custom keys to customize the way your app displays inbox messages. By using custom keys, your app can display message-specific information.
Your application can access an image URL to add a thumbnail image to your message list.
Create a custom key named inboxThumbnail. See Salesforce Help: MobilePush Custom Keys.
Create an inbox message targeted for your application. See Salesforce Help: Create and Send an Inbox Message.
When you configure the message, set the custom key inboxThumbnail to a valid https URL. For example, https://example.com/image.jpg.
Important
To access the custom key sent in a message in your app’s inbox, use these code examples. This example is based on the sample code in our Android LearningApp and iOS LearningApp projects.
To access the custom key in an Android app, use this code example.
1fun bind(message: InboxMessage) {
2 message.customKeys()?.forEach { entry ->
3 when(entry.key) {
4 "inboxThumbnail"-> {
5 print(entry.value)
6 // If value is your inbox message’s thumbnail URL,
7 // use it to download the image and then set your View..
8 // The implementation of this is application-specific.
9 }
10 }
11 }
12}To access the custom key in an iOS app, use this code example.
1override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
2 let cell = tableView.dequeueReusableCell(withIdentifier: "InboxCell", for: indexPath)
3 let inboxMessage = dataSourceArray[indexPath.row]
4
5 if let customKeys = inboxMessage["keys"] as? [[String:String]] {
6 for customKey in customKeys {
7 if let key = customKey["key"] {
8 if key == "inboxThumbnail" {
9 if let value = customKey["value"] {
10
11 print(value)
12 // If value is your inbox message’s thumbnail URL,
13 // use it to download the image and then set your UITableViewCell imageView.
14 // The implementation of this is application-specific.
15
16 }
17 }
18 }
19 }
20 }
21
22 // ...
23 // UITableViewCell setup here
24
25}