Inbox

Prev Next

Overview

The Inbox API of the Mapp Engage iOS SDK exposes the rich messages associated with the device. Use it to fetch the device's inbox, refresh it from the server, mark messages as read, and delete messages.

Note:

This page describes the inbox built into the Mapp Engage push SDK. It is not the standalone In-App SDK — that SDK ships a different class hierarchy (AppoxeeInapp) and is documented separately. The methods on this page live on Appoxee.shared() and return APXRichMessage objects.

Purpose:

  • Provide a persistent inbox of rich messages so users can revisit content even after dismissing a push notification.

  • Drive in-app inbox UI from the SDK's local cache, refreshed on demand from the server.

Benefits:

  • On-demand access to rich content delivered through Mapp Engage.

  • Read/unread state managed by the SDK and synced with the server.

Implementation Details

  1. Fetch the inbox: Returns the locally cached list of APXRichMessage objects.

    Appoxee.shared()?.getRichMessages { error, data in
        guard error == nil, let messages = data as? [APXRichMessage] else { return }
        for message in messages {
            let title = message.title ?? ""
            if let postDate = message.postDate {
                print("\(title) — \(postDate)")
            } else {
                print(title)
            }
        }
    }
    [[Appoxee shared] getRichMessagesWithHandler:^(NSError * _Nullable error, id _Nullable data) {
        if (!error) {
            NSArray<APXRichMessage *> *messages = (NSArray *)data;
            for (APXRichMessage *message in messages) {
                NSLog(@"%@ — %@", message.title, message.postDate);
            }
        }
    }];
  2. Refresh the inbox from the server: Triggers a sync with Mapp Engage and updates the local cache.

    Appoxee.shared()?.refreshInbox { error, data in
        if error == nil { print("Inbox refreshed.") }
    }
    [[Appoxee shared] refreshInboxWithCompletionHandler:^(NSError * _Nullable error, id _Nullable data) {
        if (!error) {
            NSLog(@"Inbox refreshed.");
        }
    }];
  3. Delete a message: Removes a single rich message from the inbox. For Swift, both call forms are valid depending on Swift's argument-label inference. Use whichever Xcode autocompletes for your SDK version.

    // Form A — explicit argument label
    Appoxee.shared()?.deleteRichMessage(message, withHandler: { error, data in
        if error == nil { print("Message deleted.") }
    })
    
    // Form B — trailing closure (if available)
    Appoxee.shared()?.delete(message) { error, data in
        if error == nil { print("Message deleted.") }
    }
    [[Appoxee shared] deleteRichMessage:message
                              withHandler:^(NSError * _Nullable error, id _Nullable data) {
        if (!error) {
            NSLog(@"Message deleted.");
        }
    }];

APXRichMessage Properties

  • uniqueID — Stable identifier for the message.

  • title — Title displayed in the inbox row.

  • content — HTML/rich body of the message.

  • postDate — Local NSDate/Date when the message was posted.

  • postDateUTC — UTC timestamp variant.

  • isRead — Read/unread flag. The SDK toggles this when the message is opened.

  • messageLink — Optional URL the message points to.

Read/Unread Behaviour

  • An unmatched mobile user (anonymous device) who marks a message as read keeps the read state across app close/relaunch and across uninstall/reinstall.

  • A matched mobile user who marks a message as read keeps the read state across app close/relaunch.

  • If the matched user calls logoutWithOptin: and then logs in again with the same alias, the inbox state resets to unread for that user.

  • If the matched user logs out and logs in with a different alias, the new user starts with their own inbox state (unread by default).

Keep in mind:

  • Render the inbox in a standard UITableView or UICollectionView; the SDK does not provide a UI.

  • Test inbox functionality with varying message counts and offline conditions.

  • Handle expired or deleted messages defensively when refreshing the list.