Push step settings

The Push step in an automation sends a notification to every device that a person registered with your push channels. This page covers each setting on the step, and what your app gets.

Text fields take variables, for example {event.properties.chat_id} or {person.properties.name}. The body uses Liquid instead, for example {{ person.properties.name }}.

The Push step's settings panel in the automation editor, with Push channels, Delivery, title, body, and the Android and iOS sections

Main settings

SettingWhat it does
Push channelsThe FCM and APNs channels to send through. Each person gets the notification on the devices that they registered with those channels. PostHog skips people with no device on a channel, and doesn't bill for them.
DeliveryWhether the device shows the notification, or only your app gets it. See delivery.
Notification titleRequired, except for a silent push. The default is Notification from {event.event}.
Notification bodyOptional text under the title.
Image URLOptional image to show in the notification. On iOS, your app needs a notification service extension to show it.
LinkWhere a tap takes the person, such as myapp://chat/123. See link and group.
GroupBundles related notifications, such as the messages in one conversation. See link and group.
Custom data payloadKey-value pairs that your app gets. Values must be strings, because FCM accepts only strings.
Collapse keyOn iOS, a notification with the same key replaces the one already shown. On Android, it only collapses messages still waiting for an offline device. To replace a notification already shown on Android, use Android tag.
TTL (seconds)How long FCM or APNs keeps the message for a device that's offline.

The step also has Android and iOS sections. On Android, you can set the priority, channel ID, sound, tag, icon, color, and click action. On iOS, you can set the sound, badge, subtitle, category, thread ID, interruption level, and mutable content.

Delivery

OptionAndroidiOS
Show a notification (default)The system shows the notification.The system shows the notification.
Data only on Android, notification on iOSNothing is shown. Your app gets the message in onMessageReceived, even in the background, and draws the notification itself.The system shows the notification.
Silent, show nothingNothing is shown. Your app gets the message in onMessageReceived.Nothing is shown. iOS wakes your app in the background with the data.

With Show a notification, the system shows the notification only while your app is in the background. When your app is in the foreground:

  • On Android, the message goes to onMessageReceived, and your app has to show it.
  • On iOS, your UNUserNotificationCenterDelegate has to return the presentation options, such as [.banner, .sound], from userNotificationCenter(_:willPresent:withCompletionHandler:).

For data only and silent pushes, put everything that your app needs in Custom data payload. A data only push sends no title, body, or image to Android, and Android priority is the only Android setting that applies. A silent push sends no title, body, or image to any device.

Silent pushes on iOS:

  • Your app needs the Remote notifications background mode, and it receives the push in application(_:didReceiveRemoteNotification:fetchCompletionHandler:).
  • Apple sends them at low priority and limits how often an app is woken, so a silent push can arrive late or not at all. Don't use them for anything time critical.

Link and Group are sent to your app in the custom data, as the link and group keys. If you also set a link key in Custom data payload, the Link field replaces it.

On iOS, Group is also used as the thread ID, so iOS bundles notifications with the same group. If you set iOS thread ID, that's used instead.

The PostHog SDKs don't open the link, and they don't group notifications on Android. Your app reads these keys itself.

On Android, read them where your app handles the push. For a data only or silent push, that's onMessageReceived, where you can also pass group to setGroup() when you build the notification:

Kotlin
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(message: RemoteMessage) {
val link = message.data["link"]
val group = message.data["group"]
// Build the notification, using `group` with NotificationCompat.Builder.setGroup()
}
}

When the system shows the notification and the app is in the background, a tap opens your launcher activity with the data in its intent extras:

Kotlin
val link = intent.extras?.getString("link")

On iOS, read them when the person taps the notification:

Swift
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
let userInfo = response.notification.request.content.userInfo
if let link = userInfo["link"] as? String, let url = URL(string: link) {
UIApplication.shared.open(url)
}
completionHandler()
}

Protect sensitive data

Turn on Protect sensitive data in the step's settings panel for notifications that carry private content, such as direct messages or sign-in codes. It's off by default.

When it's on:

  • The notification is still sent as usual.
  • The workflow doesn't keep a copy of the title, subtitle, body, or image as sent. The workflow's Assets tab and the person's Push notifications tab show that a notification was sent, with the title as you wrote it in the step, before variables are filled in. They also show a note that the content wasn't stored.
  • The workflow run doesn't keep its variables, so the run can't be rerun.

These tabs never include a push's custom data, whether or not this setting is on.

This setting covers only what the workflow stores. When someone taps the notification, the iOS SDK captures a $push_notification_opened event with the notification's title, subtitle, and body. To keep that content out of your events, remove it before the event is sent:

Swift
config.setBeforeSend { event in
if event.event == "$push_notification_opened" {
event.properties["$notification_title"] = nil
event.properties["$notification_subtitle"] = nil
event.properties["$notification_body"] = nil
}
return event
}

On Android, opens that the SDK captures automatically have no title or body. React Native and Flutter apps capture iOS opens in the native SDK, where your JavaScript or Dart before_send hook can't reach them. In those apps, turn off capturePushNotificationOpened and capture opens yourself, without the content. When you capture an open yourself, on any platform, don't pass the content.

Still have questions?

Was this page useful?