Send Rich Notifications
Rich notifications include images, videos, titles, and subtitles from Marketing Cloud Next and mutable content. Mutable content can include personalization in the title, subtitle, or body of your message.
- Make sure that your app is built for iOS version 10 or later.
- Include a service extension for your app that can handle mutable content. See Apple Developer Documentation: Modifying and Presenting Notifications.
- Make sure that your app is registered to send push notifications in Marketing Cloud Next.
Skip these steps if you’ve already integrated Notification Service Extension when you integrated the Mobile App Messaging SDK with your app.
- Click File > New > Target.
- Select Notification Service Extension.
- Name and save the new extension.
- In your project target’s General settings, confirm that the new extension is listed in the Frameworks, Libraries, and Embedded Content section. If not, add it.
The Notification Target must be signed with the same Xcode Managed Profile as the main project.
This service extension checks for a _mediaUrl element in request.content.userInfo. If found, the extension attempts to download the media from the URL, creates a thumbnail-size version, and then adds the attachment. The service extension also checks for a _mediaAlt element in request.content.userInfo. If found, the service extension uses the element for the body text if there are any problems downloading or creating the media attachment.
A service extension can timeout if it’s unable to download. In this code sample, the service extension delivers the original content with the body text changed to the value in _mediaAlt. This code example assumes your app is using the Mobile App Messaging SDK without the Extension SDK integration.
If your app uses the Mobile App Messaging SDK with the Extension SDK integration, use this code example instead.