Skip to content
Menu

Push notifications

Push stories

Markdown version

Send a push with 2 to 10 pages people flip through, each with an image, title, subtitle and deep link, shown by a Notification Content Extension on iOS and by the FCM module on Android.

A push story is a push with 2 to 10 pages. Each page has an image, a title, a subtitle and an optional deep link. People move between pages from the expanded notification and open the page they're on. It is the Herald version of Braze push stories.

Push stories need SDK 0.7.0 (not released yet). A device on an older SDK, or an iPhone app without the extensions below, shows the first page as a normal rich push: its image, its title, its subtitle as the body, and its deep link.

Before you start

  • Push set up on the platform: iOS setup or Android setup.
  • Images served over HTTPS.
  • On iOS, the Notification Service Extension from Rich push. It downloads every page's image before the notification shows.

Create a story

In a campaign, open the Push channel and turn on Story. The push's title, body, image and deep link become the first page, and an empty second page is added.

  1. For each page, choose an image from the media library (or paste an HTTPS URL), then fill in Title (up to 60 characters in the editor), Subtitle (up to 178) and an optional Deep link. A page without a deep link opens the app.
  2. Use Add page for up to 10 pages. The arrows move a page up or down, and the cross removes it (a story keeps at least 2).
  3. The preview shows the first page, which is what the collapsed notification and older apps show.

All pages together, plus the first page's text, image and link (sent a second time for older apps), must fit in about 3.4 KB of the push (Apple and Google cap a push at 4 KB). If they don't, the campaign can't be saved: shorten the text or links, or remove a page. Agents don't send stories.

From your backend, send a story with the Send API.

iOS: add a Notification Content Extension

iOS shows the pages in a Notification Content Extension, a second app extension beside the service extension.

  1. In Xcode, choose File > New > Target > Notification Content Extension, name it (for example LumenPushStory) and embed it in your app. Set its deployment target to iOS 16 or later.
  2. Add the HeraldPushStory library to the new target only. Like HeraldNotificationService, it doesn't depend on HeraldSDK.
  3. Delete the generated MainInterface.storyboard and replace NotificationViewController.swift with:
swift
import HeraldPushStory

final class NotificationViewController: HeraldStoryViewController {}
  1. In the extension's Info.plist, under NSExtension, remove NSExtensionMainStoryboard, add NSExtensionPrincipalClass with the value $(PRODUCT_MODULE_NAME).NotificationViewController, and set these keys under NSExtensionAttributes:
KeyValue
UNNotificationExtensionCategoryHERALD_STORY
UNNotificationExtensionDefaultContentHiddenYES (the extension shows the title and subtitle itself)
UNNotificationExtensionInitialContentSizeRatio1
  1. Keep forwarding notification taps to Herald.shared.handleNotificationResponse(_:) from your UNUserNotificationCenterDelegate, as in iOS setup.

When a person long-presses or expands a story, the extension shows the current page's image, title and subtitle, with Previous, Next and Open under it. Open opens the app at that page's deep link, or just opens the app when the page has none. Tapping the notification itself opens the first page, as it does on a device without the extension. To rename the buttons, override previousTitle, nextTitle and openTitle in your subclass.

The service extension registers the HERALD_STORY category with a single Open button the first time a story arrives, so an app with the service extension but no content extension still gets a working button. If a page's image didn't download in time, the content extension downloads it when the page is shown.

Android: nothing to add

herald-fcm shows stories. A story arrives as an FCM data message, and herald-fcm builds the notification with the page's image, title and subtitle and Previous and Next buttons. A button redraws the same notification with the other page, without sound or vibration. A tap opens the app at the page shown (just the app when the page has no deep link). The collapsed notification shows the page's title and subtitle.

To rename the buttons, override the string resources herald_story_previous and herald_story_next in your app.

What gets tracked

Opening a page logs a push open and a button interaction whose button ID is herald_story_page_<index>, counting from 0 (herald_story_page_1 is the second page). Moving between pages logs nothing. A tap on the iOS notification itself logs an open of the first page with no button.

What Herald sends

PlatformPayload
iOS (APNs)aps.category: HERALD_STORY, mutable-content: 1, and herald_story: the pages as [{"image_url", "title", "subtitle", "deeplink"?}]. The alert, image_url and deeplink are the first page's.
Android (FCM)A data message with no notification block: title, body and image from the first page, and herald_story with the same array as a JSON string.

Troubleshooting

  • iOS shows a normal push. The content extension is missing, not embedded, its UNNotificationExtensionCategory isn't HERALD_STORY, or the app is on an SDK before 0.7.0.
  • iOS shows a normal push with the service extension missing. The service extension registers the HERALD_STORY category the first time a story arrives; without it, register a category with that id in your app (for example with registerPushCategories), or iOS won't use the content extension.
  • iOS pages have no image. The images are not HTTPS, don't load from the device, or aren't a type iOS can show (JPEG, PNG, GIF or HEIC). The content extension downloads any image the service extension didn't attach.
  • Android shows a normal push. The app's herald-fcm is older than 0.7.0, or another messaging service receives FCM messages. See Android setup.

Next

See Herald decide live →