Iterable can customize your push notifications with action buttons, animated GIFs, images, sounds, and deep linking.
In this article
Adding a push notification extension
The following sections describe the technical setup necessary for various iOS push notification customizations in Iterable.
For marketer-specific information about how to configure these features in Iterable when sending a campaign, read Creating a Push Notification Campaign.
Configure support for rich push notifications
For push notifications to contain images, animated GIFs, video, or action buttons, you must create a Notification Service Extension.
Iterable's iOS SDK provides a Notification Service Extension implementation that handles media attachments and action buttons. To use it:
-
Install
IterableAppExtensions
in your iOS app.For more information, read the installation instructions in Iterable's iOS SDK.
Create a new target of type Notification Service Extension in your Xcode project.
If you are calling Iterable SDK from Swift, edit the
NotificationService
class generated by Xcode so that it extendsITBNotificationServiceExtension
.If you are using Objective-C, use delegation instead of inheritance.
Swift
import UserNotifications import IterableAppExtensions class NotificationService: ITBNotificationServiceExtension {}
Objective-C
// File: NotificationService.m #import "NotificationService.h" @import IterableAppExtensions; @interface NotificationService () @property (nonatomic, strong) ITBNotificationServiceExtension *baseExtension; @end @implementation NotificationService - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { self.baseExtension = [[ITBNotificationServiceExtension alloc] init]; [self.baseExtension didReceiveNotificationRequest:request withContentHandler:contentHandler]; } - (void)serviceExtensionTimeWillExpire { [self.baseExtension serviceExtensionTimeWillExpire]; } @end
Adding sounds to iOS push notifications
To add sound to iOS push notifications, follow these instructions:
-
Put the necessary sound files in the iOS project's Library/Sound folder, or in the top-level directory of the Xcode project.
NOTE
See Apple's
UNNotificationSound
documentation for a list of supported sound formats. Navigate to Content > Templates and open the push notification template.
Click Edit details and scroll down.
-
Enter the path to the custom sound file in the Custom sound field.
NOTES
- To use the default push notification sound, set this field to
default
. - Whether or not a device plays the sound or vibrates depends on the user's device settings.
- To use the default push notification sound, set this field to
Adding deep links to iOS push notifications
WARNING
By default, iOS apps can open HTTPS URLs, but not HTTP. Because of this, you should use HTTPS whenever possible. However, it is possible to configure your iOS apps to work with HTTP URLs by configuring App Transport Security exceptions in Xcode.
Iterable push notification templates make it possible to set deep link URLs for iOS and Android.
To learn more about using Iterable's iOS SDK to handle deep links, read Deep Links in Push Notifications.
If your app is not using Iterable's iOS SDK, it can still handle a deep link
contained in an Iterable push notification. Iterable provides the deep link
URL in the defaultAction
object included in the notification's payload.
When this object's type
field is set to openUrl
, the data
field will
contain the deep link URL.
When using the SDK, code executing after an app has opened in response to a
user's interaction with a push notification can use
IterableAPI.lastPushPayload
to access the push notification's payload.
Further reading
For more information about push notifications in Iterable, read: