Edit in GitHubLog an issue

Display rich notifications using AEPMessagingNotification

You must use a Notification Service app extension to download images or other media attachments for the notification before displaying it on user's iOS device.

Follow Apple's documentation to add a Notification Service app extension to your project.

Installation

The AEPMessagingNotification package is a lightweight, extension-safe library with no dependency on AEPCore or AEPServices. It is safe to import inside a UNNotificationServiceExtension target.

Install using CocoaPods

Add the pod to your Notification Service Extension target in your Podfile:

Copied to your clipboard
target 'NotificationService' do
pod 'AEPMessagingNotification'
end

For more information on using CocoaPods, refer to the using CocoaPods guide.

Install using Swift Package Manager

To add the AEPMessagingNotification package to your application, from the Xcode menu select:

File > Add Packages...

Enter the URL for the AEP Messaging Notification repository: https://github.com/adobe/aepsdk-messaging-ios.git.

For Dependency Rule, select Up to Next Major Version.

MessagingNotificationHelper

MessagingNotificationHelper (Objective-C: AEPMessagingNotificationHelper) handles downloading media from the adb_media key in the push payload and attaching it to the notification content automatically.

FeatureDetail
Supported media
Images (JPG, PNG, GIF), Video (MP4), Audio (MP3, WAV, AIFF, M4A)
URL scheme
HTTPS only
Fallback
Notification delivers without attachment if download fails

Notification service extension implementation

Notifications from Adobe Journey Optimizer contain a media attachment URL in the adb_media key of the notification payload. Use MessagingNotificationHelper in your service extension to automatically download the media attachment and attach it to the notification before displaying it on the user's device.

Copied to your clipboard
import AEPMessagingNotification
import UserNotifications
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = request.content.mutableCopy() as? UNMutableNotificationContent
guard let content = bestAttemptContent else {
contentHandler(request.content)
return
}
MessagingNotificationHelper.processNotificationRequest(with: content, contentHandler: contentHandler)
}
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Deliver the best attempt at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
contentHandler(bestAttemptContent)
}
}
}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2026 Adobe. All rights reserved.